mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
8c26e30fba
Each starter gets a Dockerfile, entrypoint.sh, and .dockerignore. Docker-specific adaptations only — original code untouched: - HOSTNAME=0.0.0.0 for Next.js standalone - PORT override for Python agents (Railway sets PORT=3000) - uv sync --frozen for exact dep resolution from lockfiles - serve.py + docker-route-override.ts for LangGraph starters (langgraph-cli dev needs Docker-in-Docker, unavailable on Railway) - next.config.ts: ignoreBuildErrors for HttpAgent type mismatch - Mastra: workingMemory scope: thread for standalone deploy - CVE fix: patch package.json to next@15.3.8 at deploy time
32 lines
911 B
TypeScript
32 lines
911 B
TypeScript
/**
|
|
* 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,
|
|
ExperimentalEmptyAdapter,
|
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
} from "@copilotkit/runtime";
|
|
import { HttpAgent } from "@ag-ui/client";
|
|
import { NextRequest } from "next/server";
|
|
|
|
const agentUrl = process.env.AGENT_URL || "http://localhost:8123";
|
|
|
|
const defaultAgent = new HttpAgent({
|
|
url: `${agentUrl}/`,
|
|
});
|
|
|
|
export const POST = async (req: NextRequest) => {
|
|
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
|
|
endpoint: "/api/copilotkit",
|
|
serviceAdapter: new ExperimentalEmptyAdapter(),
|
|
runtime: new CopilotRuntime({
|
|
agents: { default: defaultAgent },
|
|
}),
|
|
});
|
|
|
|
return handleRequest(req);
|
|
};
|