CopilotKit is the open-source React UI and infrastructure framework for building AI Copilots, chatbots, and in-app AI agents. It enables developers to seamlessly integrate stateful, multi-step AI capabilities into their applications using headless hooks or pre-built components, abstracting away the complexity of backend AI infrastructure.
One-Minute Overview#
CopilotKit is a framework designed to build "Agentic Frontends" for React applications. It goes beyond simple chat interfaces, providing the infrastructure to create AI agents that can understand and manipulate application state. By using standard React Hooks and components, developers can build AI features that generate UI, execute frontend functions, and manage multi-step workflows with deep context awareness.
Core Value: Transform static React apps into AI-powered experiences where agents can perform actions and render components, not just chat.
Quick Start#
Installation Difficulty: Low - CLI tools provided for instant setup.
# Create a new project or integrate into an existing one
npx copilotkit@latest create
Is this suitable for me?
- ✅ React/Next.js Developers: If you are in the React ecosystem, this is the most seamless way to add AI capabilities.
- ✅ Deep Integration Needs: Ideal if you need AI to update state, modify forms, or trigger logic within your app, not just answer questions.
- ❌ Non-React Projects: The frontend components are tightly coupled with React. Integrating this into other frameworks would require significant rework.
Core Capabilities#
1. Stateful Agents (useAgent)#
The core Hook of CopilotKit, creating an AI agent bound directly to React state.
- Details: You can expose application state (e.g., selected city, form inputs) to the AI, allowing it to reason and update this state to drive the UI. User Value: Turns AI from a passive chatbot into an active agent that can operate the interface like a user.
2. Generative UI#
Enables AI to dynamically render React components based on context.
- Details: The AI can decide to "show a weather card" or "display a chart" and render the corresponding JSX automatically. User Value: Creates highly dynamic interfaces where the AI controls the layout and content, moving beyond text-based interaction.
3. Frontend Tool Use#
Allows AI to trigger frontend functions directly.
- Details: Define functions via
useFrontendTool(e.g., "Add row to spreadsheet"), and the AI can invoke them based on user intent. User Value: Automates complex workflows via natural language commands.
4. Human in the Loop#
Introduces approval steps for sensitive AI actions.
- Details: When an agent attempts an action (e.g., sending an email), the UI can pause and ask the user for confirmation before proceeding. User Value: Balances AI autonomy with user control and safety.
5. Headless & Pre-built UI#
- Details: Use
useAgentfor total control over the UI, or drop-in<CopilotSidebar>for instant functionality. User Value: Flexibility to ship fast with pre-built components or build completely custom designs.