Skip to Content
Levain LabsLevain Labs
API ReferenceAgents

Get Agent Queue

Show what an agent is doing and what is waiting behind it.

Show what an agent is doing and what is waiting behind it.

An agent with a persistent workspace, or on a self-hosted runtime in direct mode, runs one turn at a time; runs that arrive during a turn wait here. Each waiting run says what started it, what it waits for, and its place in line. Both lists are empty for an idle agent; queued is always empty for agents that never queue.

GET
/api/v1/agents/{agent_id}/queue

Authorization

HTTPBearer
AuthorizationBearer <token>

In: header

Path Parameters

agent_id*Agent Id

Header Parameters

X-API-Key?string|null

Response Body

application/json

application/json

curl -X GET "https://api.levainlabs.com/api/v1/agents/string/queue"
{
  "in_progress": [
    {
      "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
      },
      "runtime": {
        "id": "string",
        "name": "string",
        "mode": "string",
        "model_auth": "string"
      },
      "origin": {
        "kind": "slack",
        "provider": "string",
        "provider_display": "string",
        "sent_by": "string",
        "event_type": "string",
        "subject": "string"
      },
      "queue": {
        "waiting_for": "turn",
        "position": 0,
        "blocking_run_id": "string",
        "blocking_run": {
          "id": "string",
          "agent_id": "string",
          "agent_slug": "string",
          "status": "string",
          "finished_at": "string",
          "origin": {
            "kind": "slack",
            "provider": "string",
            "provider_display": "string",
            "sent_by": "string",
            "event_type": "string",
            "subject": "string"
          }
        },
        "runtime": {
          "id": "string",
          "name": "string",
          "status": "online",
          "runner_version": "string"
        },
        "required_runner_version": "string",
        "resumes_at": "string"
      },
      "replaced_by_run_id": "string",
      "handled_by_run_id": "string"
    }
  ],
  "queued": [
    {
      "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
      },
      "runtime": {
        "id": "string",
        "name": "string",
        "mode": "string",
        "model_auth": "string"
      },
      "origin": {
        "kind": "slack",
        "provider": "string",
        "provider_display": "string",
        "sent_by": "string",
        "event_type": "string",
        "subject": "string"
      },
      "queue": {
        "waiting_for": "turn",
        "position": 0,
        "blocking_run_id": "string",
        "blocking_run": {
          "id": "string",
          "agent_id": "string",
          "agent_slug": "string",
          "status": "string",
          "finished_at": "string",
          "origin": {
            "kind": "slack",
            "provider": "string",
            "provider_display": "string",
            "sent_by": "string",
            "event_type": "string",
            "subject": "string"
          }
        },
        "runtime": {
          "id": "string",
          "name": "string",
          "status": "online",
          "runner_version": "string"
        },
        "required_runner_version": "string",
        "resumes_at": "string"
      },
      "replaced_by_run_id": "string",
      "handled_by_run_id": "string"
    }
  ]
}