Documentation Index
Fetch the complete documentation index at: https://docs.runtools.ai/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/run is the canonical agent run endpoint. Set stream: false for JSON responses. When stream is omitted or true, the endpoint returns Server-Sent Events for sandbox-backed and managed agents.
Request Body
User prompt. Either prompt or messages is required.
Caller-managed conversation history. Use this when you do not want server-managed thread history.
Persist the run into a server-managed thread. Reuse the same ID to continue the thread.
false returns JSON. true returns Server-Sent Events.
Per-run overrides: maxTokens, maxTurns, and temperature.
Caller metadata stored with the run.
Response
Run status, such as completed, registered, or dispatched.
Final assistant response for non-streaming runs.
Thread ID when threading is active.
Token usage when available.
curl -X POST https://api.runtools.ai/v1/run \
-H "X-API-Key: $RUNTOOLS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent": "code-assistant",
"prompt": "Run the tests and summarize failures.",
"stream": false,
"config": {
"maxTurns": 12
}
}'
{
"data": {
"runId": "run_abc123",
"sandboxId": "sandbox-abc123",
"executionMode": "in_sandbox",
"status": "completed",
"result": "The test suite is green.",
"usage": {
"inputTokens": 1480,
"outputTokens": 322
},
"iterations": 4,
"threadId": "thr_abc123"
}
}
Thread APIs
curl "https://api.runtools.ai/v1/run/threads?agent=code-assistant" \
-H "X-API-Key: $RUNTOOLS_API_KEY"
const threads = await rt.agent.threads('code-assistant');
const detail = await rt.agent.getThread(threads[0].id, 'code-assistant');
await rt.agent.deleteThread(threads[0].id, 'code-assistant');
Legacy Per-Agent Endpoint
POST /v1/agents/{slug}/run still exists, but new code should prefer POST /v1/run because it has the same request shape used by the SDK and thread helpers.