event is the product-event kind, such as
run.state_changed or tool_call.requested. Its SSE id is an opaque cursor
for the committed project position; send it back unchanged rather than
constructing one. Its JSON body has this shape:
Connection lifecycle
- Opening: the server writes a
: connectedcomment line as soon as the stream opens, so proxies commit the response before the first event exists. The HTTP response also includesX-OAO-Event-Cursorwith the starting opaque cursor for that stream. - Starting position: without
Last-Event-IDor?cursor=…,from=beginning(the default) replays from the start of the project’s event log, andfrom=nowstarts at the project’s current committed head without replaying older events. Any otherfromvalue returns400 bad_request. WhenLast-Event-IDorcursoris also supplied, it takes precedence overfrom, so a client that reconnects on a?from=nowURL resumes cleanly from its last cursor. Live UIs (including the OAO Console) should connect withfrom=nowwhen they have no saved cursor and persistX-OAO-Event-Cursorso quiet reconnects do not skip events. - Keepalive: after 10 seconds without other output, the server writes a
: keepalivecomment line. Standards-compliant SSE parsers ignore lines that start with:. A custom parser must skip them and never treat them as events. - Normal close: a healthy stream closes after about 25 seconds. Reconnect
with
Last-Event-ID; the close is not data loss. - Backlog: after a reconnect, the server sends missed events in pages of 200 without pausing between full pages.
- One page:
?once=truereturns a single page of up to 200 events with no comment lines and closes immediately.
Cache-Control: no-store, no-transform and
X-Accel-Buffering: no. If OAO runs behind your own reverse proxy or load
balancer, disable response buffering and compression for text/event-stream,
and allow at least 15 seconds between reads.
Resume correctly
- Persist the last event ID only after your application has applied that event successfully.
- Reconnect with
Last-Event-IDafter a network error or process restart. - Treat duplicate events as normal and deduplicate by event
idor by(aggregateType, aggregateId, aggregateSequence). - Refresh the affected resource with a normal API read when your application does not understand a new event kind.
LISTEN/NOTIFY is only a
latency optimization inside OAO, so missed notifications do not create gaps.
Each API process shares one dedicated LISTEN connection across all of its open
streams and wakes only the streams of the project that committed the event. If
that connection drops, streams keep polling committed events every second while
the listener reconnects.
Model usage events
model.invocation_completed and model.invocation_failed payloads include
inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, and
costMicrounits, plus OAO’s normalized finishReason. The cost uses the model
preset’s price, or OAO’s built-in list price, and is zero when neither knows the
model. Cache reads represent
prompt tokens reused from the provider cache; cache writes represent prompt
tokens newly stored there. A provider that does not report cache usage
contributes zero for those fields.
When a model call fails because of a provider finish condition or a context
output-budget overflow, the failed event also includes the provider’s exact
bounded providerFinishReason when it is available, plus a safe
errorExplanation describing why OAO classified the response as failed (for
example providerFinishReason: "content_filter" or a context-compaction retry
when a conversation leaves fewer than 2,000 output tokens or stops on length
with no text or tool call). These payloads never include prompt or response
content, raw provider error messages, or credentials.
When a run settles as failed, the terminal run.state_changed event can carry
a bounded code in publicPayload—such as empty_reply when the model
completed without producing any assistant text (with no committed text and no
normal tool-only completion, or after a final length stop), or a pre-dispatch
code such as model_preset_unavailable, skill_package_unavailable, or
run_file_storage_unavailable.
Prompt suggestion events
An agent version with prompt suggestions appendsrun.suggestion_created when a run of that agent completes with a reply that
ends in a suggestion for the user’s next message:
aggregateId is the run. The event carries no text: read suggestion from
GET /runs/{runId} or GET /sessions/{sessionId}. It is committed in one
transaction with the reply and the settlement, directly after the final
assistant message.created event and before the run.state_changed event
with state: "completed", so the suggestion is already on the run when either
of those events arrives. It is absent when the run has no suggestion. A
suggestion is void once its session has a newer run, so ignore the event
unless its run is still the session’s latest. Because the kind is in the
run. family, a webhook subscribed to run.* receives it.
Harness Operation events
The runtime emitsharness.operation_started,
harness.operation_completed, harness.operation_failed, and the applicable
cancellation or timeout event for focused scratch-loop work. It also emits one
harness.operation_step event for each completed inner model or tool step. Safe
payloads can
include operationKey, toolCallId, taskCharacters, timeoutMs,
durationMs, and resultValidated. Step payloads use harnessToolCallId,
stepKind, stepId, stepIndex, status, duration, bounded token counts, and a
safe summary. Model-step summaries are derived only from bounded tool names—for
example, Requested activate_skill. or Returned the structured result for validation. Tool steps can include a safe tool label or path summary.
These events are correlated to the aggregate run and tool call. They never
contain the detailed task, scratch conversation, structured result, Skill
instructions/resources, tool payloads, authorization material, or raw shared
documents. The authorized console groups the start and terminal lifecycle
events by toolCallId into one Harness transcript row. Opening that row shows a
details modal with safe, sequential inner-turn metadata. New events carry the
owning Harness tool-call ID, so concurrent scratch loops are attributed exactly
instead of by timing. Lifecycle windows that overlap are shown as one parallel
group with a shared colored rail and count in the console. Legacy activity that
does not contain explicit correlation is folded only when its timing identifies
one unambiguous invocation; ambiguous legacy activity remains in the parent
timeline and the affected Harness modals are marked as partial.
Filter in the client
The server feed is project-wide. A session UI normally stores its cursor, then filters frames whoseaggregateId equals a known run, thread, tool call,
approval, or sandbox ID. On relevant events, re-fetch
GET /sessions/{sessionId} to obtain the current transcript and debug view.
An assistant message.created event can arrive before the run settles: when a
tool call pauses for approval, the explanation the agent wrote ahead of it is
committed first. See
Explanation before an approval.
An agent version with publishTextBeforeToolCalls commits the text of every
model turn that calls tools this way, before the turn’s tool call events; see
Publish text before tool
calls.
Event bodies contain public state and identifiers, not raw model reasoning,
credentials, authorization headers, unredacted tool payloads, or attached file
bytes. A user
message.created event may include only the safe fileCount;
re-fetch the session for filename, content type, size, and SHA-256 metadata.Delegation events
Payloads contain only delegate/version/session/run identifiers, ordinal,
state, and bounded status metadata. They never contain the delegated prompt,
child response, workspace contents, credentials, or authorization headers.
Skill events
Publication events may include Skill/version identifiers, version number, and
content hash. Runtime events contain only safe identifiers, the requested
resource path, outcome, and duration. They never contain instructions,
resource contents, decoded bytes, model text, credentials, or authorization
headers. Audit records follow the same boundary.
MCP events
MCP configuration emitsmcp.server_created,
mcp.server_version_published, mcp.discovery_completed,
mcp.discovery_failed, mcp.toolset_published,
mcp.credential_created, mcp.credential_rotated, and
mcp.credential_revoked. Runtime calls emit mcp.call_started,
mcp.call_completed, mcp.call_failed, or mcp.call_cancelled.
Payloads contain only tenant resource IDs, remote tool name, safe outcome/error
code, response byte count, and timing/state metadata. They exclude credentials,
headers, tool arguments, tool results, model content, and sandbox state.
TypeScript SDK
The workspace SDK reconnects automatically unless disabled:lastEventId is omitted and from: "now" is set, the SDK opens the first
connection at ?from=now, records the server’s X-OAO-Event-Cursor response
header, and sends that cursor in Last-Event-ID on subsequent reconnects even
if no events arrived before the stream closed.
Abort the supplied signal during application shutdown. For a browser using the
WorkOS cookie, configure the client with credentials: "include"; for a
server-side integration, provide apiKey.
