[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-copilotkit-copilotkit-agui":3,"mdc--jgjkjy-key":56,"related-repo-copilotkit-copilotkit-agui":972,"related-org-copilotkit-copilotkit-agui":1067},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":26,"repoUrl":27,"updatedAt":28,"license":29,"forks":30,"topics":31,"repo":51,"sourceUrl":54,"mdContent":55},"copilotkit-agui","build and debug CopilotKit agent backends","Use when building custom agent backends, implementing the AG-UI protocol, debugging streaming issues, or understanding how agents communicate with frontends. Covers event types, SSE transport, AbstractAgent\u002FHttpAgent patterns, state synchronization, tool calls, and human-in-the-loop flows.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"copilotkit","CopilotKit","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fcopilotkit.png",[12,16,17,20,23],{"name":13,"slug":14,"type":15},"Backend","backend","tag",{"name":9,"slug":8,"type":15},{"name":18,"slug":19,"type":15},"Agents","agents",{"name":21,"slug":22,"type":15},"API Development","api-development",{"name":24,"slug":25,"type":15},"Debugging","debugging",35928,"https:\u002F\u002Fgithub.com\u002FCopilotKit\u002FCopilotKit","2026-07-12T08:06:22.179755",null,4434,[32,33,34,19,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"agent","agent-native","agentic-ai","ai","ai-agent","ai-assistant","assistant","assistant-chat-bots","copilot","copilot-chat","generative-ui","js","llm","nextjs","open-source","react","reactjs","ts","typescript",{"repoUrl":27,"stars":26,"forks":30,"topics":52,"description":53},[32,33,34,19,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50],"The Frontend Stack for Agents & Generative UI. React, Angular, Mobile, Slack, and more.  Makers of the AG-UI Protocol","https:\u002F\u002Fgithub.com\u002FCopilotKit\u002FCopilotKit\u002Ftree\u002FHEAD\u002Fskills\u002Fcopilotkit-agui","---\nname: copilotkit-agui\ndescription: \"Use when building custom agent backends, implementing the AG-UI protocol, debugging streaming issues, or understanding how agents communicate with frontends. Covers event types, SSE transport, AbstractAgent\u002FHttpAgent patterns, state synchronization, tool calls, and human-in-the-loop flows.\"\nversion: 1.0.0\n---\n\n# AG-UI Protocol Skill\n\n## Overview\n\nAG-UI (Agent-User Interaction) is CopilotKit's open event-based protocol for agent-to-UI communication. All agent-frontend interaction flows through typed events streamed over SSE (Server-Sent Events) or binary protobuf transport. Agents implement `AbstractAgent.run()` returning an RxJS `Observable\u003CBaseEvent>`, and the client SDK handles event application, state management, and message history.\n\n## When to Use\n\n- Building a custom agent backend that needs to speak AG-UI\n- Implementing `AbstractAgent.run()` for a new framework integration\n- Debugging why events aren't reaching the frontend or arriving malformed\n- Understanding event ordering (lifecycle, text, tool calls, state)\n- Working with state synchronization (snapshots vs JSON Patch deltas)\n- Implementing human-in-the-loop interrupt\u002Fresume flows\n- Troubleshooting SSE streaming or encoding issues\n\n## When NOT to Use\n\n- For CopilotKit React hooks and frontend components, use `copilotkit-develop`\n- For CopilotKit runtime setup and configuration, use `copilotkit-setup`\n- For framework-specific integration guides (LangGraph, Mastra, CrewAI), use `copilotkit-integrations`\n\n## Quick Reference\n\n### Event Families\n\n| Family     | Events                                                                                                 | Purpose                     |\n| ---------- | ------------------------------------------------------------------------------------------------------ | --------------------------- |\n| Lifecycle  | `RUN_STARTED`, `RUN_FINISHED`, `RUN_ERROR`, `STEP_STARTED`, `STEP_FINISHED`                            | Run boundaries and progress |\n| Text       | `TEXT_MESSAGE_START`, `TEXT_MESSAGE_CONTENT`, `TEXT_MESSAGE_END`                                       | Streaming text messages     |\n| Tool Calls | `TOOL_CALL_START`, `TOOL_CALL_ARGS`, `TOOL_CALL_END`, `TOOL_CALL_RESULT`                               | Agent tool invocations      |\n| State      | `STATE_SNAPSHOT`, `STATE_DELTA`, `MESSAGES_SNAPSHOT`                                                   | State synchronization       |\n| Reasoning  | `REASONING_START`, `REASONING_MESSAGE_START\u002FCONTENT\u002FEND`, `REASONING_END`, `REASONING_ENCRYPTED_VALUE` | Chain-of-thought visibility |\n| Activity   | `ACTIVITY_SNAPSHOT`, `ACTIVITY_DELTA`                                                                  | Structured progress updates |\n| Custom     | `RAW`, `CUSTOM`                                                                                        | Extension points            |\n\n### Convenience Chunk Events\n\n`TEXT_MESSAGE_CHUNK` and `TOOL_CALL_CHUNK` auto-expand into Start\u002FContent\u002FEnd triads via the client's `transformChunks` pipeline. Use these for simpler backend implementations.\n\n### SSE Wire Format\n\nEach event is a JSON object sent as an SSE data line:\n\n```\ndata: {\"type\":\"RUN_STARTED\",\"threadId\":\"t1\",\"runId\":\"r1\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_START\",\"messageId\":\"m1\",\"role\":\"assistant\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_CONTENT\",\"messageId\":\"m1\",\"delta\":\"Hello\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_END\",\"messageId\":\"m1\"}\\n\\n\ndata: {\"type\":\"RUN_FINISHED\",\"threadId\":\"t1\",\"runId\":\"r1\"}\\n\\n\n```\n\n### Packages\n\n| Package          | npm                                                     | Purpose              |\n| ---------------- | ------------------------------------------------------- | -------------------- |\n| `@ag-ui\u002Fcore`    | Events, types, schemas                                  | Protocol definition  |\n| `@ag-ui\u002Fclient`  | AbstractAgent, HttpAgent, middleware, event application | Client SDK           |\n| `@ag-ui\u002Fencoder` | EventEncoder (SSE + protobuf)                           | Server-side encoding |\n\n## Workflow: Building an AG-UI Backend\n\n1. **Define your endpoint** -- Accept POST with `RunAgentInput` body, respond with `text\u002Fevent-stream`\n2. **Parse input** -- Extract `threadId`, `runId`, `messages`, `tools`, `state`, `context` from the request body\n3. **Emit events in order** -- `RUN_STARTED` first, then content events, then `RUN_FINISHED` or `RUN_ERROR`\n4. **Encode as SSE** -- Use `@ag-ui\u002Fencoder`'s `EventEncoder.encode()` or manually write `data: JSON\\n\\n`\n5. **Handle tool results** -- Client sends `TOOL_CALL_RESULT` back; agent processes and continues\n\nSee `references\u002Fbuilding-agents.md` for a complete working example.\n\n## Key Protocol Rules\n\n- Every run MUST start with `RUN_STARTED` and end with `RUN_FINISHED` or `RUN_ERROR`\n- `TEXT_MESSAGE_CONTENT.delta` must be non-empty\n- Tool call events are linked by `toolCallId`\n- `STATE_DELTA` uses RFC 6902 JSON Patch operations\n- Multiple sequential runs are supported -- each must complete before the next starts\n- Messages accumulate across runs; state continues unless reset by `STATE_SNAPSHOT`\n\n## References\n\n- `references\u002Fprotocol-spec.md` -- Complete event type reference with schemas and examples\n- `references\u002Fbuilding-agents.md` -- Step-by-step guide to building AG-UI backends\n- `references\u002Fevent-flow-diagrams.md` -- ASCII sequence diagrams for common flows\n- `references\u002Fclient-sdk.md` -- @ag-ui\u002Fclient API reference\n",{"data":57,"body":59},{"name":4,"description":6,"version":58},"1.0.0",{"type":60,"children":61},"root",[62,71,78,101,107,154,160,196,202,209,509,515,542,548,553,565,571,663,669,828,841,847,920,926],{"type":63,"tag":64,"props":65,"children":67},"element","h1",{"id":66},"ag-ui-protocol-skill",[68],{"type":69,"value":70},"text","AG-UI Protocol Skill",{"type":63,"tag":72,"props":73,"children":75},"h2",{"id":74},"overview",[76],{"type":69,"value":77},"Overview",{"type":63,"tag":79,"props":80,"children":81},"p",{},[82,84,91,93,99],{"type":69,"value":83},"AG-UI (Agent-User Interaction) is CopilotKit's open event-based protocol for agent-to-UI communication. All agent-frontend interaction flows through typed events streamed over SSE (Server-Sent Events) or binary protobuf transport. Agents implement ",{"type":63,"tag":85,"props":86,"children":88},"code",{"className":87},[],[89],{"type":69,"value":90},"AbstractAgent.run()",{"type":69,"value":92}," returning an RxJS ",{"type":63,"tag":85,"props":94,"children":96},{"className":95},[],[97],{"type":69,"value":98},"Observable\u003CBaseEvent>",{"type":69,"value":100},", and the client SDK handles event application, state management, and message history.",{"type":63,"tag":72,"props":102,"children":104},{"id":103},"when-to-use",[105],{"type":69,"value":106},"When to Use",{"type":63,"tag":108,"props":109,"children":110},"ul",{},[111,117,129,134,139,144,149],{"type":63,"tag":112,"props":113,"children":114},"li",{},[115],{"type":69,"value":116},"Building a custom agent backend that needs to speak AG-UI",{"type":63,"tag":112,"props":118,"children":119},{},[120,122,127],{"type":69,"value":121},"Implementing ",{"type":63,"tag":85,"props":123,"children":125},{"className":124},[],[126],{"type":69,"value":90},{"type":69,"value":128}," for a new framework integration",{"type":63,"tag":112,"props":130,"children":131},{},[132],{"type":69,"value":133},"Debugging why events aren't reaching the frontend or arriving malformed",{"type":63,"tag":112,"props":135,"children":136},{},[137],{"type":69,"value":138},"Understanding event ordering (lifecycle, text, tool calls, state)",{"type":63,"tag":112,"props":140,"children":141},{},[142],{"type":69,"value":143},"Working with state synchronization (snapshots vs JSON Patch deltas)",{"type":63,"tag":112,"props":145,"children":146},{},[147],{"type":69,"value":148},"Implementing human-in-the-loop interrupt\u002Fresume flows",{"type":63,"tag":112,"props":150,"children":151},{},[152],{"type":69,"value":153},"Troubleshooting SSE streaming or encoding issues",{"type":63,"tag":72,"props":155,"children":157},{"id":156},"when-not-to-use",[158],{"type":69,"value":159},"When NOT to Use",{"type":63,"tag":108,"props":161,"children":162},{},[163,174,185],{"type":63,"tag":112,"props":164,"children":165},{},[166,168],{"type":69,"value":167},"For CopilotKit React hooks and frontend components, use ",{"type":63,"tag":85,"props":169,"children":171},{"className":170},[],[172],{"type":69,"value":173},"copilotkit-develop",{"type":63,"tag":112,"props":175,"children":176},{},[177,179],{"type":69,"value":178},"For CopilotKit runtime setup and configuration, use ",{"type":63,"tag":85,"props":180,"children":182},{"className":181},[],[183],{"type":69,"value":184},"copilotkit-setup",{"type":63,"tag":112,"props":186,"children":187},{},[188,190],{"type":69,"value":189},"For framework-specific integration guides (LangGraph, Mastra, CrewAI), use ",{"type":63,"tag":85,"props":191,"children":193},{"className":192},[],[194],{"type":69,"value":195},"copilotkit-integrations",{"type":63,"tag":72,"props":197,"children":199},{"id":198},"quick-reference",[200],{"type":69,"value":201},"Quick Reference",{"type":63,"tag":203,"props":204,"children":206},"h3",{"id":205},"event-families",[207],{"type":69,"value":208},"Event Families",{"type":63,"tag":210,"props":211,"children":212},"table",{},[213,237],{"type":63,"tag":214,"props":215,"children":216},"thead",{},[217],{"type":63,"tag":218,"props":219,"children":220},"tr",{},[221,227,232],{"type":63,"tag":222,"props":223,"children":224},"th",{},[225],{"type":69,"value":226},"Family",{"type":63,"tag":222,"props":228,"children":229},{},[230],{"type":69,"value":231},"Events",{"type":63,"tag":222,"props":233,"children":234},{},[235],{"type":69,"value":236},"Purpose",{"type":63,"tag":238,"props":239,"children":240},"tbody",{},[241,293,329,372,408,451,480],{"type":63,"tag":218,"props":242,"children":243},{},[244,250,288],{"type":63,"tag":245,"props":246,"children":247},"td",{},[248],{"type":69,"value":249},"Lifecycle",{"type":63,"tag":245,"props":251,"children":252},{},[253,259,261,267,268,274,275,281,282],{"type":63,"tag":85,"props":254,"children":256},{"className":255},[],[257],{"type":69,"value":258},"RUN_STARTED",{"type":69,"value":260},", ",{"type":63,"tag":85,"props":262,"children":264},{"className":263},[],[265],{"type":69,"value":266},"RUN_FINISHED",{"type":69,"value":260},{"type":63,"tag":85,"props":269,"children":271},{"className":270},[],[272],{"type":69,"value":273},"RUN_ERROR",{"type":69,"value":260},{"type":63,"tag":85,"props":276,"children":278},{"className":277},[],[279],{"type":69,"value":280},"STEP_STARTED",{"type":69,"value":260},{"type":63,"tag":85,"props":283,"children":285},{"className":284},[],[286],{"type":69,"value":287},"STEP_FINISHED",{"type":63,"tag":245,"props":289,"children":290},{},[291],{"type":69,"value":292},"Run boundaries and progress",{"type":63,"tag":218,"props":294,"children":295},{},[296,301,324],{"type":63,"tag":245,"props":297,"children":298},{},[299],{"type":69,"value":300},"Text",{"type":63,"tag":245,"props":302,"children":303},{},[304,310,311,317,318],{"type":63,"tag":85,"props":305,"children":307},{"className":306},[],[308],{"type":69,"value":309},"TEXT_MESSAGE_START",{"type":69,"value":260},{"type":63,"tag":85,"props":312,"children":314},{"className":313},[],[315],{"type":69,"value":316},"TEXT_MESSAGE_CONTENT",{"type":69,"value":260},{"type":63,"tag":85,"props":319,"children":321},{"className":320},[],[322],{"type":69,"value":323},"TEXT_MESSAGE_END",{"type":63,"tag":245,"props":325,"children":326},{},[327],{"type":69,"value":328},"Streaming text messages",{"type":63,"tag":218,"props":330,"children":331},{},[332,337,367],{"type":63,"tag":245,"props":333,"children":334},{},[335],{"type":69,"value":336},"Tool Calls",{"type":63,"tag":245,"props":338,"children":339},{},[340,346,347,353,354,360,361],{"type":63,"tag":85,"props":341,"children":343},{"className":342},[],[344],{"type":69,"value":345},"TOOL_CALL_START",{"type":69,"value":260},{"type":63,"tag":85,"props":348,"children":350},{"className":349},[],[351],{"type":69,"value":352},"TOOL_CALL_ARGS",{"type":69,"value":260},{"type":63,"tag":85,"props":355,"children":357},{"className":356},[],[358],{"type":69,"value":359},"TOOL_CALL_END",{"type":69,"value":260},{"type":63,"tag":85,"props":362,"children":364},{"className":363},[],[365],{"type":69,"value":366},"TOOL_CALL_RESULT",{"type":63,"tag":245,"props":368,"children":369},{},[370],{"type":69,"value":371},"Agent tool invocations",{"type":63,"tag":218,"props":373,"children":374},{},[375,380,403],{"type":63,"tag":245,"props":376,"children":377},{},[378],{"type":69,"value":379},"State",{"type":63,"tag":245,"props":381,"children":382},{},[383,389,390,396,397],{"type":63,"tag":85,"props":384,"children":386},{"className":385},[],[387],{"type":69,"value":388},"STATE_SNAPSHOT",{"type":69,"value":260},{"type":63,"tag":85,"props":391,"children":393},{"className":392},[],[394],{"type":69,"value":395},"STATE_DELTA",{"type":69,"value":260},{"type":63,"tag":85,"props":398,"children":400},{"className":399},[],[401],{"type":69,"value":402},"MESSAGES_SNAPSHOT",{"type":63,"tag":245,"props":404,"children":405},{},[406],{"type":69,"value":407},"State synchronization",{"type":63,"tag":218,"props":409,"children":410},{},[411,416,446],{"type":63,"tag":245,"props":412,"children":413},{},[414],{"type":69,"value":415},"Reasoning",{"type":63,"tag":245,"props":417,"children":418},{},[419,425,426,432,433,439,440],{"type":63,"tag":85,"props":420,"children":422},{"className":421},[],[423],{"type":69,"value":424},"REASONING_START",{"type":69,"value":260},{"type":63,"tag":85,"props":427,"children":429},{"className":428},[],[430],{"type":69,"value":431},"REASONING_MESSAGE_START\u002FCONTENT\u002FEND",{"type":69,"value":260},{"type":63,"tag":85,"props":434,"children":436},{"className":435},[],[437],{"type":69,"value":438},"REASONING_END",{"type":69,"value":260},{"type":63,"tag":85,"props":441,"children":443},{"className":442},[],[444],{"type":69,"value":445},"REASONING_ENCRYPTED_VALUE",{"type":63,"tag":245,"props":447,"children":448},{},[449],{"type":69,"value":450},"Chain-of-thought visibility",{"type":63,"tag":218,"props":452,"children":453},{},[454,459,475],{"type":63,"tag":245,"props":455,"children":456},{},[457],{"type":69,"value":458},"Activity",{"type":63,"tag":245,"props":460,"children":461},{},[462,468,469],{"type":63,"tag":85,"props":463,"children":465},{"className":464},[],[466],{"type":69,"value":467},"ACTIVITY_SNAPSHOT",{"type":69,"value":260},{"type":63,"tag":85,"props":470,"children":472},{"className":471},[],[473],{"type":69,"value":474},"ACTIVITY_DELTA",{"type":63,"tag":245,"props":476,"children":477},{},[478],{"type":69,"value":479},"Structured progress updates",{"type":63,"tag":218,"props":481,"children":482},{},[483,488,504],{"type":63,"tag":245,"props":484,"children":485},{},[486],{"type":69,"value":487},"Custom",{"type":63,"tag":245,"props":489,"children":490},{},[491,497,498],{"type":63,"tag":85,"props":492,"children":494},{"className":493},[],[495],{"type":69,"value":496},"RAW",{"type":69,"value":260},{"type":63,"tag":85,"props":499,"children":501},{"className":500},[],[502],{"type":69,"value":503},"CUSTOM",{"type":63,"tag":245,"props":505,"children":506},{},[507],{"type":69,"value":508},"Extension points",{"type":63,"tag":203,"props":510,"children":512},{"id":511},"convenience-chunk-events",[513],{"type":69,"value":514},"Convenience Chunk Events",{"type":63,"tag":79,"props":516,"children":517},{},[518,524,526,532,534,540],{"type":63,"tag":85,"props":519,"children":521},{"className":520},[],[522],{"type":69,"value":523},"TEXT_MESSAGE_CHUNK",{"type":69,"value":525}," and ",{"type":63,"tag":85,"props":527,"children":529},{"className":528},[],[530],{"type":69,"value":531},"TOOL_CALL_CHUNK",{"type":69,"value":533}," auto-expand into Start\u002FContent\u002FEnd triads via the client's ",{"type":63,"tag":85,"props":535,"children":537},{"className":536},[],[538],{"type":69,"value":539},"transformChunks",{"type":69,"value":541}," pipeline. Use these for simpler backend implementations.",{"type":63,"tag":203,"props":543,"children":545},{"id":544},"sse-wire-format",[546],{"type":69,"value":547},"SSE Wire Format",{"type":63,"tag":79,"props":549,"children":550},{},[551],{"type":69,"value":552},"Each event is a JSON object sent as an SSE data line:",{"type":63,"tag":554,"props":555,"children":559},"pre",{"className":556,"code":558,"language":69},[557],"language-text","data: {\"type\":\"RUN_STARTED\",\"threadId\":\"t1\",\"runId\":\"r1\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_START\",\"messageId\":\"m1\",\"role\":\"assistant\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_CONTENT\",\"messageId\":\"m1\",\"delta\":\"Hello\"}\\n\\n\ndata: {\"type\":\"TEXT_MESSAGE_END\",\"messageId\":\"m1\"}\\n\\n\ndata: {\"type\":\"RUN_FINISHED\",\"threadId\":\"t1\",\"runId\":\"r1\"}\\n\\n\n",[560],{"type":63,"tag":85,"props":561,"children":563},{"__ignoreMap":562},"",[564],{"type":69,"value":558},{"type":63,"tag":203,"props":566,"children":568},{"id":567},"packages",[569],{"type":69,"value":570},"Packages",{"type":63,"tag":210,"props":572,"children":573},{},[574,594],{"type":63,"tag":214,"props":575,"children":576},{},[577],{"type":63,"tag":218,"props":578,"children":579},{},[580,585,590],{"type":63,"tag":222,"props":581,"children":582},{},[583],{"type":69,"value":584},"Package",{"type":63,"tag":222,"props":586,"children":587},{},[588],{"type":69,"value":589},"npm",{"type":63,"tag":222,"props":591,"children":592},{},[593],{"type":69,"value":236},{"type":63,"tag":238,"props":595,"children":596},{},[597,619,641],{"type":63,"tag":218,"props":598,"children":599},{},[600,609,614],{"type":63,"tag":245,"props":601,"children":602},{},[603],{"type":63,"tag":85,"props":604,"children":606},{"className":605},[],[607],{"type":69,"value":608},"@ag-ui\u002Fcore",{"type":63,"tag":245,"props":610,"children":611},{},[612],{"type":69,"value":613},"Events, types, schemas",{"type":63,"tag":245,"props":615,"children":616},{},[617],{"type":69,"value":618},"Protocol definition",{"type":63,"tag":218,"props":620,"children":621},{},[622,631,636],{"type":63,"tag":245,"props":623,"children":624},{},[625],{"type":63,"tag":85,"props":626,"children":628},{"className":627},[],[629],{"type":69,"value":630},"@ag-ui\u002Fclient",{"type":63,"tag":245,"props":632,"children":633},{},[634],{"type":69,"value":635},"AbstractAgent, HttpAgent, middleware, event application",{"type":63,"tag":245,"props":637,"children":638},{},[639],{"type":69,"value":640},"Client SDK",{"type":63,"tag":218,"props":642,"children":643},{},[644,653,658],{"type":63,"tag":245,"props":645,"children":646},{},[647],{"type":63,"tag":85,"props":648,"children":650},{"className":649},[],[651],{"type":69,"value":652},"@ag-ui\u002Fencoder",{"type":63,"tag":245,"props":654,"children":655},{},[656],{"type":69,"value":657},"EventEncoder (SSE + protobuf)",{"type":63,"tag":245,"props":659,"children":660},{},[661],{"type":69,"value":662},"Server-side encoding",{"type":63,"tag":72,"props":664,"children":666},{"id":665},"workflow-building-an-ag-ui-backend",[667],{"type":69,"value":668},"Workflow: Building an AG-UI Backend",{"type":63,"tag":670,"props":671,"children":672},"ol",{},[673,698,751,780,811],{"type":63,"tag":112,"props":674,"children":675},{},[676,682,684,690,692],{"type":63,"tag":677,"props":678,"children":679},"strong",{},[680],{"type":69,"value":681},"Define your endpoint",{"type":69,"value":683}," -- Accept POST with ",{"type":63,"tag":85,"props":685,"children":687},{"className":686},[],[688],{"type":69,"value":689},"RunAgentInput",{"type":69,"value":691}," body, respond with ",{"type":63,"tag":85,"props":693,"children":695},{"className":694},[],[696],{"type":69,"value":697},"text\u002Fevent-stream",{"type":63,"tag":112,"props":699,"children":700},{},[701,706,708,714,715,721,722,728,729,735,736,742,743,749],{"type":63,"tag":677,"props":702,"children":703},{},[704],{"type":69,"value":705},"Parse input",{"type":69,"value":707}," -- Extract ",{"type":63,"tag":85,"props":709,"children":711},{"className":710},[],[712],{"type":69,"value":713},"threadId",{"type":69,"value":260},{"type":63,"tag":85,"props":716,"children":718},{"className":717},[],[719],{"type":69,"value":720},"runId",{"type":69,"value":260},{"type":63,"tag":85,"props":723,"children":725},{"className":724},[],[726],{"type":69,"value":727},"messages",{"type":69,"value":260},{"type":63,"tag":85,"props":730,"children":732},{"className":731},[],[733],{"type":69,"value":734},"tools",{"type":69,"value":260},{"type":63,"tag":85,"props":737,"children":739},{"className":738},[],[740],{"type":69,"value":741},"state",{"type":69,"value":260},{"type":63,"tag":85,"props":744,"children":746},{"className":745},[],[747],{"type":69,"value":748},"context",{"type":69,"value":750}," from the request body",{"type":63,"tag":112,"props":752,"children":753},{},[754,759,761,766,768,773,775],{"type":63,"tag":677,"props":755,"children":756},{},[757],{"type":69,"value":758},"Emit events in order",{"type":69,"value":760}," -- ",{"type":63,"tag":85,"props":762,"children":764},{"className":763},[],[765],{"type":69,"value":258},{"type":69,"value":767}," first, then content events, then ",{"type":63,"tag":85,"props":769,"children":771},{"className":770},[],[772],{"type":69,"value":266},{"type":69,"value":774}," or ",{"type":63,"tag":85,"props":776,"children":778},{"className":777},[],[779],{"type":69,"value":273},{"type":63,"tag":112,"props":781,"children":782},{},[783,788,790,795,797,803,805],{"type":63,"tag":677,"props":784,"children":785},{},[786],{"type":69,"value":787},"Encode as SSE",{"type":69,"value":789}," -- Use ",{"type":63,"tag":85,"props":791,"children":793},{"className":792},[],[794],{"type":69,"value":652},{"type":69,"value":796},"'s ",{"type":63,"tag":85,"props":798,"children":800},{"className":799},[],[801],{"type":69,"value":802},"EventEncoder.encode()",{"type":69,"value":804}," or manually write ",{"type":63,"tag":85,"props":806,"children":808},{"className":807},[],[809],{"type":69,"value":810},"data: JSON\\n\\n",{"type":63,"tag":112,"props":812,"children":813},{},[814,819,821,826],{"type":63,"tag":677,"props":815,"children":816},{},[817],{"type":69,"value":818},"Handle tool results",{"type":69,"value":820}," -- Client sends ",{"type":63,"tag":85,"props":822,"children":824},{"className":823},[],[825],{"type":69,"value":366},{"type":69,"value":827}," back; agent processes and continues",{"type":63,"tag":79,"props":829,"children":830},{},[831,833,839],{"type":69,"value":832},"See ",{"type":63,"tag":85,"props":834,"children":836},{"className":835},[],[837],{"type":69,"value":838},"references\u002Fbuilding-agents.md",{"type":69,"value":840}," for a complete working example.",{"type":63,"tag":72,"props":842,"children":844},{"id":843},"key-protocol-rules",[845],{"type":69,"value":846},"Key Protocol Rules",{"type":63,"tag":108,"props":848,"children":849},{},[850,873,884,895,905,910],{"type":63,"tag":112,"props":851,"children":852},{},[853,855,860,862,867,868],{"type":69,"value":854},"Every run MUST start with ",{"type":63,"tag":85,"props":856,"children":858},{"className":857},[],[859],{"type":69,"value":258},{"type":69,"value":861}," and end with ",{"type":63,"tag":85,"props":863,"children":865},{"className":864},[],[866],{"type":69,"value":266},{"type":69,"value":774},{"type":63,"tag":85,"props":869,"children":871},{"className":870},[],[872],{"type":69,"value":273},{"type":63,"tag":112,"props":874,"children":875},{},[876,882],{"type":63,"tag":85,"props":877,"children":879},{"className":878},[],[880],{"type":69,"value":881},"TEXT_MESSAGE_CONTENT.delta",{"type":69,"value":883}," must be non-empty",{"type":63,"tag":112,"props":885,"children":886},{},[887,889],{"type":69,"value":888},"Tool call events are linked by ",{"type":63,"tag":85,"props":890,"children":892},{"className":891},[],[893],{"type":69,"value":894},"toolCallId",{"type":63,"tag":112,"props":896,"children":897},{},[898,903],{"type":63,"tag":85,"props":899,"children":901},{"className":900},[],[902],{"type":69,"value":395},{"type":69,"value":904}," uses RFC 6902 JSON Patch operations",{"type":63,"tag":112,"props":906,"children":907},{},[908],{"type":69,"value":909},"Multiple sequential runs are supported -- each must complete before the next starts",{"type":63,"tag":112,"props":911,"children":912},{},[913,915],{"type":69,"value":914},"Messages accumulate across runs; state continues unless reset by ",{"type":63,"tag":85,"props":916,"children":918},{"className":917},[],[919],{"type":69,"value":388},{"type":63,"tag":72,"props":921,"children":923},{"id":922},"references",[924],{"type":69,"value":925},"References",{"type":63,"tag":108,"props":927,"children":928},{},[929,940,950,961],{"type":63,"tag":112,"props":930,"children":931},{},[932,938],{"type":63,"tag":85,"props":933,"children":935},{"className":934},[],[936],{"type":69,"value":937},"references\u002Fprotocol-spec.md",{"type":69,"value":939}," -- Complete event type reference with schemas and examples",{"type":63,"tag":112,"props":941,"children":942},{},[943,948],{"type":63,"tag":85,"props":944,"children":946},{"className":945},[],[947],{"type":69,"value":838},{"type":69,"value":949}," -- Step-by-step guide to building AG-UI backends",{"type":63,"tag":112,"props":951,"children":952},{},[953,959],{"type":63,"tag":85,"props":954,"children":956},{"className":955},[],[957],{"type":69,"value":958},"references\u002Fevent-flow-diagrams.md",{"type":69,"value":960}," -- ASCII sequence diagrams for common flows",{"type":63,"tag":112,"props":962,"children":963},{},[964,970],{"type":63,"tag":85,"props":965,"children":967},{"className":966},[],[968],{"type":69,"value":969},"references\u002Fclient-sdk.md",{"type":69,"value":971}," -- @ag-ui\u002Fclient API reference",{"items":973,"total":1066},[974,991,999,1016,1028,1040,1052],{"slug":975,"name":975,"fn":976,"description":977,"org":978,"tags":979,"stars":26,"repoUrl":27,"updatedAt":990},"a2ui-renderer","render declarative agent UI surfaces","Render A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via \u003CCopilotKit a2ui={{ theme }}>. Auto-activates via \u002Finfo — do NOT manually pass renderActivityMessages. createA2UIMessageRenderer ships from @copilotkit\u002Freact-core\u002Fv2; low-level primitives (A2UIProvider, A2UIRenderer, createCatalog) ship from @copilotkit\u002Fa2ui-renderer. Covers theme customization, createSurface dedup, action-bridge try\u002Ffinally cleanup. Load when an agent emits A2UI operations (createSurface \u002F updateComponents \u002F updateDataModel), when wiring a2ui on CopilotRuntime, or when styling A2UI surfaces.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[980,981,984,987],{"name":9,"slug":8,"type":15},{"name":982,"slug":983,"type":15},"Design","design",{"name":985,"slug":986,"type":15},"Frontend","frontend",{"name":988,"slug":989,"type":15},"UI Components","ui-components","2026-07-12T08:06:36.722091",{"slug":4,"name":4,"fn":5,"description":6,"org":992,"tags":993,"stars":26,"repoUrl":27,"updatedAt":28},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[994,995,996,997,998],{"name":18,"slug":19,"type":15},{"name":21,"slug":22,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":24,"slug":25,"type":15},{"slug":1000,"name":1000,"fn":1001,"description":1002,"org":1003,"tags":1004,"stars":26,"repoUrl":27,"updatedAt":1015},"copilotkit-contribute","contribute to CopilotKit open-source project","Use when contributing to the CopilotKit open-source project — forking, cloning, setting up the monorepo, creating branches, running tests, and submitting pull requests against CopilotKit\u002FCopilotKit.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1005,1006,1009,1012],{"name":9,"slug":8,"type":15},{"name":1007,"slug":1008,"type":15},"Engineering","engineering",{"name":1010,"slug":1011,"type":15},"GitHub","github",{"name":1013,"slug":1014,"type":15},"Pull Requests","pull-requests","2026-07-12T08:06:30.102192",{"slug":1017,"name":1017,"fn":1018,"description":1019,"org":1020,"tags":1021,"stars":26,"repoUrl":27,"updatedAt":1027},"copilotkit-debug","diagnose and debug CopilotKit issues","Use when diagnosing CopilotKit issues -- runtime connectivity failures, agent not responding, streaming errors, tool execution problems, transcription failures, version mismatches, and AG-UI event tracing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1022,1023,1024],{"name":9,"slug":8,"type":15},{"name":24,"slug":25,"type":15},{"name":1025,"slug":1026,"type":15},"Observability","observability","2026-07-12T08:06:23.407872",{"slug":173,"name":173,"fn":1029,"description":1030,"org":1031,"tags":1032,"stars":26,"repoUrl":27,"updatedAt":1039},"build AI features with CopilotKit","Use when building AI-powered features with CopilotKit v2 -- adding chat interfaces, registering frontend tools, sharing application context with agents, handling agent interrupts, and working with the CopilotKit runtime.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1033,1034,1037,1038],{"name":18,"slug":19,"type":15},{"name":1035,"slug":1036,"type":15},"AI Context","ai-context",{"name":9,"slug":8,"type":15},{"name":985,"slug":986,"type":15},"2026-07-12T08:06:28.856644",{"slug":195,"name":195,"fn":1041,"description":1042,"org":1043,"tags":1044,"stars":26,"repoUrl":27,"updatedAt":1051},"integrate agent frameworks into CopilotKit applications","Use when wiring an external agent framework (LangGraph, CrewAI, PydanticAI, Mastra, ADK, LlamaIndex, Agno, Strands, Microsoft Agent Framework, or others) into a CopilotKit application via the AG-UI protocol.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1045,1046,1047,1048],{"name":18,"slug":19,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":1049,"slug":1050,"type":15},"Integrations","integrations","2026-07-12T08:06:32.560054",{"slug":1053,"name":1053,"fn":1054,"description":1055,"org":1056,"tags":1057,"stars":26,"repoUrl":27,"updatedAt":1065},"copilotkit-self-update","update CopilotKit agent skills","Use when the user wants to update, refresh, or reinstall the CopilotKit agent SKILLS (the SKILL.md files that teach this agent about CopilotKit). NOT for updating the CopilotKit codebase or project — this is specifically about refreshing the skills\u002Fknowledge this agent has loaded. Triggers on \"update copilotkit skills\", \"update skills\", \"refresh skills\", \"skills are stale\", \"skills are outdated\", \"get latest skills\", \"my copilotkit knowledge is wrong\", \"copilotkit APIs changed\", \"skills seem old\", \"wrong API names\", \"reinstall skills\", \"skills not working right\", \"update your copilotkit knowledge\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1058,1059,1062],{"name":9,"slug":8,"type":15},{"name":1060,"slug":1061,"type":15},"Documentation","documentation",{"name":1063,"slug":1064,"type":15},"Productivity","productivity","2026-07-12T08:06:31.345052",11,{"items":1068,"total":1189},[1069,1076,1084,1091,1097,1104,1111,1117,1128,1140,1155,1170],{"slug":975,"name":975,"fn":976,"description":977,"org":1070,"tags":1071,"stars":26,"repoUrl":27,"updatedAt":990},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1072,1073,1074,1075],{"name":9,"slug":8,"type":15},{"name":982,"slug":983,"type":15},{"name":985,"slug":986,"type":15},{"name":988,"slug":989,"type":15},{"slug":4,"name":4,"fn":5,"description":6,"org":1077,"tags":1078,"stars":26,"repoUrl":27,"updatedAt":28},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1079,1080,1081,1082,1083],{"name":18,"slug":19,"type":15},{"name":21,"slug":22,"type":15},{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":24,"slug":25,"type":15},{"slug":1000,"name":1000,"fn":1001,"description":1002,"org":1085,"tags":1086,"stars":26,"repoUrl":27,"updatedAt":1015},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1087,1088,1089,1090],{"name":9,"slug":8,"type":15},{"name":1007,"slug":1008,"type":15},{"name":1010,"slug":1011,"type":15},{"name":1013,"slug":1014,"type":15},{"slug":1017,"name":1017,"fn":1018,"description":1019,"org":1092,"tags":1093,"stars":26,"repoUrl":27,"updatedAt":1027},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1094,1095,1096],{"name":9,"slug":8,"type":15},{"name":24,"slug":25,"type":15},{"name":1025,"slug":1026,"type":15},{"slug":173,"name":173,"fn":1029,"description":1030,"org":1098,"tags":1099,"stars":26,"repoUrl":27,"updatedAt":1039},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1100,1101,1102,1103],{"name":18,"slug":19,"type":15},{"name":1035,"slug":1036,"type":15},{"name":9,"slug":8,"type":15},{"name":985,"slug":986,"type":15},{"slug":195,"name":195,"fn":1041,"description":1042,"org":1105,"tags":1106,"stars":26,"repoUrl":27,"updatedAt":1051},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1107,1108,1109,1110],{"name":18,"slug":19,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":1049,"slug":1050,"type":15},{"slug":1053,"name":1053,"fn":1054,"description":1055,"org":1112,"tags":1113,"stars":26,"repoUrl":27,"updatedAt":1065},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1114,1115,1116],{"name":9,"slug":8,"type":15},{"name":1060,"slug":1061,"type":15},{"name":1063,"slug":1064,"type":15},{"slug":184,"name":184,"fn":1118,"description":1119,"org":1120,"tags":1121,"stars":26,"repoUrl":27,"updatedAt":1127},"set up CopilotKit in projects","Use when adding CopilotKit to an existing project or bootstrapping a new CopilotKit project from scratch. Covers framework detection, package installation, runtime wiring, provider setup, and first working chat integration.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1122,1123,1124],{"name":9,"slug":8,"type":15},{"name":985,"slug":986,"type":15},{"name":1125,"slug":1126,"type":15},"Onboarding","onboarding","2026-07-12T08:06:25.534415",{"slug":1129,"name":1129,"fn":1130,"description":1131,"org":1132,"tags":1133,"stars":26,"repoUrl":27,"updatedAt":1139},"copilotkit-upgrade","migrate CopilotKit applications to v2","Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1134,1135,1136],{"name":9,"slug":8,"type":15},{"name":1007,"slug":1008,"type":15},{"name":1137,"slug":1138,"type":15},"Migration","migration","2026-07-12T08:06:26.949801",{"slug":1141,"name":1141,"fn":1142,"description":1143,"org":1144,"tags":1145,"stars":26,"repoUrl":27,"updatedAt":1154},"react-core","integrate CopilotKit into React applications","@copilotkit\u002Freact-core — mount the CopilotKit provider (from @copilotkit\u002Freact-core\u002Fv2) in a Next.js App Router \u002F React Router v7 \u002F TanStack Start \u002F SPA app, drop in CopilotChat\u002FCopilotPopup\u002FCopilotSidebar (v2 chat components ship from react-core\u002Fv2 — NOT react-ui, which is CSS-only in v2), access and subscribe to agents with useAgent \u002F useAgentContext \u002F useCapabilities, switch between multiple agents, manage durable Intelligence threads with useThreads, register browser-side tools via useFrontendTool, render tool calls with useRenderTool \u002F useComponent \u002F useDefaultRenderTool, gate execution with useHumanInTheLoop, wire file attachments with useAttachments, configure suggestion pills, and register activity- and custom-message renderers. publicLicenseKey is canonical (publicApiKey is deprecated alias). Load the reference under references\u002F that matches your task.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1146,1147,1148,1151,1153],{"name":9,"slug":8,"type":15},{"name":985,"slug":986,"type":15},{"name":1149,"slug":1150,"type":15},"Next.js","next-js",{"name":1152,"slug":47,"type":15},"React",{"name":988,"slug":989,"type":15},"2026-07-12T08:06:15.72619",{"slug":1156,"name":1156,"fn":1157,"description":1158,"org":1159,"tags":1160,"stars":26,"repoUrl":27,"updatedAt":1169},"runtime","mount and configure CopilotRuntime servers","@copilotkit\u002Fruntime — mount a fetch-native CopilotRuntime on any JS server, wire middleware, pick an AgentRunner, instantiate BuiltInAgent (Factory Mode with TanStack AI is the preferred default) or plug in any of 12 external agent frameworks (Mastra, LangGraph, CrewAI Crews\u002FFlows, PydanticAI, ADK, LlamaIndex, Agno, AWS Strands, MS Agent Framework, AG2, A2A), enable Intelligence mode for durable threads + websocket, register server-side tools via defineTool, and wire voice transcription. Uses the fetch-based createCopilotRuntimeHandler primitive — the Express\u002FHono adapters are discouraged. Load the reference under references\u002F that matches your task.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1161,1162,1163,1166],{"name":13,"slug":14,"type":15},{"name":9,"slug":8,"type":15},{"name":1164,"slug":1165,"type":15},"JavaScript","javascript",{"name":1167,"slug":1168,"type":15},"Middleware","middleware","2026-07-12T08:06:10.034875",{"slug":1171,"name":1172,"fn":1173,"description":1174,"org":1175,"tags":1176,"stars":1186,"repoUrl":1187,"updatedAt":1188},"advanced-visualization-techniques","Advanced Visualization Techniques","create advanced generative UI visualizations","UI mockups, dashboards, advanced interactivity, generative art, simulations, math visualizations, and design system rules for producing rich generateSandboxedUi output.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1177,1180,1181,1182,1185],{"name":1178,"slug":1179,"type":15},"Dashboards","dashboards",{"name":982,"slug":983,"type":15},{"name":985,"slug":986,"type":15},{"name":1183,"slug":1184,"type":15},"Generative Art","generative-art",{"name":988,"slug":989,"type":15},1440,"https:\u002F\u002Fgithub.com\u002FCopilotKit\u002FOpenGenerativeUI","2026-07-12T08:06:40.712754",14]