CopilotKit
Type: full-code · Vendor: CopilotKit · Language: TypeScript · License: MIT · Status: active · Status in practice: emerging · First released: 2023
CopilotKit gives a web frontend the components and protocol to connect to an agent backend so the agent can stream text, render UI, share state, and pause for the user.
Description. CopilotKit is an open-source frontend stack for agent-powered user interfaces, built by the CopilotKit team. It supplies React components and hooks plus the AG-UI protocol, which carries events in both directions between the application and any agentic backend. Over that channel the agent streams responses, renders React components as tool output, syncs shared state with the page, and can pause execution to ask the user for input or approval.
Agent loop shape. A bidirectional event stream between frontend and agent: the application POSTs user input and state to the agent, and the agent emits a stream of typed events (text, tool calls, state deltas) over AG-UI. The agent's loop runs on the backend; CopilotKit drives the UI from the event stream and can send the agent back into the loop after a human responds.
Primary use cases
- in-app copilot and chat interfaces
- generative UI rendered from agent tool calls
- shared state between frontend and agent
- human-in-the-loop approval and confirmation flows
- connecting React/Angular/mobile frontends to agent backends
Key concepts
- AG-UI Protocol → bidirectional-impulse-channel (docs) — The open event protocol CopilotKit defines and maintains for connecting a user-facing application to any agentic backend; the agent and the app exchange typed events over it in both directions.
- useCopilotAction → generative-ui (docs) — A React hook that registers a frontend action the agent can call as a tool; the action can render a React component as its result, which is how generative UI reaches the page.
- useCopilotReadable → blackboard (docs) — A hook that exposes a slice of application state to the agent as readable context, so the agent reasons over what the user currently sees on the page.
- CoAgents → blackboard (docs) — CopilotKit's integration layer for agentic backends (LangGraph, CrewAI, and others) that streams the agent's intermediate state into the UI and syncs shared state between the running agent and the page.
Patterns this full-code implements —
- ★★Streaming Typed Events
AG-UI carries the agent run to the frontend as a stream of typed events (text-message, tool-call, state-delta, reasoning, and others), each delivered incrementally so the UI updates as the agent work…
- ·Bidirectional Impulse Channel
AG-UI is one event-streaming channel carrying both directions: the frontend POSTs user prompts/state into the agent and listens to the same SSE stream for the agent's text, tool calls and state delta…
- ★Generative UI
Agents render real React components in the chat by calling them as tools; CopilotKit lets the agent generate and update UI components at runtime based on user intent and agent state rather than retur…
- ★★Human-in-the-Loop
CopilotKit lets the agent pause its run and hand control to the user to request input, confirmation, or edits before continuing, then resumes the agent loop with the user's response over the AG-UI ch…
- ·Blackboard
CopilotKit's Shared State is a single synchronized state layer both the agent and the UI components read from and write to, so the page and the backend agent collaborate over the same workspace rathe…
Neighbourhood
Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.