---
title: "Get session"
method: POST
path: "/agents/sessions/get"
tags: ["Agents"]
---

# Get session

`POST /agents/sessions/get`

Reads the state of a session started by POST /agents/execute: whether it is running, waiting in line, or finished, where it sits in its queue, and how much work that queue is holding. Cheap enough to poll while waiting for enqueued work to start.

## Request body

- object
  - `sessionId` string, required — The ID of the session, as returned by POST /agents/execute

## Response `200`

The session

- object
  - `sessionId` string, required — The ID of the session, as returned by POST /agents/execute
  - `agentId` string, required — The ID of the agent running the session
  - `status` 'Pending' | 'InProgress' | 'Completed' | 'Failed' | 'Paused' | 'WaitingInLine' | 'Sleeping', required — Lifecycle status of the session
  - `queuePositionInLine` integer, nullable, required — Place in the waiting line while the status is WaitingInLine (1 = next to run). Null once the session has started, and for sessions that never waited
  - `queue` object, nullable, required — The queue gating the session, if any
    - `queueId` string, required — The ID of the queue the session was enqueued onto
    - `name` string, required — Name of the queue
    - `status` 'active' | 'paused', required — Whether the queue dispatches work. A paused queue holds waiting threads until resumed.
    - `waitingCount` integer, required — How many of the queue’s sessions are waiting in line to start
    - `inProgressCount` integer, required — How many of the queue’s sessions are running right now
    - `oldestWaitingEnqueuedAt` string, nullable, required — When the session that has been waiting longest was enqueued, or null when nothing is waiting
  - `createdAt` string, required — When the session was created, as an ISO 8601 timestamp
  - `statusLastUpdatedAt` string, required — When the session last changed status, as an ISO 8601 timestamp

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `404` — The session does not exist. Code: AGENT_SESSION_NOT_FOUND.
- `500` — Internal server error

---

[API](https://skmtc.dev/kaizenautomation/apis/kaizen-api.md) · [All operations](https://skmtc.dev/kaizenautomation/apis/kaizen-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kaizenautomation/kaizen-api/revisions/4aa3664ceff2/schema)
