Skip to main content
Every stored event carries id, seq, type, created_at, and processed_at. seq increases monotonically with each event; use it as your stream cursor. Text content is an array of text blocks: [{ "type": "text", "text": "..." }].

Input events

You send these events, and they also appear in the Session’s event history. Receipts and history preserve the submitted text blocks for user messages and custom tool results. The model reads the blocks joined with newlines. A system.message affects turns that start after it in the event history. Each turn keeps its starting context through tool pauses and continuations. In a batch that starts a turn, send the system message before the user message to include its context in that turn.

Agent events

On tool use events, id equals tool_use_id. rejected is unavailable, invalid_arguments, or blocked. truncated: true marks shortened text or tool inputs. MCP results use mcp_tool_use_id to refer to the tool-use event. The result still carries tool_use_id with the same value for existing clients. When reading sessions from an older server, use tool_use_id if mcp_tool_use_id is absent.

Session and span events

span.model_request_end.start_event_id points to the corresponding start event’s id, including when the start predates the page or stream cursor. The model_request_start_id field still carries the request key on both events for clients that join on it. cancelled_event_ids lists tool calls that were still waiting when the turn or Session ended; they can no longer be answered.

Stop reasons

A partial tool answer is followed by another requires_action event with the remaining call IDs. When the last answer is accepted, the turn resumes. An applied interrupt keeps its user.interrupt event before the stop. An output cap marks the reply with truncated: true and ends the turn. A queued message starts the next turn. A refusal or budget stop retains queued messages until a new turn starts.

session.error

The session.status_idle event includes stop_details. It is null when Checkfu has no details to publish.

Send events

POST /v1/sessions/{session_id}/events with { "events": [...] } returns one receipt per event in data. A user.message receipt includes turn and queued. To retry safely, give each event an id (up to 128 characters) or pass an Idempotency-Key; resending returns the original receipts. If a later event in a batch fails (index > 0), the error body includes accepted (receipts for earlier events) and failed_index. If the server could not confirm whether an event was recorded, you get unconfirmed_index (including 0, plus accepted when earlier events succeeded); resend with the same IDs. User messages preserve the order and boundaries of their content blocks in receipts, history, and streams. Keep the same blocks when you retry a message with the same ID or key.

List events

Use limit (1 to 100, default 50), order (asc or desc by event sequence), page (previous next_page), and types (repeatable, also accepted as types[]). Filter by processing time with created_at[gt], created_at[gte], created_at[lt], or created_at[lte]. Give an ISO 8601 timestamp for each bound. The filter compares the published processed_at timestamp and excludes events that are still unprocessed. A filtered page can be short or empty. Follow next_page until it is null to finish scanning.

Stream events

  • after or the Last-Event-ID header sends only events with a greater seq. If both are set, Last-Event-ID wins.
  • The stream replays stored events first, then follows live events. It sends : keepalive every 15 seconds and closes each connection after about 4 minutes.
  • It ends after session.archived, and returns 204 if the Session is already archived and you have read every event.
  • Passing event_deltas[]=agent.message (or agent.thinking) enables live previews.
See Resume a stream.

Live previews

Previews have no seq and do not advance the cursor. Thinking previews send only event_start. Append each delta to block index. A missing index means block zero. Replace the preview when the stored agent.message with the same id arrives. The SDK’s accumulateSessionEvent also clears unfinished previews when a request fails or the turn stops. It marks a committed reply with settled: true.