Skip to main content

Session object

Returned by create, get, list, update, and archive endpoints. Session responses no longer include legacy fields such as agent_id, turn_status, memory_store_ids, or usage.

Agent reference

agent in create requests can be either a string Agent ID or this object:

Session embedded agent

The agent returned inside a Session object is the Agent snapshot pinned to the Session, but several Agent fields are stripped before they are exposed:
  • created_at, updated_at — never included on the embedded Agent.
  • archived, archived_at — never included; the Session preserves access to the snapshot regardless of the source Agent’s archive state.
  • metadata — Agent-level metadata is stripped; only Session-level metadata is exposed.
  • instructions — replaced by system.
For a coordinator multi-agent setup, agent.multiagent.agents[] is hydrated server-side from stub {type, id, version} references into full Agent definitions (see Multiagent roster element). Inside a Session Thread object, the agent field additionally drops the multiagent block — coordinator threads only carry the per-agent snapshot.

agent.model.effective_context_window

Sessions return an additional response-only effective_context_window (int64, in tokens) inside agent.model. It is the runtime-resolved context window the Session will use for this Agent (after applying environment-level overrides). Absent or non-positive values are omitted; clients should treat the field as informational.

Session resource

resources[] is a union distinguished by type.

File resource

GitHub repository resource

Memory Store resource

Memory Store resources do not include id, created_at, or updated_at fields.

Session stats

Multiagent roster element

When the embedded Agent declares multiagent.type = "coordinator", every entry inside agent.multiagent.agents[] returned by Session endpoints is hydrated from the original stub references into a full Agent definition (subject to the same field stripping as the Session embedded agent, and additionally without its own multiagent field). Stub references that fail to resolve (for example, the referenced Agent version no longer exists) are returned unchanged.

Event object

Events returned by send, list, and stream endpoints are event-specific JSON objects. Public event responses expose only the documented public fields for each event type. Depending on type, an event may also include fields such as content, input, name, tool_use_id, mcp_tool_use_id, custom_tool_use_id, result, deny_message, rubric, outcome_id, session_thread_id, stop_reason, error, or usage.

Client event request types

POST /api/v1/cloud/sessions/{session_id}/events accepts exactly these client-sent event types:

Public event types

List and stream endpoints can expose these event types: user.message, user.interrupt, user.tool_confirmation, user.custom_tool_result, user.define_outcome, user.tool_result, system.message, agent.custom_tool_use, agent.mcp_tool_result, agent.mcp_tool_use, agent.message, agent.thinking, agent.thread_context_compacted, agent.thread_message_received, agent.thread_message_sent, agent.tool_result, agent.tool_use, session.deleted, session.error, session.status_idle, session.status_rescheduled, session.status_running, session.status_terminated, session.thread_created, session.thread_status_idle, session.thread_status_rescheduled, session.thread_status_running, session.thread_status_terminated, session.updated, span.model_request_start, span.model_request_end, span.outcome_evaluation_start, span.outcome_evaluation_ongoing, and span.outcome_evaluation_end.

Event delta stream frames

A buffered event is a complete public Event object emitted after generation finishes and recorded in Session event history. It is the authoritative result. event_start and event_delta are stream-only SSE payloads used for incremental output. They are not public Event objects and do not appear in event list/history responses. Their JSON payloads have no top-level id or processed_at; the SSE id: field carries the ID of the event being streamed and can be used with Last-Event-ID.

Event start frame

An event_start frame identifies the public event whose incremental output has begun. The event object has these fields: An agent.message start is followed by text event_delta frames. An agent.thinking start is start-only: no delta follows, and the buffered agent.thinking event with the same ID marks the end of that thinking phase when one is emitted.

Event delta frame

An event_delta frame appends text to an incrementally streamed agent.message. The delta object has these fields:

Model request span events

span.model_request_start marks the beginning of one model request. span.model_request_end marks completion of that model request. Model request span responses do not expose model usage or internal timing metadata.

Session Thread object

In managed-agent scenarios, each thread within a Session is represented by this structure. Thread responses no longer include legacy fields such as agent_id, agent_version, name, role, stop_reason, created_by_tool_use_id, or usage.