Events
Read canonical session history and observe live SSE with an event cursor.
Read history and subscribe to live events:
const page = await session.history();
for (const item of page.items) {
console.log(item.type, item.payload);
}
for await (const event of session.observe({ cursor: page.cursor ?? undefined })) {
console.log(event.type, event.payload);
}Runtime stores that canonical history with the session. Studio's Events
inspector reads GET /v1/sessions/:id/items and live
GET /v1/sessions/:id/events. The SDK exposes the same records.
Each record includes eventId, sessionId, turnId, cursor, createdAt,
type, and payload. The cursor is an opaque position, not an array index.
Pass it to history({ cursor }) or observe({ cursor }) to continue.
history({ agent }) keeps events whose payload.agent.delegationId or
payload.agent.path matches — one child invocation, or every concurrent child
that shares a path such as support/researcher. Last-Event-ID is accepted
on the SSE route. observe skips SSE frames named heartbeat or ready.
session.inspect() returns status, waits, outstanding actions, and
uncertainty. It is a snapshot, not a live stream.
Canonical Runtime types include command.*, turn.*, action.*,
effect.uncertain, sandbox.state, sandbox.exec, delegation.started, and
delegation.completed. The full table is in
Reference: events.
When an agent is used as a tool, Runtime emits delegation.started (payload
includes agent and task) and delegation.completed (agent, status,
outcome). Action events for child work carry payload.agent. See
Subagents.
What you can rely on
- History is the host-owned record. Studio restores it for the selected session.
- Live SSE is the same canonical event stream, not a second log format.
- Keep keys, cookies, headers, and raw provider payloads out of events and manifests.
Studio shows completed assistant text and tool inputs/results. Token streaming is not part of this release.
Engine onEvent observations (ExecutionEvent from @nylorun/harness) are a
separate in-process surface for custom hosts. They are not the Runtime history
API.