terminalskills/skills/ag-ui
- community
Checking that the SKILL.md file is still in the repository.
AG-UI (Agent-User Interaction Protocol) is an open, event-based protocol that streams an AI agent's text, tool calls, state and lifecycle events to a frontend over HTTP and Server-Sent Events. Use when the user wants to build an AG-UI server, connect an agent or framework (LangGraph, Mastra, CrewAI, Pydantic AI) to a React or custom UI, stream agent progress and state, or use CopilotKit with AG-UI.
Install
npx vskill@latest install terminalskills/skills/ag-uiSKILL.md
AG-UI — Agent-User Interaction Protocol
Overview
AG-UI standardizes how an agent backend talks to a user-facing app. The app POSTs one JSON RunAgentInput (thread id, run id, messages, state, tools, context, forwarded props); the agent answers with a stream of typed events. It sits beside MCP (agents to tools) and A2A (agent to agent). The protocol was created by the CopilotKit team and is implemented by LangGraph, Mastra, CrewAI, Pydantic AI, Google ADK, Microsoft Agent Framework, AWS Strands, Agno, LlamaIndex, AG2 and others. Version 1.0 shipped in September 2026; this skill was checked against @ag-ui/core/client/encoder 1.0.1 and the Python ag-ui-protocol 1.0.0.
There are no @ag-ui/server or @ag-ui/react packages and no AgentServer/useAgent in @ag-ui/*. The SDK packages are @ag-ui/core (types and constants), @ag-ui/client (HttpAgent, subscribers), @ag-ui/encoder (EventEncoder) and, per framework, @ag-ui/langgraph, @ag-ui/mastra and so on. The React layer comes from CopilotKit (@copilotkit/react-core/v2).
Instructions
Event vocabulary
Every event has a type. The families:
- Lifecycle:
RUN_STARTED,RUN_FINISHED,RUN_ERROR,STEP_STARTED,STEP_FINISHED - Text:
TEXT_MESSAGE_START,TEXT_MESSAGE_CONTENT(withdelta),TEXT_MESSAGE_END, plus a compactTEXT_MESSAGE_CHUNK - Tool calls:
TOOL_CALL_START,TOOL_CALL_ARGS(streamed JSONdelta),TOOL_CALL_END,TOOL_CALL_RESULT - State:
STATE_SNAPSHOT(replace the whole state),STATE_DELTA(JSON Patch operations),MESSAGES_SNAPSHOT - Activity:
ACTIVITY_SNAPSHOT,ACTIVITY_DELTA; Reasoning:REASONING_*(these replace the deprecatedTHINKING_*); Subagents:SUBAGENT_STARTED/FINISHED/ERROR - Escape hatches:
RAWandCUSTOM(nameplusvalue)
A run starts with RUN_STARTED and ends with RUN_FINISHED or RUN_ERROR. Every opened message, tool call or reasoning span must be closed before the run finishes, or the 1.0 client fails the run.
A Node.js server (HTTP + SSE)
If you hit a failure after the stream has opened, send RUN_ERROR (message, optional code) instead of changing the HTTP status. Reject bad input before streaming with a normal HTTP error status.
A Python server
Run it with uvicorn app:app --port 8000. Python field names are snake_case; on the wire they are camelCase (threadId, runId).
A TypeScript client
runAgent applies events to agent.messages and agent.state (including STATE_DELTA patches) and calls subscriber hooks such as onRunStartedEvent, onTextMessageStartEvent, onToolCallResultEvent, onStateSnapshotEvent, onCustomEvent and onNewMessage.
React with CopilotKit
CopilotKit is the React layer built on AG-UI. Register your AG-UI endpoint in the Copilot Runtime, then use the hooks. Check the CopilotKit docs for your framework's exact quickstart.
For a fully custom UI use useAgent({ agentId }) (exposes messages, isRunning) and useCopilotKit() (copilotkit.runAgent({ agent })), plus useFrontendTool, useHumanInTheLoop and useRenderToolCall for tools the UI handles itself. Scaffold a project with npx create-ag-ui-app@latest or npx copilotkit@latest create.
Examples
Example 1: "Stream my agent's progress and results to the browser"
Run the Node server above (node server.mjs) and the client (node client.mjs). The client prints [state] {"status":"searching","progress":0}, then [tool] search_orders { email: 'maria@brightbasket.dev' }, then the streamed sentence Maria has 3 open orders., and ends with agent.state equal to { status: 'searching', progress: 100 } because the STATE_DELTA patch was applied.
Example 2: "Put our existing LangGraph agent behind a React chat"
Keep the LangGraph agent as is, expose it through its AG-UI integration (@ag-ui/langgraph for JS; the Python package from the LangGraph quickstart), register the agent's URL with new HttpAgent({ url }) in the runtime agents map as shown above, and render <CopilotChat agentId="support" />. Tool calls and state changes then appear in the UI without custom parsing.
Guidelines
- Pin
@ag-ui/clientto one version across your app and@copilotkit/runtime; two copies cause subtle type and instance errors. - 1.0 is strict: unknown event types are dropped with a warning, unknown properties are stripped (put extra data in
metadata, or send it to the agent inforwardedProps), a malformed known field fails the run, and unclosed messages, tool calls or reasoning spans atRUN_FINISHEDfail the run. Optional fields must be absent, notnull. - Validators moved to
@ag-ui/core/schemasand needzod(3.25.18+ or 4.x); the@ag-ui/coremain entry is types only. - Replace
THINKING_*events withREASONING_*; the client still translates old streams and warns, but the shims expire. - Use
STATE_DELTA(JSON Patch) for small frequent changes andSTATE_SNAPSHOTto resync; keep agent state serializable and free of secrets, because it reaches the browser. - Authenticate the endpoint yourself (headers, cookies, tokens); the protocol does not. Human-in-the-loop confirmations are enforced on the server, not only in the UI.
- Debug with the AG-UI Dojo (dojo.ag-ui.com) and by
curl -Nagainst your endpoint withAccept: text/event-stream.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ag-ui/SKILL.md
Popularity
- Repository stars
- 157
- Repository forks
- 21
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/terminalskills/skills/ag-ui)