API ReferenceAgents
Create Agent Run
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",
"cost_usd": 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
}{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string",
"input": null,
"ctx": {}
}
]
}