TypeScriptTypeScript

CopilotKit

by CopilotKitUpdated Jun 15, 2025

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

typescript
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

DeveloperCopilotKit
LanguageTypeScript
LicenseMIT
GitHub Stars17k+
MCP SupportNo
Multi-AgentNo

Notable Users

CopilotKitMintlifySupabase community

Resources

Explore Related Content