CopilotKit + LangGraph

Bring your LangGraph agentsinto any app

CopilotKit is an open-source framework that connects your app to LangGraph agents. Give your agents chat, generative UI, human-in-the-loop, AG-UI Streams, Automatic Learning and more.

Quickstart
Chat

Waking up the demo

Talk to your agent in a ready-made chat interface. Open in the showcase

LangGraph and CopilotKit running together, in the React frontend. Every demo below is the same integration with one capability turned on.

Build with LangGraph

LangGraph gives you the graph: nodes, edges, one state object, and interrupts that stop a run mid-node. 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 graph already does.

Generative UI

Your nodes return state updates and tool calls as they run. CopilotKit streams both to the browser by default and renders them as React components your users watch update while the graph works.

Human-in-the-loop

A node calls interrupt() and stops mid-execution. CopilotKit catches that event, renders your own UI for the decision, and resumes the graph with the answer.

Shared state

Your graph carries one state object from node to node. CopilotKit mirrors it into your app and back, so a user edit and a node write land in the same place.

Chat surfaces, headless UI, frontend tools and subagent flows work with LangGraph too. And more

Start building

Scaffold a new app with the CLI, or follow the quickstart to connect the LangGraph agent you already run.

npx copilotkit@latest init
Read the quickstart

Connect your agent

Your graph stays where it runs today: LangGraph Platform, LangSmith, or your own FastAPI service. CopilotKit reaches it over AG-UI, so nothing inside the graph changes.

app/api/copilotkit/[[...slug]]/route.ts
import { CopilotRuntime, createCopilotRuntimeHandler } from "@copilotkit/runtime/v2";
import { LangGraphAgent } from "@copilotkit/runtime/langgraph";

const runtime = new CopilotRuntime({
  agents: {
    sample_agent: new LangGraphAgent({
      deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL!,
      graphId: "sample_agent",
      langsmithApiKey: process.env.LANGSMITH_API_KEY!,
    }),
  },
});

const handler = createCopilotRuntimeHandler({
  runtime,
  basePath: "/api/copilotkit",
});

export const GET = handler;
export const POST = handler;
export const PATCH = handler;
export const DELETE = handler;
Read the setup guide

Already have LangGraph conversations?

When you add a user-facing app to an existing LangGraph agent, your users may need to open and continue conversations they already started. CopilotKit Intelligence can import supported LangGraph history as threads so your app does not start with an empty thread list.

The importer reads LangGraph Server, LangGraph Platform, or LangSmith Deployment thread and run APIs. For a FastAPI app with a durable checkpointer, export the threads first, then import the file. It does not import standalone LangChain message stores or LangSmith traces.

Import the history once. After that, runs that go through CopilotKit sync to Intelligence. LangGraph also keeps saving them, if your durable checkpointer or Platform deployment stays configured. This is not a continuous mirror of runs made outside CopilotKit.

Import and synchronize LangGraph threads for source setup, agent mapping, and thread continuity.

How is this guide?