Stream Protocol

Convert public Harness observations into typed AG-UI events for terminals, browsers, and transports.

Stream Protocol (a13n-stream-protocol) only converts events: it does not run an Agent or provide an SSE server.

Start here

TaskGuide
Run a complete conversion without credentialsGetting started
Map text, reasoning, tools, custom events, and terminal resultsEvents and processors
Rebuild a projection after a consumer restartReplay and recovery
Look up public exports, fragment limits, and payload shapesAPI and payload reference
Continue Agent execution from saved stateHarness State and Resume

One observer, one Run

HarnessAguiObserver binds to one Run. HarnessAguiStreamObserver instead binds to a root stream and tracks its inline children independently, attributing their output with subagentRunId. Host-managed asynchronous child Runs still use independent observers.

observe() returns only events produced by the current item. snapshot() returns detached accumulated events; it is an in-memory convenience, not a durable log. resume() reconstructs observer state from exact Harness source history without publishing history again.

Install

Terminal
uv add a13n-stream-protocol

Published Stream Protocol pins the matching Harness release. The source quickstart uses the repository lockfile to match this documentation on main.

Ownership Summary

ConcernOwner
Harness execution, source lifecycle, result, and HarnessStateHarness
Harness-to-AG-UI conversion and process-local reconstructionStream Protocol
Visibility policy expressed by a replay-stable processorHost processor
Source-history retention, cursor, gap detection, and live cutoverHost
Durable AG-UI IDs, persistence, replay, and fan-outHost
SSE, WebSocket, Redis, or in-process deliveryHost transport
Rendered view stateRenderer

Upgrade to AG-UI 1.0

Upgrade Hosts and renderers together. Python uses ag-ui-protocol>=1,<2; browser consumers use upstream @ag-ui/core types and schemas, not a replacement transport client. Standard wire fields are camelCase. There is no 0.x decoder or alias layer.

  • Logical Run start emits RUN_STARTED once, after preparation and before public output.
  • Cancellation and suspension use RUN_FINISHED with cancelled or interrupt outcomes; only failure uses RUN_ERROR. Deferred call IDs stay native, and Host answer validation is unchanged.
  • Input uses CUSTOM value.event.role and value.event.message_id, with top-level metadata.
  • Tool results may contain ordered upstream content parts; hidden supplemental media is never public. Binary data and unsafe URLs become payload-omitted descriptors, never inline bytes; provider file handles stay FileSource references without a downloadable URL.
  • Namespace inline child display keys by subagentRunId. Child replies do not become root answers. Missing historical child display cannot be reconstructed from model history.

This protocol upgrade does not discard Harness continuation state or usage ledgers.

Next Steps

Reference topics

TopicGuide
Observe a Harness RunObserve a Harness Run
Read the Accumulated SnapshotRead the Accumulated Snapshot
Apply a Host ProcessorApply a Host Processor
Resume from Source HistoryResume from Source History
Resume Is Not Agent RecoveryResume Is Not Agent Recovery
Errors and AtomicityErrors and Atomicity

On this page