Back to Copilotkit

Channels Agent Setup

showcase/integrations/crewai-crews/docs/setup/channels-agent-setup.mdx

1.64.2871 B
Original Source

Expose your CrewAI Crew through an AG-UI server. The CopilotKit CrewAI Crews showcase includes a reference server; from that integration directory, run:

bash
PYTHONPATH=src python -m uvicorn agent_server:app --host 0.0.0.0 --port 8000 --reload

The shared crew is mounted at the server root:

dotenv
AGENT_URL=http://localhost:8000/

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;
}