CopilotKit
React component library for building AI copilot experiences with in-app chat, context awareness, and agent integration. CopilotKit provides ready-made React components and hooks that let you embed AI assistants directly into your application, with the ability to read app state, take actions, and interact with LangGraph or other agent backends.
Architecture Overview
CopilotKit uses a client-server architecture. On the client side, React components (CopilotSidebar, CopilotPopup, CopilotTextarea) connect to a CopilotProvider that manages state and communication. The useCopilotReadable hook exposes app state to the AI, while useCopilotAction defines actions the AI can take. The server-side CopilotRuntime handles LLM communication and can connect to agent backends like LangGraph via the CoAgents protocol.
When to Use CopilotKit
- In-app AI copilots and assistants
- React-based AI chat interfaces
- Context-aware AI that understands application state
- AI-powered form filling and text generation
- Agent-backed interactive dashboards
Strengths & Weaknesses
Strengths
- Production-ready React components out of the box
- Deep application context integration via hooks
- Built-in CoAgents protocol for backend agent connectivity
- Excellent developer experience with TypeScript
- Supports both chat and inline AI experiences
Weaknesses
- Limited framework support (React and Angular; no Vue or Svelte)
- Frontend-focused; requires separate backend agent setup
- Less suited for non-web or headless agent applications
Quick Start
import { CopilotKit } from "@copilotkit/react-core";
import { CopilotSidebar } from "@copilotkit/react-ui";
import { useCopilotReadable, useCopilotAction } from "@copilotkit/react-core";
function App() {
return (
<CopilotKit runtimeUrl="/api/copilotkit">
<CopilotSidebar>
<TodoApp />
</CopilotSidebar>
</CopilotKit>
);
}
function TodoApp() {
const [todos, setTodos] = React.useState<string[]>([]);
// Expose app state to the AI
useCopilotReadable({
description: "The current todo list",
value: todos,
});
// Define an action the AI can take
useCopilotAction({
name: "addTodo",
description: "Add a new todo item to the list",
parameters: [
{ name: "todo", type: "string", description: "The todo text" },
],
handler: async ({ todo }) => {
setTodos((prev) => [...prev, todo]);
},
});
return (
<ul>
{todos.map((t, i) => <li key={i}>{t}</li>)}
</ul>
);
}Features at a Glance
| Developer | CopilotKit |
| Language | TypeScript |
| License | MIT |
| GitHub Stars | 17k+ |
| MCP Support | No |
| Multi-Agent | No |
Notable Users
Resources
Explore Related Content
Tool Use & Function Calling
How agents interact with external tools, APIs, and services to take action in the real world.
GuideGetting Started with Agents
Your first steps into the world of AI agent development. Understand what agents are, how they work, and build your first one.
PatternReAct Pattern
Reasoning and Acting — the agent thinks step-by-step, then acts on its reasoning in iterative loops.