Back to Copilotkit

Channels Agent Setup

showcase/integrations/ag2/docs/setup/channels-agent-setup.mdx

1.64.2689 B
Original Source

Follow the AG2 quickstart to clone and configure the weather agent, then start the same AG-UI server:

bash
uv run python weather.py

The quickstart mounts the AG2 agent at:

dotenv
AGENT_URL=http://localhost:8000/weather

Install the HTTP adapter in the Channels process:

bash
npm install @ag-ui/[email protected]

Create a new HTTP adapter for every channel thread:

ts
import { HttpAgent } from "@ag-ui/client";

export function makeAgent(threadId: string) {
  const agent = new HttpAgent({ url: process.env.AGENT_URL! });
  agent.threadId = threadId;
  return agent;
}