Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
serverExternalPackages: ["@copilotkit/runtime"],
};

export default nextConfig;
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
Expand Down
22 changes: 11 additions & 11 deletions src/app/api/copilotkit/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
};
Loading