CopilotKit

01pattern 01 of 05

One surface. Agent and user, same state.

Chat is an input, not the product. Shared state lets your agent read and write the same surface your users work on. Sidebar chatbots summarize. Agent-native apps act — same canvas, same state, human in the loop.

New to CopilotKit? It's the open-source frontend stack for AI agents: you bring the agent, CopilotKit connects it to the people using your app. This page shows one of the five patterns it makes possible. What it is, in 30 seconds ↓

What CopilotKit is

Connect any agent to any user.

CopilotKit is the open-source frontend stack for AI agents: it puts an agent to work inside a real product, not in a chat window next to it. Bring the agent you have; reach the people where they already are.

any agent
Microsoft Agent FrameworkAWS StrandsGoogle ADKLangChain / LangGraphCrewAIAgnoClaude Agents SDKOpenAI Agents SDKMastraPydantic AILlamaIndexAG2
any user
iOSAndroidWebSMSiMessageTelegramWhatsAppSlackDiscordGoogle ChatMicrosoft Teams
01 · bring your agent

Any framework, unchanged

CopilotKit speaks AG-UI, the open protocol it created. The agent side stays yours.

02 · connect it to users

Inside your product

Hooks and components for every pattern on this site. This page is one of them.

03 · ship it safely

Production-ready runtime

Streaming, concurrency, retries, and state sync handled. Open source, 37,000+ GitHub stars.

In code
app/page.tsx
import { useAgent, UseAgentUpdate } from "@copilotkit/react-core/v2";

const { agent } = useAgent({
  agentId: "shared-state-read-write",
  updates: [UseAgentUpdate.OnStateChanged],
});

// READ — the UI re-renders whenever the agent writes state
const notes = agent.state?.notes ?? [];

// WRITE — every edit in your UI lands in agent state
agent.setState({ preferences: next, notes });
npm install @copilotkit/react-core @copilotkit/runtime
How it works
01

Subscribe

useAgent hands you the agent and re-renders your components on every state change it emits.

02

Read

Render from agent.state like any other prop. Notes the agent writes show up in your panels, not in a chat bubble.

03

Write

Call agent.setState from your UI. On its next turn the agent reads it back — your users steer the model without typing.

Building this?

Tell us in one click. We'll point you at the demo source, the right guide, and the people in the community shipping the same pattern — and skip everything else.

Got it.

We'll tailor what we send you from here. The fastest way to go deeper is the live demo above.

Other patterns