Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Streaming events

agent.session.environment.ready

Emitted when a hosted session environment is ready to connect.

environment: AgentSessionEnvironmentState { id, error, status, type }

The current environment state.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.environment.ready"

The type of the object. Always agent.session.environment.ready.

agent.output.command_execution_output.delta

Emitted when command execution produces an output delta.

delta: string

The output text that was appended.

minLength0
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the command execution item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.output.command_execution_output.delta"

The type of the object. Always agent.output.command_execution_output.delta.

agent.session.created

Emitted when a session is created.

event_id: string

The unique ID of the event.

minLength0
session: AgentSession { id, agent, created_at, 9 more }

The session that was created.

type: "agent.session.created"

The type of the object. Always agent.session.created.

agent.session.turn.created

Emitted when a turn is created.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn: Turn { id, agent_id, completed_at, 8 more }

The turn at the time it was created.

turn_id: string

The ID of the turn associated with the event.

minLength0
type: "agent.session.turn.created"

The type of the object. Always agent.session.turn.created.

agent.session.turn.in_progress

Emitted when a turn starts running.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn: Turn { id, agent_id, completed_at, 8 more }

The turn at the time it started running.

turn_id: string

The ID of the turn associated with the event.

minLength0
type: "agent.session.turn.in_progress"

The type of the object. Always agent.session.turn.in_progress.

agent.session.turn.completed

Emitted when a turn completes.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn: Turn { id, agent_id, completed_at, 8 more }

The completed turn.

turn_id: string

The ID of the turn associated with the event.

minLength0
type: "agent.session.turn.completed"

The type of the object. Always agent.session.turn.completed.

usage: TokenUsage { input_tokens, input_tokens_details, output_tokens, 2 more } or null

Recorded token usage for a session or turn. Usage is best effort and may change.

agent.session.turn.failed

Emitted when a turn fails.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn: Turn { id, agent_id, completed_at, 8 more }

The failed turn.

turn_id: string

The ID of the turn associated with the event.

minLength0
type: "agent.session.turn.failed"

The type of the object. Always agent.session.turn.failed.

usage: TokenUsage { input_tokens, input_tokens_details, output_tokens, 2 more } or null

Recorded token usage for a session or turn. Usage is best effort and may change.

agent.session.turn.cancelled

Emitted when a turn is cancelled.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn: Turn { id, agent_id, completed_at, 8 more }

The cancelled turn.

turn_id: string

The ID of the turn associated with the event.

minLength0
type: "agent.session.turn.cancelled"

The type of the object. Always agent.session.turn.cancelled.

usage: TokenUsage { input_tokens, input_tokens_details, output_tokens, 2 more } or null

Recorded token usage for a session or turn. Usage is best effort and may change.

agent.session.turn.item.added

Emitted when an item is added to a turn.

event_id: string

The unique ID of the event.

minLength0

The item that was added.

output_index: number or null

The index of the item in the turn output, when the item is agent output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.item.added"

The type of the object. Always agent.session.turn.item.added.

agent.session.idle

Emitted when a session becomes idle.

event_id: string

The unique ID of the event.

minLength0
session: AgentSession { id, agent, created_at, 9 more }

The session that became idle.

type: "agent.session.idle"

The type of the object. Always agent.session.idle.

agent.session.in_progress

Emitted when a session starts processing a turn.

event_id: string

The unique ID of the event.

minLength0
session: AgentSession { id, agent, created_at, 9 more }

The session that started processing.

type: "agent.session.in_progress"

The type of the object. Always agent.session.in_progress.

agent.session.requires_action

Emitted when a session is waiting for one or more required actions.

event_id: string

The unique ID of the event.

minLength0
session: AgentSession { id, agent, created_at, 9 more }

The session and its current required actions.

type: "agent.session.requires_action"

The type of the object. Always agent.session.requires_action.

agent.session.failed

Emitted when a session fails.

event_id: string

The unique ID of the event.

minLength0
session: AgentSession { id, agent, created_at, 9 more }

The failed session.

type: "agent.session.failed"

The type of the object. Always agent.session.failed.

agent.session.environment.pending

Emitted while a session environment is being prepared.

environment: AgentSessionEnvironmentState { id, error, status, type }

The current environment state.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.environment.pending"

The type of the object. Always agent.session.environment.pending.

agent.session.environment.connected

Emitted when a session environment connects.

environment: AgentSessionEnvironmentState { id, error, status, type }

The current environment state.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.environment.connected"

The type of the object. Always agent.session.environment.connected.

agent.session.environment.disconnected

Emitted when a session environment disconnects.

environment: AgentSessionEnvironmentState { id, error, status, type }

The current environment state.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.environment.disconnected"

The type of the object. Always agent.session.environment.disconnected.

agent.session.environment.failed

Emitted when a session environment fails.

environment: AgentSessionEnvironmentState { id, error, status, type }

The current environment state.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.environment.failed"

The type of the object. Always agent.session.environment.failed.

agent.session.subagent.created

Emitted when a subagent is created.

event_id: string

The unique ID of the event.

minLength0
subagent: Subagent { id, closed_at, instructions, 6 more }

The subagent that was created.

type: "agent.session.subagent.created"

The type of the object. Always agent.session.subagent.created.

agent.session.subagent.active

Emitted when a closed subagent successfully resumes.

event_id: string

The unique ID of the event.

minLength0
subagent: Subagent { id, closed_at, instructions, 6 more }

The subagent that resumed.

type: "agent.session.subagent.active"

The type of the object. Always agent.session.subagent.active.

agent.session.subagent.closed

Emitted when a subagent is closed.

event_id: string

The unique ID of the event.

minLength0
subagent: Subagent { id, closed_at, instructions, 6 more }

The subagent that was closed.

type: "agent.session.subagent.closed"

The type of the object. Always agent.session.subagent.closed.

agent.session.turn.item.done

Emitted when an output item is complete.

event_id: string

The unique ID of the event.

minLength0

The completed output item.

output_index: number

The index of the output item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.item.done"

The type of the object. Always agent.session.turn.item.done.

agent.session.turn.content_part.added

Emitted when an output text content part is added.

content_index: number

The index of the content part in the message.

formatint64
minimum0
maximum4294967295
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the message item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
part: OutputText { text, type }

The initial content part.

session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.content_part.added"

The type of the object. Always agent.session.turn.content_part.added.

agent.session.turn.content_part.done

Emitted when an output content part is complete.

content_index: number

The index of the content part in the message.

formatint64
minimum0
maximum4294967295
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the message item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
part: OutputText { text, type }

The completed content part.

session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.content_part.done"

The type of the object. Always agent.session.turn.content_part.done.

agent.session.turn.output_text.delta

Emitted when text is appended to an output text content part.

content_index: number

The index of the content part in the message.

formatint64
minimum0
maximum4294967295
delta: string

The text that was appended.

minLength0
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the message item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.output_text.delta"

The type of the object. Always agent.session.turn.output_text.delta.

agent.session.turn.output_text.done

Emitted when an output text content part is complete.

content_index: number

The index of the content part in the message.

formatint64
minimum0
maximum4294967295
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the message item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
text: string

The complete output text.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.output_text.done"

The type of the object. Always agent.session.turn.output_text.done.

agent.session.turn.reasoning_summary_part.added

Emitted when a reasoning summary content part is added.

event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the reasoning item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
part: SummaryText { text, type }

The initial summary part.

session_id: string

The ID of the session associated with the event.

minLength0
summary_index: number

The index of the summary content part.

formatint64
minimum0
maximum4294967295
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.reasoning_summary_part.added"

The type of the object. Always agent.session.turn.reasoning_summary_part.added.

agent.session.turn.reasoning_summary_part.done

Emitted when a reasoning summary part is complete.

event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the reasoning item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
part: SummaryText { text, type }

The completed summary part.

session_id: string

The ID of the session associated with the event.

minLength0
status: "incomplete" or null

Present as incomplete when summary generation was interrupted.

summary_index: number

The index of the summary part.

formatint64
minimum0
maximum4294967295
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.reasoning_summary_part.done"

The type of the object. Always agent.session.turn.reasoning_summary_part.done.

agent.session.turn.reasoning_summary_text.delta

Emitted when text is appended to a reasoning summary.

delta: string

The summary text that was appended.

minLength0
event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the reasoning item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
summary_index: number

The index of the summary content part.

formatint64
minimum0
maximum4294967295
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.reasoning_summary_text.delta"

The type of the object. Always agent.session.turn.reasoning_summary_text.delta.

agent.session.turn.reasoning_summary_text.done

Emitted when a reasoning summary content part is complete.

event_id: string

The unique ID of the event.

minLength0
item_id: string

The ID of the reasoning item.

minLength0
output_index: number

The index of the item in the turn output.

formatint64
minimum0
maximum4294967295
session_id: string

The ID of the session associated with the event.

minLength0
summary_index: number

The index of the summary content part.

formatint64
minimum0
maximum4294967295
text: string

The complete reasoning summary text.

minLength0
turn_id: string or null

The ID of the turn associated with the event, when applicable.

minLength0
type: "agent.session.turn.reasoning_summary_text.done"

The type of the object. Always agent.session.turn.reasoning_summary_text.done.

error

Emitted when a turn or session fails.

error: SessionError { code, message, param, type }

The error that occurred.

event_id: string

The unique ID of the event.

minLength0
session_id: string

The ID of the session associated with the event.

minLength0
type: "error"

The type of the object. Always error.