CopilotKit + Claude Agent SDK (Python)
Bring your Claude Agent SDK (Python) agentsinto any app
CopilotKit is an open-source framework that connects your app to Claude Agent SDK (Python) agents. Give your agents chat, generative UI, human-in-the-loop, AG-UI Streams, Automatic Learning and more.
QuickstartThe Claude Agent SDK and CopilotKit running together, in the React frontend. Every demo below is the same integration with one capability turned on.
Build with Claude Agent SDK (Python)
The Claude Agent SDK gives you the agent loop: tools, context handling, and a session that keeps its history. What it does not give you is the surface. Somewhere for the conversation to happen, a way to show the run while it is running, and a moment for a person to step in. Each capability below builds on something your agent already does.
Generative UI
Your agent calls tools and reports progress as it works. CopilotKit streams those calls to the browser and renders each one as a React component, instead of leaving the user with a spinner.
Human-in-the-loop
The agent calls an approval tool and waits for its result. CopilotKit resolves that tool from the browser once the user decides, and the same Claude run continues with the answer.
Shared state
Your session carries state across turns on the server. CopilotKit mirrors it into your app and back, so a user edit and an agent write land in the same place.
Chat surfaces, headless UI, frontend tools and multi-agent flows work with the Claude Agent SDK too. And more
Start building
Scaffold a new app with the CLI, or follow the quickstart to connect the Claude Agent SDK (Python) agent you already run.
npx copilotkit@latest init --framework claude-sdk-pythonConnect your agent
Your agent keeps running as its own Python service, with the AG-UI adapter from ag_ui_claude_sdk in front of it. CopilotKit reaches that service over HTTP, so nothing inside the agent changes.
import {
CopilotRuntime,
createCopilotRuntimeHandler,
} from "@copilotkit/runtime/v2";
import { HttpAgent } from "@ag-ui/client";
const runtime = new CopilotRuntime({
agents: {
my_agent: new HttpAgent({ url: process.env.AGENT_URL! }),
},
});
const handler = createCopilotRuntimeHandler({
runtime,
basePath: "/api/copilotkit",
});
export const GET = handler;
export const POST = handler;How is this guide?