Introduction
Picking an adapter? This guide covers
@threadplane/ag-ui— the AG-UI protocol adapter. If you are talking to LangGraph Platform directly via the LangGraph SDK, use@threadplane/langgraphinstead. See Choosing an adapter for a side-by-side comparison.
@threadplane/ag-ui is the runtime adapter that wraps an AG-UI AbstractAgent into the runtime-neutral Agent contract from @threadplane/chat. The chat UI primitives consume the Agent contract, and the AG-UI adapter translates between the contract and the AG-UI event protocol.
AG-UI is an open agent-to-UI protocol. It standardizes how agent runtimes stream events (messages, tool calls, state updates) to a frontend. It is used by CrewAI, Mastra, Microsoft Agent Framework, AG2, Pydantic AI, and AWS Strands. One adapter unlocks all of them.
The AG-UI demo runs this exact chat surface against an AG-UI backend — streaming, tool calls, and generative UI included.
How it fits
What you get
toAgent(source: AbstractAgent): AgUiAgent- wraps anyAbstractAgentsubclass (custom transports, mocks) into the runtime-neutralAgentcontract.provideAgent({ url })- DI convenience that instantiatesHttpAgentunder the hood for the common SSE/HTTP case.FakeAgent- in-processAbstractAgentsubclass that emits canned streaming events for offline demos and tests.
What's covered
This is what the adapter handles today:
messages(streaming token deltas viaTEXT_MESSAGE_*events)status/isLoading/error(lifecycle viaRUN_STARTED/FINISHED/ERROR)toolCalls(streaming tool calls viaTOOL_CALL_*events)state(snapshots and JSON-Patch deltas)events$(custom events; discriminatesstate_update)- Interrupts (from
CUSTOMevents namedon_interrupt, or aRUN_FINISHEDcarrying an interrupt outcome) - Subagent progress (from
SUBAGENT_*events, orACTIVITY_*withactivityType: 'subagent')
Out of scope for now (use @threadplane/langgraph if you need LangGraph Platform-specific APIs):
- History / time-travel
Next steps
- Quick Start - bind
<chat>to an AG-UI backend in 5 minutes. - Installation - npm install + provider setup.
- Architecture - understand the adapter boundary and provider choices.
- Event Mapping - see how AG-UI events update
Agentfields. - Fake Agent - build UI without a backend.
- Citations - attach sources through
state.citations. - Troubleshooting - debug provider, stream, state, and citation issues.
- Chat Debug - inspect the raw event stream with
<chat-debug>.