API ReferenceAgents
Create Agent Run
Dispatch a run against an agent's latest active version.
Dispatch a run against an agent's latest active version.
For the version-pinned variant pass an explicit version via
POST /agents/{agent_id}/versions/{version}/runs. Returns the freshly-created
PENDING run; poll GET /api/v1/runs/{run_id} for status transitions and
GET /api/v1/sessions/{session_id}/events for the streaming event timeline.
Authorization
HTTPBearer AuthorizationBearer <token>
In: header
Path Parameters
agent_id*Agent Id
Header Parameters
X-API-Key?string|null
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://api.levainlabs.com/api/v1/agents/string/runs" \ -H "Content-Type: application/json" \ -d '{}'{
"id": "string",
"status": "string",
"paused": false,
"cost_usd": 0,
"billed_usd": 0,
"sandbox_billed_usd": 0,
"sandbox_seconds": 0,
"tokens_in": 0,
"tokens_out": 0,
"started_at": "string",
"finished_at": "string",
"error": "string",
"agent_id": "string",
"agent_version_id": "string",
"agent_version": 0,
"parent_run_id": "string",
"session_id": "string",
"user_prompt": "string",
"created_at": "string",
"kind": "agent",
"artifact_count": 0,
"artifact_count_truncated": false,
"latency": {
"queue_wait_ms": 0,
"sandbox": "warm",
"sandbox_ms": 0,
"code_fetch_ms": 0,
"code_deliver_ms": 0,
"first_node_ms": 0,
"total_ms": 0
}
}