ag-ui-protocol
БесплатноБез исполняемых скриптовНе проверенThis skill should be used when integrating AG-UI — the full event taxonomy (lifecycle, text message, tool call, state, activity, reasoning, custom)…
от TheLobbi★ 22 звезды на GitHubОб этом скилле
AG-UI — Agent User Interaction Protocol
AG-UI standardizes the event stream between a long-running agent backend and a user-facing frontend. It is not a widget format. Where MCP Apps answers "how does a tool render a card in a chat host", AG-UI answers "how does my app show what the agent is doing, share state with it, and let the user interrupt".
Built on plain HTTP and WebSockets. Deliberately transport-agnostic and deliberately tolerant of event-shape drift, so existing frameworks can adapt their native formats with minimal work.
Use AG-UI when you own the frontend. Use MCP Apps when someone else's chat host is the frontend. They compose: an MCP Apps View can drive an AG-UI stream inside itself for a long-running sub-task.
Core interface
run(input: RunAgentInput) -> Observable<BaseEvent>
RunAgentInput carries thread and run identifiers, message history
(role/content), available tools (name, description, parameters), context, and
forwarded properties.
BaseEvent — every event has:
{ type: string, timestamp?: number, rawEvent?: unknown }
rawEvent preserves the original framework event when AG-UI is a translation
layer. Keep it; it is what makes debugging a wrapped agent tractable.
Event taxonomy
Lifecycle
| Event | Fields |
|---|---|
RunStarted |
threadId, runId, parentRunId?, input? |
RunFinished |
outcome? (discriminated union), result? |
RunError |
message, code? |
StepStarted |
stepName |
StepFinished |
stepName |
parentRunId is how sub-agents nest. A frontend that ignores it will flatten a
delegation tree into noise.
Text messages
| Event | Fields |
|---|---|
TextMessageStart |
messageId, role |
TextMessageContent |
messageId, delta |
TextMessageEnd |
messageId |
TextMessageChunk |
messageId?, role?, delta? |
*Chunk is the compact form: emit it alone and the middleware synthesizes
start/content/end. Use the explicit triple when you need precise boundaries.
Tool calls
| Event | Fields |
|---|---|
ToolCallStart |
toolCallId, toolCallName, parentMessageId? |
ToolCallArgs |
toolCallId, delta |
ToolCallEnd |
toolCallId |
ToolCallResult |
messageId, toolCallId, content, role? |
ToolCallChunk |
toolCallId?, toolCallName?, parentMessageId?, delta? |
ToolCallArgs streams partial JSON. Render optimistically but treat it as
incomplete until ToolCallEnd.
State
| Event | Fields |
|---|---|
StateSnapshot |
snapshot — the complete state |
StateDelta |
delta — RFC 6902 JSON Patch operations |
MessagesSnapshot |
messages — full conversation history |
Snapshot on connect and after any desync; delta for everything in between. A frontend that only handles snapshots works but wastes bandwidth; one that only handles deltas breaks on reconnect. Handle both.
Activity
| Event | Fields |
|---|---|
ActivitySnapshot |
messageId, activityType, content, replace? |
ActivityDelta |
messageId, activityType, patch (RFC 6902) |
Activity is the "what is the agent doing right now" channel — progress bars, sub-task lists, live status.
Reasoning
| Event | Fields |
|---|---|
ReasoningStart |
messageId |
ReasoningMessageStart |
messageId, role |
ReasoningMessageContent |
messageId, delta |
ReasoningMessageEnd |
messageId |
ReasoningMessageChunk |
messageId, delta? |
ReasoningEnd |
messageId |
ReasoningEncryptedValue |
subtype, entityId, encryptedValue |
ReasoningEncryptedValue carries provider-encrypted reasoning you must pass
back verbatim on the next turn. Never drop it, never try to parse it.
Special
| Event | Fields |
|---|---|
Raw |
event, source? |
Custom |
name, value |
MetaEvent (draft) |
metaType, payload |
Custom is the open extension point — use it for domain events your frontend
knows about and the protocol does not.
Server implementation
Python — ag_ui.core (event types), ag_ui.encoder (SSE):
from ag_ui.core import RunStartedEvent, TextMessageChunkEvent, RunFinishedEvent
from ag_ui.encoder import EventEncoder
async def stream(input: RunAgentInput, accept: str):
encoder = EventEncoder(accept=accept)
yield encoder.encode(RunStartedEvent(thread_id=input.thread_id, run_id=input.run_id))
async for token in agent(input):
yield encoder.encode(TextMessageChunkEvent(message_id=mid, delta=token))
yield encoder.encode(RunFinishedEvent(thread_id=input.thread_id, run_id=input.run_id))
Pass the request's Accept header into EventEncoder — that is how it chooses
between text SSE and the binary protocol.
TypeScript — @ag-ui/core (types), @ag-ui/client (HttpAgent,
AbstractAgent):
import { AbstractAgent } from "@ag-ui/client";
class MyAgent extends AbstractAgent {
run(input: RunAgentInput): Observable<BaseEvent> { /* emit events *
Установить ag-ui-protocol в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ag-ui-protocol?
This skill should be used when integrating AG-UI — the full event taxonomy (lifecycle, text message, tool call, state, activity, reasoning, custom), RunAgentInput, SSE and binary transports, AbstractAgent/HttpAgent, STATE_DELTA JSON Patch, generative UI, human-in-the-loop interrupts, and CopilotKit frontends.
Как установить скилл ag-ui-protocol?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ag-ui-protocol запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic