A2UI Launched: Full CopilotKit support at launch!

A2UI Launched: CopilotKit has partnered with Google to deliver full support in both CopilotKit and AG-UI!

Check it out
LogoLogo
  • Overview
  • Integrations
  • API Reference
  • Copilot Cloud
Slanted end borderSlanted end border
Slanted start borderSlanted start border
Select integration...

Please select an integration to view the sidebar content.

Backend Actions & Agents

LangServe actions

Connect your CopilotKit application to LangChain chains hosted as separate services using LangServe.

Find your CopilotRuntime

The starting point for this section is the CopilotRuntime you set up during quickstart (the CopilotKit backend endpoint). For a refresher, see Self-Hosting (or alternatively, revisit the quickstart).

First, find your CopilotRuntime instance in your code. You can simply search your codebase for CopilotRuntime.

If you followed the quickstart, it'll be where you set up the /api/copilotkit endpoint.

Modify CopilotRuntime to include LangServe integration

Once you've located your CopilotRuntime, you can add LangServe integration by returning an array of LangServe function sources in the langserve property.

Note that the input and output types of the chain will be automatically fetched from LangServe -- no need to specify them manually!

Here's how to implement LangServe integration:

/api/copilotkit/route.ts
const runtime = new CopilotRuntime({
  // ... existing configuration
  langserve: [
    {
      chainUrl: "http://my-langserve.chain",
      name: "performResearch",
      description: "Performs research on a given topic.",
    },
  ],
});

// ... rest of your route definition

Test your implementation

After adding the LangServe integration, test it by asking the copilot to perform research on a topic. Observe how it connects to the external LangServe chain and returns the results.

PREV
LangChain.js
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
Remote Endpoint (Python)

On this page

Modify CopilotRuntime to include LangServe integration
Test your implementation
Find your CopilotRuntime