List root agent items across turns for result verification and reconnect recovery.
Endpoint
GET /agents/sessions/{session_id}/items
Returns root agent items across turns. Subagent items are not mixed in. Returns 200 on success. The query does not start a model, resume execution, or create resources.
Path parameterssession_idstring (required)Session ID, for example sess_xxxQuery parameterslimitinteger (optional)Number of items per page, default 20, range 1-100order string (optional)Sort direction, asc or desc, default descafter string (optional)The last_id from the previous page; the cursor item is excluded | Request example |
Response fieldsList envelope:objectstringList object type, fixed as listdata array<Item>Items on this page; [] when emptyfirst_id string / nullFirst item ID on this page; null for an empty pagelast_id string / nullLast item ID on this page; null for an empty page; use it as afterhas_more booleanWhether the current scan direction has another page | Response example |
Item types
Every item has id, turn_id, and type. Business fields are at the top level.
type | Fields |
|---|---|
message | status (output status), role (user / assistant), phase (commentary / final_answer / null), and content (array of content parts) |
reasoning | status and summary (array of type=summary_text parts) |
function_call | status, call_id, name, and arguments (arbitrary JSON; can be omitted) |
function_call_output | status, call_id, output (content array or null; a string tool result is normalized to an array when read), and error (string / null) |
command_execution | status, command, cwd, duration_ms, exit_code, and output |
mcp_call | status, server_label, name, arguments, output, and error |
web_search_call | status and action (search, open_page, find_in_page, or other) |
agent_message | sender_agent_id, recipient_agent_id, and content |
create_subagent_call | status, agent_id, content, model, and reasoning_effort |
send_subagent_input_call | status, sender_agent_id, recipient_agent_id, and content |
resume_subagent_call | status, sender_agent_id, and recipient_agent_id |
wait_for_subagents_call | status, sender_agent_id, and recipient_agent_ids |
interrupt_subagent_call | status, sender_agent_id, and recipient_agent_id |
close_subagent_call | status, sender_agent_id, and recipient_agent_id |
type: input_text and output_text contain text; input_image contains image_url; encrypted_content is not display text.
Persisted items use final content. SSE item.added can show an in-progress item; an unfinished real-time item is not guaranteed to appear in the list. Lists can have a short delay, so recently created data may be briefly unavailable.
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Fix limit and order as described in the query parameters; use the last_id returned by the previous page as after |
404 | not_found_error / not_found_error | Use a session ID that exists and has not been deleted in the current workspace |
502 | server_error / agents_api_upstream_unavailable | Retry later. If it keeps failing, submit a ticket with the x-request-id from the response headers |