The session event stream is a Server-Sent Events (SSE) endpoint that delivers real-time agent output as it is produced. Unlike the REST snapshot endpoint, the stream does not replay history — it starts from the moment you connect and delivers every event that occurs while your connection is open. On reconnect, fetch the session snapshot (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/omnigent-ai/omnigent/llms.txt
Use this file to discover all available pages before exploring further.
GET /v1/sessions/{id}) to reconcile state, then re-open the stream.
The Python SDK’s
SessionsNamespace.stream() handles the low-level SSE framing automatically. It does not auto-reconnect — reconnect logic lives at the application layer so you can control the snapshot-and-reconcile step.Subscribing with curl
-N flag disables curl’s output buffering so you see events as they arrive. Each SSE frame has the shape:
idle (boolean, default false) — set to true to signal that your tab is backgrounded. Other viewers see you as idle in presence events.
Event Types
Every SSE frame carries atype discriminator field. The full union is the ServerStreamEvent discriminated type in the OpenAPI schema.
Session Lifecycle Events
Session lifecycle status transition. Emitted at every transition between
"idle", "running", "waiting" (parent turn parked on async sub-agents), and "failed".Key fields: conversation_id, status, response_id (for terminal-backed sessions), error (when status == "failed").Idle-stream keepalive emitted on a fixed cadence when no turn is in flight. Keeps intermediate proxies from treating the stream as stale.Key fields:
server_time (ISO 8601 UTC timestamp).User-triggered cancel reached the loop. Co-emitted with
response.incomplete when the session is interrupted via POST /v1/sessions/{id}/events with type: "interrupt".Key fields: data.requested_at, data.response_id.A child (sub-agent) session was spawned from this session. Emitted on the parent session’s stream when a sub-agent is launched.Key fields:
conversation_id (parent), child_session_id, agent_id, parent_session_id.A child session’s status changed. Carries a partial
ChildSessionSummary that should be merged over the cached child row.Key fields: conversation_id (parent), child_session_id, child (partial summary dict).The session’s bound agent was changed in place via
POST .../switch-agent. Clients should re-fetch the session snapshot to update their cached state.Key fields: conversation_id, agent_id, agent_name.The active LLM model changed (e.g. via a
/model command in a terminal-backed session).Key fields: conversation_id, model.Token-usage update. Carries context-window metrics and optional per-model breakdown.Key fields:
conversation_id, context_tokens, context_window, total_cost_usd, usage_by_model.The session’s viewer list changed. Full replacement — not a delta. Clients should replace their presence state wholesale.Key fields:
conversation_id, viewers (array of {user_id, joined_at, idle}).Runner-owned skills have resolved. Clients should re-fetch the session snapshot to populate their skill/slash-command menu.Key field:
conversation_id.Todo-list update from a Claude Code terminal-backed session.Key fields:
conversation_id, todos (array of {content, status, activeForm}).Managed-sandbox provisioning progress for
host_type="managed" sessions.Key fields: conversation_id, stage ("provisioning", "cloning", "starting", "connecting", "ready", "failed"), error.Terminal spin-up status.
pending: true while the terminal is being created; pending: false once it lands.Key fields: conversation_id, pending.A terminal pane produced output (transient activity pulse).Key fields:
session_id, terminal_id.A session resource (terminal, file, environment) was created.Key fields:
resource (a SessionResourceObject dict).A session resource was deleted.Key fields:
resource_id, resource_type, session_id.The session’s changed-files list may have changed. Clients should refetch
GET .../resources/environments/{env_id}/changes.Key fields: session_id, environment_id.Response (Turn) Events
Always the first event of a new turn. Carries the freshly allocated
ResponseObject with status: "queued" or "in_progress".Emitted between
response.created and response.in_progress for background tasks.The turn transitioned to
"in_progress".Incremental assistant text token. Concatenate
delta fields in arrival order to reconstruct the full message.Key fields: delta (text fragment), message_id (for terminal-observed streaming), index, final.A reasoning block began (providers that surface chain-of-thought). Clients can render a “thinking…” indicator.
Incremental full chain-of-thought token.Key fields:
delta.Incremental reasoning-summary token (when
reasoning.summary is configured).Key fields: delta.A conversation output item completed during the turn. Item type varies:
message, function_call, function_call_output, reasoning, compaction.Key fields: item (heterogeneous dict — shape depends on item.type).A streamed file output completed materializing.Key fields:
file_id, filename, content_type.Terminal event — turn finished successfully. Carries the final
ResponseObject with status: "completed".Terminal event — turn ended with an error.
response.error field describes the failure.Terminal event — turn stopped early (e.g. hit the iteration cap).
response.incomplete_details.reason gives the reason.Terminal event — turn was cancelled.
Non-recoverable error during the turn (LLM error, execution timeout, tool failure).Key fields:
source ("llm", "execution", "tool"), tool_name, error.code, error.message.A retryable failure was caught and a retry is scheduled.Key fields:
source, tool_name, attempt, max_attempts, delay_seconds, error.Per-turn keepalive emitted every ~15 seconds while a response is producing output.Key fields:
server_time, last_event_seq.Turn Events
The runner started a new turn. Key fields:
session_id.The turn finished successfully with no pending work. Key fields:
session_id.The turn failed. Key fields:
session_id, error.The turn was interrupted. Key fields:
session_id.Compaction Events
Conversation history compaction is running. Clients can show a “summarizing history…” spinner.
Compaction finished. Key fields:
total_tokens (post-compaction context size estimate).Compaction failed; history was not modified. Dismiss any spinner.
Elicitation Events
The agent paused and is requesting a decision from the user (e.g. approve a tool call). The consumer must reply via
POST /v1/sessions/{id}/elicitations/{elicitation_id}/resolve.Key fields: elicitation_id, params.message, params.mode ("form" or "url"), params.phase, params.policy_name, params.content_preview, params.requestedSchema.A previously outstanding elicitation was cleared (timed out, turn cancelled, or resolved elsewhere).Key field:
elicitation_id.Server-to-client notification that an async client-tool task was cancelled mid-flight (via direct cancel or parent-cancel propagation). The SDK should cancel the matching local task.Key fields:
task_id (the server-issued client-tool task id), call_id (the synthesized function-call id, or null on legacy emissions).Python SDK Streaming
Subscribe to a session’s event stream usingSessionsNamespace.stream():
event is a typed Pydantic model from the ServerStreamEvent discriminated union — e.g. SessionStatusEvent, OutputTextDeltaEvent, CompletedEvent.
For a higher-level text-streaming API, use a Session object (the /v1/responses path):
Elicitations
When a policy triggers an approval request, the agent pauses and emits aresponse.elicitation_request event. The consumer must resolve the elicitation before the agent proceeds:
action field follows the MCP ElicitResult semantics:
action | Meaning |
|---|---|
"accept" | Approved — the agent proceeds |
"decline" | Explicit refusal |
"cancel" | Dismissed without an explicit choice (also the server-synthesized verdict on timeout) |