Got it:
const runtime = new CopilotRuntime({
//////////////////// This was missing ////////////////////
remoteEndpoints: [
langGraphPlatformEndpoint({
deploymentUrl: process.env.LANGGRAPH_DEPLOYMENT_URL || "",
langsmithApiKey: process.env.LANGSMITH_API_KEY || "", // only used in LangGraph Platform deployments
agents: [
{
name: process.env.COPILOTKIT_AGENT_NAME || "",
description:
process.env.COPILOTKIT_AGENT_DESCRIPTION || "A helpful LLM agent.",
},
],
}),
],
//////////////////////////////////////////////////////////
actions: [
{
name: "sayHello",
description: "say hello so someone by roasting their name",
parameters: [
{
name: "roast",
description: "A sentence or two roasting the name of the person",
type: "string",
required: true,
},
],
handler: ({ roast }: { roast: string }) => {
console.log(roast);
return "The person has been roasted.";
},
},
],
});
Looking at the NextJS application, I saw we were indeed missing something that says where the LangGraph agent is.
This was what I was asking before "I cannot understand how the self-hosted server is supposed to connect to my Langgraph setup"
In the ExpressJS example, this code isn't missing, so I am still at a loss regarding how the self-hosted CopilotKit runtime knows where to find the LangGraph agent...
Until I added this, I could not connect to my agent via the runtimeUrl/self-hosted CopilotKit runtime