opencomputer sessions tail --json prints, what useAgent reduces to messages,
what the dashboard’s session view shows, and what
GET /sessions/<id>/events returns.
Shape and ordering
Each event is one JSON object:seq is the cursor. A read with after=<seq> returns events with a greater
seq, in ascending order, up to 500 at a time; repeat from the last seq
you received until a page is empty, and keep polling from there to follow a
live session. Because the log is durable and seq only grows, a consumer
that stops can resume from its cursor without missing anything, and a page
that overlaps one already read is harmless: apply events whose seq is
greater than what you have applied. The React hook and the CLI work this
way.
Events at or below the cursor never change. New types can appear; treat an
unknown type as informational and keep reading.
Event types
Session lifecycle
Turns
Public failures
A failure’sdata is a stable code, a fixed message for that code, and
at most one parameter. The runtime’s own error text is never sent; a failure
no rule recognizes is agent_failed.
Messages
Tools
The exact fields come from the runtime’s tool record; read them as optional
and key a tool call on
callId when it is present. The memory tools
(memory_save, memory_read, memory_list) appear here like any other
tool; the save itself is reported separately.
Memory
Delivery is best-effort. A save commits independently of the event: a
runtime that loses its connection can commit without ever reporting it, and
the same event can be reported once or twice after a reconnect. Treat the
event as a hint to re-read the document, and also re-read when attaching,
reconnecting and completing work. See
Document memory.
Model and usage
Outbound requests
Runtime
Agent renders
One turn can carry several renders, one per model step. The debug inspector
in the playground shows the same data.
Reading the log
From the CLI, with one NDJSON record per event:useAgent, which turns message.received,
message.delta and message.completed into messages, turn.* and
session.* into isRunning and ended, and memory.saved into
memorySaves; every event, these included, also reaches onEvent.