mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
c9793b5e6e
Align langgraph-js with examples/integrations/langgraph-python via the parity tooling. Remove legacy app/ layout, adopt src/ layout, rewrite the TS agent to expose the tracked tool surface (manage_todos, get_todos, query_data, generate_a2ui, search_flights) and todos state, and write the canonical PROMPT.md. Keeps LangGraphAgent + stategraph runtime (allowed divergence per the manifest); brings deps, Dockerfile.app, entrypoint, showcase metadata, and shared UI into lockstep. Parity verifier: 88 ok / 0 error.
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);
|
|
};
|