forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-route-override.ts
More file actions
32 lines (27 loc) · 827 Bytes
/
Copy pathdocker-route-override.ts
File metadata and controls
32 lines (27 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Docker-specific route override.
* In Docker, the agent is served via AG-UI (not LangGraph Platform)
* because langgraph-cli dev requires Docker-in-Docker.
* The original route.ts (using LangGraphAgent) is preserved unchanged.
*/
import {
CopilotRuntime,
InMemoryAgentRunner,
createCopilotEndpoint,
} from "@copilotkit/runtime/v2";
import { HttpAgent } from "@ag-ui/client";
import { handle } from "hono/vercel";
const agentUrl = process.env.AGENT_URL || "http://localhost:8123";
const defaultAgent = new HttpAgent({
url: `${agentUrl}/`,
});
const runtime = new CopilotRuntime({
agents: { default: defaultAgent },
runner: new InMemoryAgentRunner(),
});
const app = createCopilotEndpoint({
runtime,
basePath: "/api/copilotkit",
});
export const GET = handle(app);
export const POST = handle(app);