Skip to content

Run an Agent

POST /api/run

The primary endpoint to send a message to your agent and receive a response.


Request

POST https://api.auteryn.ai/api/run

Body:

{
"query": "string (required)",
"task_id": "string (optional — continue an existing conversation)",
"stream": true,
"context": {
"user_id": "string (optional)",
"user_name": "string (optional)",
"metadata": {}
}
}
FieldRequiredDescription
queryThe message or task to send to the agent
task_idPass to continue an existing conversation. Omit to start new.
streamtrue for SSE streaming (default), false for single JSON response
context.user_idYour internal user ID
context.metadataAny key-value pairs your instructions can reference

Responses

Content-Type: text/event-stream

data: {"type":"run_started","run_id":"run_abc","task_id":"task_xyz"}
data: {"type":"text_chunk","content":"Let me check the open bugs..."}
data: {"type":"tool_call","tool":"github","action":"list_issues","params":{"state":"open","label":"P1"}}
data: {"type":"tool_result","tool":"github","result":{"count":3}}
data: {"type":"text_chunk","content":"I found 3 open P1 issues:"}
data: {"type":"run_completed","run_id":"run_abc","credits_used":6,"duration_ms":3241}

Code examples

import httpx, json
with httpx.stream(
"POST",
"https://api.auteryn.ai/api/run",
headers={
"Authorization": "Bearer afk_your_key",
"X-Agent-Id": "agent_xyz",
},
json={"query": "What are the open P1 GitHub issues?"},
) as r:
for line in r.iter_lines():
if line.startswith("data: "):
event = json.loads(line[6:])
if event["type"] == "text_chunk":
print(event["content"], end="", flush=True)