self-host langgraph
Some checks failed
Build and Push Agent Docker Image / build (push) Successful in 1m7s
Build and Push Web Docker Image / build (push) Failing after 3m5s

This commit is contained in:
2025-12-13 00:05:06 +01:00
parent 0ff215c34f
commit 17802994a5
5 changed files with 43 additions and 33 deletions

View File

@@ -2,7 +2,6 @@ import {
CopilotRuntime,
ExperimentalEmptyAdapter,
copilotRuntimeNextJSAppRouterEndpoint,
LangGraphHttpAgent,
} from "@copilotkit/runtime";
import { NextRequest } from "next/server";
@@ -23,13 +22,17 @@ export const POST = async (req: NextRequest) => {
console.log("[copilotkit] session exists:", !!session);
console.log("[copilotkit] userRoles:", userRoles);
// 2. Create the CopilotRuntime instance with self-hosted agent
// 2. Create the CopilotRuntime instance with remote endpoint
const runtime = new CopilotRuntime({
agents: {
"vpi_1000": new LangGraphHttpAgent({
url: process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8000",
}),
}
remoteEndpoints: [
{
url: `${process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8000"}/copilotkit`,
},
],
// Pass auth context as properties to the remote endpoint
properties: {
auth0_user_roles: userRoles,
},
});
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({