Skip to main content

Query Model and Templates

This page defines the core Auto query shape and copy/paste starters you can use before activation.

Query Shape

{
"conditions": { "AND": ["..."] },
"actions": [
{
"stepId": "step_1",
"type": "notify",
"params": { "message": "..." }
}
],
"expiresIn": "24h"
}

Allowed action types:

  • webhook
  • notify
  • telegram
  • llm

Quick Action Snippets (for Builder Chat)

Use these snippets inside your POST /v2/auto/chat prompt so the generated query includes delivery wiring.

Webhook

Action requirements:
- action type: webhook
- deliver trigger payload to https://your-runner.example/auto/events
- keep payload concise and machine-readable

Telegram

Action requirements:
- action type: telegram
- send alert to my bot/chat with symbol, trigger reason, and timestamp
- include severity label: info, warn, or high

LLM

Action requirements:
- action type: llm
- return one decision: long, short, or no-trade
- include 3 bullet rationale points and confidence score
- I will fetch full output via sessions APIs

Copy/Paste Query Templates

Use these as starting points with Validate Query before create.

Note:

  • action.params keys can vary by integration setup. Treat these as starter templates and adjust for your environment.

1) Breakout Alert (Webhook)

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "BTC" },
"operator": ">",
"value": 100000
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "webhook",
"params": { "url": "https://your-runner.example/auto/events" }
}
],
"expiresIn": "24h"
}

2) Downside Guardrail (Telegram)

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "ETH" },
"operator": "<",
"value": 2500
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "telegram",
"params": { "message": "ETH fell below 2500" }
}
],
"expiresIn": "24h"
}

3) Runner Handoff (Webhook + Notify)

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "SOL" },
"operator": ">",
"value": 220
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "webhook",
"params": { "url": "https://your-runner.example/auto/events" }
},
{
"stepId": "step_2",
"type": "notify",
"params": { "message": "SOL trigger fired; runner notified" }
}
],
"expiresIn": "24h"
}

4) Triggered LLM Analysis

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "BTC" },
"operator": ">",
"value": 100000
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "llm",
"params": { "objective": "Analyze trigger context and return next action" }
}
],
"expiresIn": "24h"
}

5) Multi-Symbol Confirmation

{
"conditions": {
"AND": [
{
"source": "price",
"method": "current",
"args": { "symbol": "BTC" },
"operator": ">",
"value": 100000
},
{
"source": "price",
"method": "current",
"args": { "symbol": "ETH" },
"operator": ">",
"value": 3500
}
]
},
"actions": [
{
"stepId": "step_1",
"type": "notify",
"params": { "message": "BTC and ETH confirmation trigger fired" }
}
],
"expiresIn": "24h"
}

Poll Response Shape

GET /v2/auto/queries/{queryId} returns:

  • queryId
  • status
  • latestEvaluation
  • executions (from Athena executions data array)

Common Agent Flows

Poll-Based LLM Flow

1. POST /v2/auto/queries                               -> create query with action.type = "llm"
2. GET /v2/auto/queries/{queryId} -> poll until execution with sessionId appears
3. GET /v2/auto/queries/{queryId}/sessions/{sessionId} -> fetch full analysis

Webhook-Based LLM Flow

1. POST /v2/auto/queries                               -> create with action.type = "llm" + callback webhook
2. Wait for webhook -> receive session reference / output
3. Optional GET session fetch -> /v2/auto/queries/{queryId}/sessions/{sessionId}