AG-UI is designed for agent-to-user interaction: the connection between an agentic backend and a user-facing frontend. It is distinct from the other Deep Agents protocols:
- AG-UI connects a deep agent to a frontend application (this page).
- Agent Client Protocol (ACP) connects a deep agent to code editors and IDEs.
- Model Context Protocol (MCP) lets a deep agent call tools hosted by external servers.
- Agent2Agent (A2A) connects a deep agent to other agents.
Quickstart
Serve a deep agent as a LangGraph graph, then connect the TypeScript@ag-ui/langgraph adapter so AG-UI clients can drive it.
Install dependencies
Install Deep Agents and the LangGraph CLI to serve the graph. The AG-UI adapter used in later steps is TypeScript (@ag-ui/langgraph). For a Python CopilotKit or AG-UI FastAPI bridge, see CopilotKit.
createDeepAgent (create_deep_agent in Python) is a LangGraph graph. Expose it to AG-UI clients by serving it as a LangGraph server, then point the AG-UI adapter at that server.
Create a deep agent
Define the agent and export the graph so a LangGraph server can load it.agent.py
Serve the agent
Register the graph in alanggraph.json file at your project root.
langgraph.json
http://localhost:2024.
Connect the AG-UI adapter
The TypeScript@ag-ui/langgraph adapter wraps the running graph as an AG-UI agent that any client can drive. Point it at the LangGraph server and name the graph to load. This works whether the graph was authored in Python or TypeScript.
ag-ui agent
AG-UI LangGraph adapter on npm
The
@ag-ui/langgraph package implements the AG-UI protocol for LangGraph graphs, including deep agents.Stream events
AG-UI is an event stream. As a deep agent runs, the adapter translates its LangGraph execution into typed AG-UI events. A client subscribes to those events and updates as they arrive, rather than waiting for the final answer. A deep agent run maps onto many AG-UI event types. The main ones, among others:
State updates use
STATE_SNAPSHOT for a full baseline and STATE_DELTA (JSON Patch, RFC 6902) for incremental changes, so a client can keep todos, plans, and subagent status in sync without re-sending the whole state on every step.
To watch the stream directly, run the agent with a subscriber. Each event has a matching on…Event callback:
observe.ts
@ag-ui/langgraph emits a legacy on_interrupt custom event alongside RUN_FINISHED. To receive the structured AG-UI interrupt outcome on RUN_FINISHED (outcome.type === "interrupt"), set emitInterruptOutcome: true when you construct the agent:
resume field on the next input:
For the complete event schema, see the AG-UI events reference.
Connect a frontend
Any AG-UI client can drive a deep agent exposed over the protocol, so you do not have to build message rendering, streaming, or state sync yourself. Point the client at the adapter (or a runtime that wraps it) and select the agent by itsgraphId.
CopilotKit
React chat runtime with AG-UI support for LangGraph and Deep Agents, including the Python FastAPI bridge.
AG-UI clients
The full list of AG-UI clients and SDKs, including terminal and mobile clients.
Build a custom client
Consume the event stream directly with the AG-UI SDK to build your own interface.
Programmatic API
LangGraphAgent connects to a deep agent on a LangGraph server and exposes it as an AG-UI agent. Construct it with the graph to load, then drive it with a few methods.
runAgent(parameters?, subscriber?): Run the agent and stream AG-UI events to the subscriber’son…Eventcallbacks (see Stream events). Resolves when the run finishes.subscribe(subscriber): Attach a persistent subscriber that receives events across every run, rather than for a single call.abortRun(): Cancel the run in progress.
initialMessages to the constructor, or call addMessage or setMessages before running.
See also
- CopilotKit: Python and TypeScript CopilotKit runtime patterns for Deep Agents over AG-UI
- Frontend overview: Build UIs that stream deep agent progress with the LangChain frontend SDKs
- Human-in-the-loop: Interrupt and resume model for deep agents
- Agent Client Protocol (ACP): Connect deep agents to code editors and IDEs
- AG-UI documentation: Protocol concepts, events, and client SDKs
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

