Back to Copilotkit

Channels Agent Setup

showcase/shell-docs/src/content/snippets/setup/deepagents/channels-agent-setup.mdx

1.64.2983 B
Original Source

Follow the Deep Agents quickstart and choose its Deep Agent deployment path. Both the Python and TypeScript examples export a sample_agent graph through LangGraph Server:

bash
npx @langchain/langgraph-cli dev --port 8123 --no-browser

Point the native LangGraph adapter at that deployment:

dotenv
LANGGRAPH_DEPLOYMENT_URL=http://localhost:8123

The Runtime package installed by the Channels quickstart includes the native LangGraph adapter.

Deep Agents compile to LangGraph graphs, so use LangGraphAgent rather than HttpAgent. Return a fresh adapter for every channel thread:

ts
import { LangGraphAgent } from "@copilotkit/runtime/langgraph";

export function makeAgent(threadId: string) {
  const agent = new LangGraphAgent({
    deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL!,
    graphId: "sample_agent",
  });
  agent.threadId = threadId;
  return agent;
}