mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
23af69041c
Migrate 15 example integrations from the v1 compatibility facade to native v2 CopilotKit APIs. The v1 surface delegates to v2 internally so this is an API surface change, not a functional one. Key changes per integration: - Import paths: @copilotkit/react-core -> react-core/v2, @copilotkit/runtime -> runtime/v2 - Hook renames: useCoAgent -> useAgent, useCopilotAction -> useFrontendTool, useRenderToolCall -> useRenderTool - UI: CopilotSidebar from react-ui -> react-core/v2 - Styles: react-ui/styles.css -> react-core/v2/styles.css - Runtime: copilotRuntimeNextJSAppRouterEndpoint -> createCopilotEndpoint + hono/vercel - Removed @copilotkit/react-ui and @copilotkit/shared deps Integrations migrated (v1 -> v2): a2a-middleware, adk, agno, crewai-crews, crewai-flows, langgraph-js, llamaindex, mastra, ms-agent-framework-dotnet, ms-agent-framework-python, pydantic-ai, strands-python Mixed integrations cleaned up (stale deps removed): agent-spec, agentcore, langgraph-fastapi, langgraph-python, langgraph-python-threads
33 lines
827 B
TypeScript
33 lines
827 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,
|
|
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);
|