diff --git a/next.config.ts b/next.config.ts index e9ffa30..cdccab6 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + serverExternalPackages: ["@copilotkit/runtime"], }; export default nextConfig; diff --git a/package.json b/package.json index 8b7df59..ac0b793 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,12 @@ "postinstall": "npm run install:agent" }, "dependencies": { - "@ag-ui/langgraph": "0.0.18", - "@copilotkit/react-core": "1.10.6", - "@copilotkit/react-ui": "1.10.6", - "@copilotkit/runtime": "1.10.6", - "next": "16.0.1", - "react": "^19.2.0", - "react-dom": "^19.2.0", + "@copilotkit/react-core": "1.50.0", + "@copilotkit/react-ui": "1.50.0", + "@copilotkit/runtime": "1.50.0", + "next": "16.0.8", + "react": "^19.2.1", + "react-dom": "^19.2.1", "zod": "^3.24.4" }, "devDependencies": { @@ -32,7 +31,7 @@ "@types/react-dom": "^19", "concurrently": "^9.1.2", "eslint": "^9", - "eslint-config-next": "16.0.1", + "eslint-config-next": "16.0.7", "tailwindcss": "^4", "typescript": "^5" } diff --git a/src/app/api/copilotkit/route.ts b/src/app/api/copilotkit/route.ts index 4c98186..ab33e70 100644 --- a/src/app/api/copilotkit/route.ts +++ b/src/app/api/copilotkit/route.ts @@ -3,33 +3,33 @@ import { ExperimentalEmptyAdapter, copilotRuntimeNextJSAppRouterEndpoint, } from "@copilotkit/runtime"; - -import { LangGraphAgent } from "@ag-ui/langgraph" +import { LangGraphAgent } from "@copilotkit/runtime/langgraph"; import { NextRequest } from "next/server"; - + // 1. You can use any service adapter here for multi-agent support. We use // the empty adapter since we're only using one agent. const serviceAdapter = new ExperimentalEmptyAdapter(); - + // 2. Create the CopilotRuntime instance and utilize the LangGraph AG-UI // integration to setup the connection. const runtime = new CopilotRuntime({ agents: { - "sample_agent": new LangGraphAgent({ - deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123", + sample_agent: new LangGraphAgent({ + deploymentUrl: + process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123", graphId: "sample_agent", langsmithApiKey: process.env.LANGSMITH_API_KEY || "", }), - } + }, }); - + // 3. Build a Next.js API route that handles the CopilotKit runtime requests. export const POST = async (req: NextRequest) => { const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({ - runtime, + runtime, serviceAdapter, endpoint: "/api/copilotkit", }); - + return handleRequest(req); -}; \ No newline at end of file +};