AG-UI — Agent-User Interaction Protocol
You are an expert in AG-UI (Agent-User Interaction Protocol), the open standard by CopilotKit for connecting AI agents to frontend UIs. You help developers stream agent actions, tool calls, state updates, and text generation to React components in real-time — enabling rich agent UIs where users see what the agent is thinking, doing, and can intervene at any step.
Best use case
AG-UI — Agent-User Interaction Protocol is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
You are an expert in AG-UI (Agent-User Interaction Protocol), the open standard by CopilotKit for connecting AI agents to frontend UIs. You help developers stream agent actions, tool calls, state updates, and text generation to React components in real-time — enabling rich agent UIs where users see what the agent is thinking, doing, and can intervene at any step.
Teams using AG-UI — Agent-User Interaction Protocol should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ag-ui/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How AG-UI — Agent-User Interaction Protocol Compares
| Feature / Agent | AG-UI — Agent-User Interaction Protocol | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
You are an expert in AG-UI (Agent-User Interaction Protocol), the open standard by CopilotKit for connecting AI agents to frontend UIs. You help developers stream agent actions, tool calls, state updates, and text generation to React components in real-time — enabling rich agent UIs where users see what the agent is thinking, doing, and can intervene at any step.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# AG-UI — Agent-User Interaction Protocol
You are an expert in AG-UI (Agent-User Interaction Protocol), the open standard by CopilotKit for connecting AI agents to frontend UIs. You help developers stream agent actions, tool calls, state updates, and text generation to React components in real-time — enabling rich agent UIs where users see what the agent is thinking, doing, and can intervene at any step.
## Core Capabilities
### AG-UI Server (Agent Events)
```typescript
// server/agent.ts — Stream agent events to UI
import { AgentServer, EventStream } from "@ag-ui/server";
const server = new AgentServer();
server.onRequest(async (request, stream: EventStream) => {
const { messages, context } = request;
// Emit thinking state
stream.emitStateUpdate({ status: "thinking", progress: 0 });
// Stream text generation
stream.emitTextStart();
for (const word of "I'll analyze your data now.".split(" ")) {
stream.emitTextDelta(word + " ");
await sleep(50);
}
stream.emitTextEnd();
// Emit tool call
stream.emitToolCallStart("search_database", { query: context.userQuery });
const results = await searchDatabase(context.userQuery);
stream.emitToolCallEnd("search_database", results);
stream.emitStateUpdate({ status: "analyzing", progress: 50 });
// Stream analysis
stream.emitTextStart();
const analysis = await generateAnalysis(results);
for await (const chunk of analysis) {
stream.emitTextDelta(chunk);
}
stream.emitTextEnd();
// Custom state for UI rendering
stream.emitStateUpdate({
status: "complete",
progress: 100,
charts: [{ type: "bar", data: results.chartData }],
suggestions: ["Run deeper analysis", "Export to CSV", "Schedule report"],
});
stream.end();
});
```
### AG-UI React Client
```tsx
import { useAgent, AgentProvider } from "@ag-ui/react";
function App() {
return (
<AgentProvider url="https://api.example.com/agent">
<AgentChat />
</AgentProvider>
);
}
function AgentChat() {
const { messages, state, sendMessage, isStreaming, toolCalls } = useAgent();
return (
<div className="flex flex-col h-screen">
{/* Agent state visualization */}
{state.status === "thinking" && (
<div className="bg-blue-50 p-3 rounded-lg animate-pulse">
🤔 Agent is thinking... ({state.progress}%)
<progress value={state.progress} max={100} />
</div>
)}
{/* Tool calls (show what agent is doing) */}
{toolCalls.map((tc) => (
<div key={tc.id} className="bg-gray-50 p-2 rounded text-sm">
🔧 <strong>{tc.name}</strong>: {tc.status === "running" ? "Working..." : "Done"}
{tc.result && <pre className="mt-1">{JSON.stringify(tc.result, null, 2)}</pre>}
</div>
))}
{/* Messages */}
{messages.map((msg) => (
<div key={msg.id} className={msg.role === "user" ? "text-right" : "text-left"}>
<p>{msg.content}</p>
</div>
))}
{/* Dynamic UI from agent state */}
{state.charts?.map((chart, i) => (
<Chart key={i} type={chart.type} data={chart.data} />
))}
{state.suggestions && (
<div className="flex gap-2">
{state.suggestions.map((s) => (
<button key={s} onClick={() => sendMessage(s)} className="px-3 py-1 bg-blue-100 rounded">
{s}
</button>
))}
</div>
)}
{/* Input */}
<form onSubmit={(e) => { e.preventDefault(); sendMessage(input); }}>
<input placeholder="Ask anything..." disabled={isStreaming} />
</form>
</div>
);
}
```
## Installation
```bash
npm install @ag-ui/react @ag-ui/server
```
## Best Practices
1. **State streaming** — Emit state updates for progress, status, UI components; users see agent's thought process
2. **Tool call transparency** — Show tool calls in real-time; builds trust, helps debugging
3. **Suggestions** — Emit suggestion buttons after responses; guide users to next actions
4. **Custom UI** — Use state updates to render charts, tables, forms; richer than plain text
5. **Human-in-the-loop** — Emit confirmation requests before destructive actions; users approve or reject
6. **Progress tracking** — Emit progress percentages for long tasks; prevent user anxiety
7. **Framework agnostic** — AG-UI protocol works with any agent backend (LangGraph, CrewAI, custom)
8. **CopilotKit integration** — AG-UI powers CopilotKit; use CopilotKit for higher-level React componentsRelated Skills
entra-agent-user
Create Agent Users in Microsoft Entra ID from Agent Identities, enabling AI agents to act as digital workers with user identity capabilities in Microsoft 365 and Azure environments.
agent-protocol
Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, and response formats. Use when C-suite agents need to query each other, coordinate cross-functional analysis, or run board meetings with multiple agent roles.
interaction-design
Design and implement microinteractions, motion design, transitions, and user feedback patterns. Use when adding polish to UI interactions, implementing loading states, or creating delightful user experiences.
user-guide-writing
Write clear and helpful user guides and tutorials for end users. Use when creating onboarding docs, how-to guides, or FAQ pages. Handles user-focused documentation, screenshots, step-by-step instructions.
protocol-reverse-engineering
Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation. Use when analyzing network traffic, understanding proprietary protocols, or debugging network communication.
defi-protocol-templates
Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.
data-structure-protocol
Give agents persistent structural memory of a codebase — navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.
harness-model-protocol
Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding/decoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.
when-analyzing-user-intent-use-intent-analyzer
Advanced intent interpretation system using cognitive science principles and probabilistic intent mapping
snowtower-user
Helps end-users get Snowflake access and use the platform. Use when users ask about requesting access, generating RSA keys, connecting to Snowflake, or basic Snowflake usage. Triggers on mentions of access requests, RSA keys, connection issues, or "how do I get access".
ask-user
Pattern for effectively interacting with users to gather information or get decisions. Use when you need user input.
verification-protocol
Independent verification of task completion - eliminates self-attestation