@@ -3,33 +3,33 @@ import {
33 ExperimentalEmptyAdapter ,
44 copilotRuntimeNextJSAppRouterEndpoint ,
55} from "@copilotkit/runtime" ;
6-
7- import { LangGraphAgent } from "@ag-ui/langgraph"
6+ import { LangGraphAgent } from "@copilotkit/runtime/langgraph" ;
87import { NextRequest } from "next/server" ;
9-
8+
109// 1. You can use any service adapter here for multi-agent support. We use
1110// the empty adapter since we're only using one agent.
1211const serviceAdapter = new ExperimentalEmptyAdapter ( ) ;
13-
12+
1413// 2. Create the CopilotRuntime instance and utilize the LangGraph AG-UI
1514// integration to setup the connection.
1615const runtime = new CopilotRuntime ( {
1716 agents : {
18- "sample_agent" : new LangGraphAgent ( {
19- deploymentUrl : process . env . LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123" ,
17+ sample_agent : new LangGraphAgent ( {
18+ deploymentUrl :
19+ process . env . LANGGRAPH_DEPLOYMENT_URL || "http://localhost:8123" ,
2020 graphId : "sample_agent" ,
2121 langsmithApiKey : process . env . LANGSMITH_API_KEY || "" ,
2222 } ) ,
23- }
23+ } ,
2424} ) ;
25-
25+
2626// 3. Build a Next.js API route that handles the CopilotKit runtime requests.
2727export const POST = async ( req : NextRequest ) => {
2828 const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint ( {
29- runtime,
29+ runtime,
3030 serviceAdapter,
3131 endpoint : "/api/copilotkit" ,
3232 } ) ;
33-
33+
3434 return handleRequest ( req ) ;
35- } ;
35+ } ;
0 commit comments