diff --git a/web/agent/pyproject.toml b/web/agent/pyproject.toml index 39d5173..d12980c 100644 --- a/web/agent/pyproject.toml +++ b/web/agent/pyproject.toml @@ -16,5 +16,4 @@ dependencies = [ "docstring-parser>=0.17.0", "jsonschema>=4.25.1", "copilotkit>=0.1.0", - "ag-ui-langgraph>=0.0.4", ] diff --git a/web/agent/server.py b/web/agent/server.py index 260fd8f..bdcb7d0 100644 --- a/web/agent/server.py +++ b/web/agent/server.py @@ -1,5 +1,5 @@ """ -Self-hosted LangGraph agent server using CopilotKit AG-UI protocol. +Self-hosted LangGraph agent server using CopilotKit remote endpoint protocol. """ import os @@ -7,23 +7,24 @@ from fastapi import FastAPI import uvicorn from dotenv import load_dotenv -from copilotkit import LangGraphAGUIAgent -from ag_ui_langgraph import add_langgraph_fastapi_endpoint +from copilotkit import CopilotKitRemoteEndpoint, LangGraphAgent +from copilotkit.integrations.fastapi import add_fastapi_endpoint from main import graph load_dotenv() app = FastAPI(title="Cavepedia Agent") -add_langgraph_fastapi_endpoint( - app=app, - agent=LangGraphAGUIAgent( - name="vpi_1000", - description="AI assistant with access to cave-related information through the Cavepedia MCP server", - graph=graph, - ), - path="/", +sdk = CopilotKitRemoteEndpoint( + agents=[ + LangGraphAgent( + name="vpi_1000", + description="AI assistant with access to cave-related information through the Cavepedia MCP server", + graph=graph, + ) + ] ) +add_fastapi_endpoint(app, sdk, "/copilotkit") @app.get("/health") diff --git a/web/src/app/api/copilotkit/route.ts b/web/src/app/api/copilotkit/route.ts index 121ec29..9fe666d 100644 --- a/web/src/app/api/copilotkit/route.ts +++ b/web/src/app/api/copilotkit/route.ts @@ -11,7 +11,7 @@ const serviceAdapter = new ExperimentalEmptyAdapter(); const runtime = new CopilotRuntime({ remoteEndpoints: [ { - url: process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8000", + url: `${process.env.LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8000"}/copilotkit`, }, ], }); diff --git a/web/src/app/layout.tsx b/web/src/app/layout.tsx index 99db567..a05ecb9 100644 --- a/web/src/app/layout.tsx +++ b/web/src/app/layout.tsx @@ -19,7 +19,7 @@ export default function RootLayout({ - + {children}