CopilotKit
TL;DR
CopilotKit is an MIT-licensed frontend framework from the company that created the AG-UI protocol. Its React, Angular, Vue and React Native SDKs and a server runtime connect a user interface to agents built with LangGraph, CrewAI, Mastra, Google ADK, Pydantic AI and others. It suits teams adding agent chat, generative UI and approvals to an app.
Key facts
| Type | Framework |
|---|---|
| Languages / SDKs | TypeScript, Python |
| License | MIT |
| Pricing model | Open core |
| Orchestration pattern | Other |
| GitHub stars | 37,612 (as of 2026-09-30) |
| GitHub forks | 4,671 |
| Last push | 2026-09-30 |
| Latest release | v1.75.1 |
| Repository | CopilotKit/CopilotKit |
| Website | www.copilotkit.ai |
| Documentation | docs.copilotkit.ai |
| Last verified | 2026-09-30 |
Key features
- Three layers: a frontend SDK, a runtime request handler mounted in your own server (Next.js, Express, Hono, Bun, Deno or Cloudflare Workers), and an agent backend, connected by the AG-UI event stream. (source)
- Prebuilt chat components (CopilotChat, CopilotSidebar, CopilotPopup) plus headless APIs for fully custom interfaces. (source)
- Agent backends connect through AG-UI; documented integrations include LangGraph, Google ADK, Mastra, CrewAI, Pydantic AI, Claude Agent SDK, Agno, AG2, LlamaIndex, AWS Strands, Microsoft Agent Framework and Deep Agents. (source)
- BuiltInAgent runs an in-process agent loop against OpenAI, Anthropic, Google or any AI SDK model when no external framework is used. (source)
- The useAgent hook exposes the agent connection directly, so components can read and update the agent's shared state. (source)
- Two human-in-the-loop patterns: useHumanInTheLoop, where the model calls a client-side tool that renders a component and returns the user's answer, and useInterrupt for graph-enforced pauses in LangGraph agents. (source)
- MCP Apps servers render their UI resources as sandboxed components in the chat when the agent calls their tools, configured through the runtime's mcpApps option. (source)
- A2A agents can be exposed to the frontend by wrapping an AG-UI orchestrator agent with the A2A middleware, which gives the orchestrator a tool for messaging A2A agents. (source)
Architecture and orchestration pattern
Pattern: Other
CopilotKit is a frontend and middleware layer, not an agent framework. A request goes from a framework-native frontend SDK to the Copilot Runtime, a handler you mount in your own application server; the runtime handles authentication and tool calls and opens an AG-UI session with the configured agent, which streams text, tool calls and state events back through the runtime to the UI. When the agent calls a frontend tool, the runtime relays it to a browser handler and returns the result to the agent.
The runtime holds a map of named agents, either CopilotKit's BuiltInAgent or remote AG-UI endpoints (HttpAgent) and framework adapters, and the frontend picks one by that key. Multi-agent coordination happens inside whichever framework you connect; CopilotKit renders the result. For A2A, the documented pattern wraps an AG-UI orchestrator agent in A2AMiddlewareAgent, which injects a tool the orchestrator uses to message the listed A2A agents.
Shared state lives in the agent and is synchronised to the UI through AG-UI state events and useAgent. In the open-source packages, conversation persistence is yours to run (for example LangGraph checkpointers or ADK sessions). The paid CopilotKit Intelligence service, cloud-hosted or self-hosted on Kubernetes or AWS ECS, adds AG-UI Streams (saved threads and resumable runs), user memories, automatic learning, analytics and Slack/Teams channels.
Human in the loop
CopilotKit documents two ways to pause an agent for a person. With useHumanInTheLoop, the frontend registers a tool with a schema and a render function; when the model calls it, the chat shows your component (for example an approve button or a picker) and respond sends the user's answer back as the tool result, after which the agent continues. With useInterrupt, a LangGraph agent calls interrupt(...) in a node and the frontend renders a component for that checkpoint before the graph resumes. The docs also recommend pairing tool renderers with approval for irreversible MCP actions, and the Channels product carries approvals into Slack and Microsoft Teams.
Protocols
| Protocol | Support | Note |
|---|---|---|
| MCP | Yes evidence | Client: the docs show connecting MCP servers to a CopilotKit app and rendering their tool calls; MCP Apps UI resources render through the runtime's mcpApps option, which uses @ag-ui/mcp-apps-middleware (pinned at 0.0.3, no per-tool filtering). |
| A2A | Partial evidence | Indirect: A2A agents are reached through @ag-ui/a2a-middleware from the AG-UI repository, wrapped around an AG-UI orchestrator agent; no A2A client code ships in CopilotKit's own packages, although the docs describe it as full support. |
| AG-UI | Yes evidence | Consumer side: CopilotKit's runtime and frontend packages speak AG-UI to agent backends, built on @ag-ui/client and @ag-ui/core (pinned at 0.0.59, a pre-1.0 line, in @copilotkit/runtime 1.75.1); the AG-UI README lists CopilotKit as a first-party client. |
Best for
- React or Next.js apps that need an agent chat, generative UI and shared state with an existing agent backend. (shortlist)
- Teams that may switch agent frameworks and want the UI to stay the same, since backends plug in through AG-UI.
- Approval and input steps rendered as custom components inside the chat.
- Showing one agent in a web app and in Slack or Microsoft Teams through the Channels SDK.
Not for
- Building agent orchestration logic itself; CopilotKit relies on the connected framework for multi-agent control.
- Projects that need saved threads, memories or analytics without running CopilotKit Intelligence or their own persistence.
- Backends without an AG-UI endpoint or adapter.
Quickstart
npm install @copilotkit/react-core @copilotkit/runtime // app/api/copilotkit/[[...slug]]/route.ts (Next.js; also: npm install @ag-ui/client)
import { CopilotRuntime, createCopilotRuntimeHandler } from "@copilotkit/runtime/v2";
import { HttpAgent } from "@ag-ui/client";
// Two AG-UI agent servers you run, e.g. LangGraph and Google ADK.
// The map keys are the only names the frontend can ask for.
const runtime = new CopilotRuntime({
agents: {
researcher: new HttpAgent({ url: "http://localhost:8000/" }),
writer: new HttpAgent({ url: "http://localhost:8001/" }),
},
});
const handler = createCopilotRuntimeHandler({ runtime, basePath: "/api/copilotkit" });
export const GET = handler;
export const POST = handler;
// Client side: wrap the app in <CopilotKitProvider runtimeUrl="/api/copilotkit">
// and render <CopilotChat agentId="researcher" /> from "@copilotkit/react-core/v2".
Common pitfalls
- Needs Node.js 20 or later. The v2 APIs live under
@copilotkit/react-core/v2and@copilotkit/runtime/v2; import the stylesheet from@copilotkit/react-core/v2/styles.css. BuiltInAgentis CopilotKit's own agent: registering it asdefaultreplaces, rather than connects, an agent you already have. Use your framework's quickstart for runtime wiring.- The frontend addresses agents only by the keys of the runtime's
agentsmap, not by the agent's own name. - A relative
runtimeUrlworks only when the same server hosts the app and the runtime; client-only frontends need a standalone runtime and an absolute URL. - The runtime pins
@ag-ui/mcp-apps-middleware0.0.3, soincludeTools/excludeToolsraise a configuration error. npx copilotkit@latest createscaffolds a new project; it does not modify an existing app.
Pros
- The open-source SDKs and runtime work without any CopilotKit service and are MIT-licensed. (source)
- Agent backends can be swapped through runtime configuration because every integration speaks AG-UI. (source)
- The runtime mounts inside your own server, so the only thing between UI and agent is an inspectable event stream. (source)
- Frontend SDKs cover React/Next.js (GA), Angular, Vue and React Native, plus Slack and Microsoft Teams via Channels. (source)
- Human-in-the-loop can be model-initiated (a frontend tool) or graph-enforced (LangGraph interrupts). (source)
Cons
- Saved threads with resumable runs, user memories, automatic learning, analytics and hosted channels require the paid CopilotKit Intelligence service or its self-hosted edition. (source)
- The runtime in v1.75.1 depends on pre-1.0 AG-UI packages (@ag-ui/client 0.0.59) even though AG-UI 1.0 has been released. (source)
- The pinned MCP Apps middleware (0.0.3) does not support per-tool include or exclude filters. (source)
- The useInterrupt pattern depends on LangGraph's interrupt(); other frameworks use the tool-based pattern. (source)
- Vue has no published quickstart yet, and managed connections for Discord, WhatsApp and Telegram are still listed as coming soon. (source)
Alternatives
FAQ
How is CopilotKit related to AG-UI?
CopilotKit's team created the AG-UI protocol, and CopilotKit uses it as the wire format between its runtime and agent backends. AG-UI is the open protocol; CopilotKit is one frontend framework that speaks it.
Which agent frameworks does CopilotKit connect to?
Any backend with an AG-UI endpoint. The docs include integrations for LangGraph (Python, TypeScript, FastAPI), Google ADK, Mastra, CrewAI, Pydantic AI, Claude Agent SDK, Agno, AG2, LlamaIndex, AWS Strands, Microsoft Agent Framework and Deep Agents, plus CopilotKit's own BuiltInAgent.
Does CopilotKit support MCP and A2A?
MCP yes: MCP servers can be connected and MCP Apps render as UI in the chat. A2A partially: it works through an AG-UI middleware from the AG-UI repository that lets an orchestrator agent message A2A agents.
Is CopilotKit free?
The SDKs and runtime are MIT-licensed and free. CopilotKit Intelligence has a free Developer tier and paid Pro ($39/month) and Team ($100 per seat per month) plans, with Enterprise on request.
Does CopilotKit work with Claude Code or Codex?
Only as a development aid: CopilotKit publishes agent skills and a documentation MCP server that coding agents such as Claude Code and Codex can load while you build. CopilotKit does not run or drive those agents.
Sources
- CopilotKit GitHub repository
- CopilotKit homepage
- CopilotKit documentation
- README
- LICENSE (MIT)
- CopilotKit pricing
- Architecture
- AG-UI integration
- Agentic protocols overview
- MCP
- A2A
- MCP Apps
- Open source vs Intelligence
- Human-in-the-loop
- Quickstart
- Copilot Runtime
- Programmatic control (useAgent)
- Generative UI overview
- CopilotKit Intelligence overview
- Build with coding agents
- @copilotkit/runtime package.json
- AG-UI README (integration list)
- CopilotKit docs index (llms.txt)