> ag-ui
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.
curl "https://skillshub.wtf/TerminalSkills/skills/ag-ui?format=md"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)
// 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
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
npm install @ag-ui/react @ag-ui/server
Best Practices
- State streaming — Emit state updates for progress, status, UI components; users see agent's thought process
- Tool call transparency — Show tool calls in real-time; builds trust, helps debugging
- Suggestions — Emit suggestion buttons after responses; guide users to next actions
- Custom UI — Use state updates to render charts, tables, forms; richer than plain text
- Human-in-the-loop — Emit confirmation requests before destructive actions; users approve or reject
- Progress tracking — Emit progress percentages for long tasks; prevent user anxiety
- Framework agnostic — AG-UI protocol works with any agent backend (LangGraph, CrewAI, custom)
- CopilotKit integration — AG-UI powers CopilotKit; use CopilotKit for higher-level React components
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.