ag-ui
БесплатноБез исполняемых скриптовНе проверен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…
Об этом скилле
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)
npm install --save-exact @ag-ui/[email protected] @ag-ui/[email protected] @ag-ui/[email protected]
// server.mjs: a minimal AG-UI endpoint on POST /agent
import { createServer } from 'node:http';
import { randomUUID } from 'node:crypto';
import { EventType } from '@ag-ui/core';
import { EventEncoder } from '@ag-ui/encoder';
createServer(async (req, res) => {
if (req.method !== 'POST' || req.url !== '/agent') return res.writeHead(404).end();
let body = '';
for await (const chunk of req) body += chunk;
const input = JSON.parse(body); // RunAgentInput
const encoder = new EventEncoder({ accept: req.headers.accept });
res.writeHead(200, { 'Content-Type': encoder.getContentType(), 'Cache-Control': 'no-cache' });
const send = (event) => res.write(encoder.encode(event));
send({ type: EventType.RUN_STARTED, threadId: input.threadId, runId: input.runId });
send({ type: EventType.STATE_SNAPSHOT, snapshot: { status: 'searching', progress: 0 } });
const callId = randomUUID();
send({ type: EventType.TOOL_CALL_START, toolCallId: callId, toolCallName: 'search_orders' });
send({ type: EventType.TOOL_CALL_ARGS, toolCallId: callId, delta: JSON.stringify({ email: '[email protected]' }) });
send({ type: EventType.TOOL_CALL_END, toolCallId: callId });
send({ type: EventType.TOOL_CALL_RESULT, messageId: randomUUID(), toolCallId: callId, content: JSON.stringify({ orders: 3 }), role: 'tool' });
send({ type: EventType.STATE_DELTA, delta: [{ op: 'replace', path: '/progress', value: 100 }] });
const messageId = randomUUID();
send({ type: EventType.TEXT_MESSAGE_START, messageId, role: 'assistant' });
for (const word of ['Maria', 'has', '3', 'open', 'orders.']) {
send({ type: EventType.TEXT_MESSAGE_CONTENT, messageId, delta: word + ' ' });
}
send({ type: EventType.TEXT_MESSAGE_END, messageId });
send({ type: EventType.RUN_FINISHED, threadId: input.threadId, runId: input.runId });
res.end();
}).listen(8787, '127.0.0.1');
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
pip install ag-ui-protocol fastapi uvicorn
# app.py
import uuid
from fastapi import FastAPI, Request
from fastapi.responses import StreamingResponse
from ag_ui.core import (RunAgentInput, EventType, RunStartedEvent, RunFinishedEvent,
TextMessageStartEvent, TextMessageContentEvent, TextMessageEndEvent)
from ag_ui.encoder import EventEncoder
app = FastAPI()
@app.post("/agent")
async def agent(input_data: RunAgentInput, request: Request):
encoder = EventEncoder(accept=request.headers.get("accept"))
async def events():
yield encoder.encode(RunStartedEvent(type=EventType.RUN_STARTED, thread_id=input_data.thread_id, run_id=input_data.ru
Установить ag-ui в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ag-ui?
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.
Как установить скилл ag-ui?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ag-ui запускает скрипты?
Нет, скилл состоит только из инструкций (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