id. Optional max_steps and max_time_s caps bound how long it runs before the agent is asked for a final answer.
id; from there you poll its progress and read the answer exactly as in the Quickstart.
The session object carries progress and usage, not the result. The agent’s final answer comes from
GET /sessions/{id}/changes (answer) or the answer_event in the event stream. For live updates, long-poll changes rather than polling status.What’s a Session
| Field | Description |
|---|---|
id | The session’s UUID, the handle for every follow-up call. |
request | Echoes what you submitted, with agent resolved to its full spec even if you passed a catalog id. |
status | Carries the live status, step count, per-model token usage (usage_per_model), any error, and subagent_session_ids. See Session status for the breakdown. |
created_at / started_at / finished_at | Track the run’s timeline; the latter two are null until they happen. |
Lifecycle
The agent perceives and acts in its environment step by step, moving through the same state machine regardless of which agent runs it. While it runs you can steer with messages or lifecycle controls.Prefer a UI? Watch any session live, or replay it afterward, in the H Platform.
| Status | Meaning | Terminal |
|---|---|---|
pending | Session created, agent is launching. | No |
running | Agent is actively working on the task. | No |
paused | Manually paused via the API. State is preserved. | No |
idle | Interactive agent finished a task and is waiting for your next message. | No |
completed | Agent finished the task successfully. | Yes |
timed_out | Agent exceeded the maximum allowed time. | Yes |
interrupted | Session was canceled via DELETE. | Yes |
failed | An unrecoverable error occurred. | Yes |
Structured output
By default the agent’s answer is free-form text. Pass ananswer_format (a JSON Schema) when you create the session and the agent returns data that conforms to it: the answer you read from changes is then a JSON object instead of a string.
Endpoints
| Method | Path | Description |
|---|---|---|
POST | /api/v2/sessions | Create a session |
GET | /api/v2/sessions | List sessions |
GET | /api/v2/sessions/{id} | Retrieve a session |
GET | /api/v2/sessions/{id}/status | Get session status |
DELETE | /api/v2/sessions/{id} | Cancel a session |
POST | /api/v2/sessions/{id}/messages | Send a message |
POST | /api/v2/sessions/{id}/pause | Pause a session |
POST | /api/v2/sessions/{id}/resume | Resume a session |
POST | /api/v2/sessions/{id}/force_answer | Force final answer |
GET | /api/v2/sessions/{id}/changes | Long-poll for changes |
GET | /api/v2/sessions/{id}/events | List events |
GET | /api/v2/sessions/quota | Get quota |
POST | /api/v2/sessions/{id}/feedback | Submit session feedback |
POST / DELETE | /api/v2/sessions/{id}/share | Share / unshare a session |
GET | /api/v2/sessions/{id}/resources/{bucket}/{key} | Get a session resource |