Collect events from a whole run
Observe workflow, agent and resource activity through one observation object.
For a single terminal session, start with Follow progress. Use an observation object when several tasks and resource operations need a common execution scope. Save the named files below together and run node observe-workflow.ts using the setup configuration.
Choose one observation entry point
Section titled “Choose one observation entry point”Use createObservation() for new integrations. Add createReporter() for terminal progress and a transporter when runs must be readable later. Pass that client as observation to dispatches and workflows. You do not need to configure observe, telemetry, warn, diagnostic or logging to get started.
Specialized callbacks remain available for existing integrations and targeted diagnostics. Observation sinks receive bounded events and may lose delivery; replayable journals record a different contract, and checkpoints or queues own durable control state. Reading an observed run never authorizes recovery or replay. See run state, journals and durable runs.
Observe a whole run
Section titled “Observe a whole run”Create an observation object when you want workflow, agent and resource events in one place. Add sinks that receive the events, then pass it as observation to your run. Each event includes its execution scope.
The sink prints workflow transitions, sandbox and Git operations and the agent’s events, in seq order. dispatch() accepts the same observation option for a single task.
API reference: Observation.
One object for outputs and reading
Section titled “One object for outputs and reading”createObservation() composes sinks and, with transporter, automatically records executions started by dispatch() or workflow.start(). The engine owns tracking; the observation object starts no work. Share it between executions: each persisted execution has its own event sequence. observation.readRun(id) and observation.watchRun(id) read storage from this process or another; see execution state.
Pass objects from createReporter(), createCustomReporter() or createOpenTelemetryObserver() directly in sinks. Observation borrows them: it flushes delivery but their owner still closes them. Close observation after executions, then the OpenTelemetry observer and its SDK. await using waits for active sessions without cancelling work. Historical callbacks and createObservationHub() remain compatible.
Carry the scope into your own tasks
Section titled “Carry the scope into your own tasks”defineAgentTask and defineIsolatedTask attach their dispatch to the task’s scope. In a task you write with defineTask, pass context.observation to each dispatch.
Without it, the dispatch still reports to its own observe, but its events never reach the hub. observation.child(scope, sinks) derives a hub that adds scope fields; sinks passed to a child receive only the events emitted below it.
Speculation takes the same observation option, and the recovery and retention helpers accept a hub as their last argument.
What the hub receives
Section titled “What the hub receives”The hub receives agent activity alongside workflow transitions and resource operations.
API reference: ObservationEvent.
An operation event pairs started with finished or failed through its id. Only the terminal event carries durationMs.
Built-in harness events
Section titled “Built-in harness events”The built-in harness reports its loop with these kinds. They also reach observe.
API reference: AgentEvent.
tool-result keeps only a 2,000-character preview of a result; subscribe to tool-output for the full stream.
Observe decisions and selections
Section titled “Observe decisions and selections”Decision evaluations emit lifecycle summaries with source decision. Routed harnesses emit model-route agent events identifying the effective model, selection reason and optional native confidence. Pass observation to decide() for a direct evaluation; decision tasks and harnesses propagate workflow, task, pass and subagent scopes. Full states and answers require a verbose hub. Valid decision usage is accounted synchronously, independently of sink delivery or failures.
Without a transporter, observation only distributes events in memory. With a transporter, the client also persists execution projections. Slow receivers can lose events and observer failures do not stop the run. See delivery and failures before relying on a complete trace.
Export to OpenTelemetry
Section titled “Export to OpenTelemetry”Install @opentelemetry/api and an OpenTelemetry SDK, then register the SDK and its exporters before you create the observer. Pass the observer directly to createObservation({ sinks }) to turn events into linked spans and metrics. The .sink property remains available for compatibility.
Save the three files below together and run node observe-telemetry.ts after registering the SDK.
The trace nests outpost.workflow, outpost.task, outpost.task.attempt and outpost.dispatch spans, with one span per operation such as outpost.sandbox.acquire. Without a registered SDK, the API handles export nothing.
API reference: createOpenTelemetryObserver.
telemetry.close() ends the spans still open. Your application flushes and shuts down the SDK. Pass onError to receive instrumentation errors; they never change a run’s outcome.
Without a hub
Section titled “Without a hub”Pass the observer as telemetry to start() for workflow, task and attempt spans, or to dispatch() for a dispatch span. Operation spans need the hub.

