Migrate to AG-UI
Migration guide for agents streaming through the AG-UI protocol
AG-UI is the new agent-to-UI protocol used in CopilotKit. It already integrates with LangGraph agents.
This guide shows how to make the transition.

Choose how your agent is served
LangGraph Platform
I am using LangGraph's Platform to serve my agent (cloud or self hosted).
Self hosted (FastAPI)
I am self hosting my agent, and serving it through FastAPI.
CopilotRuntime instantiation from#
let runtime = new CopilotRuntime({
remoteEndpoints: [
langGraphPlatformEndpoint({
deploymentUrl: "https://your-deployment-url",
langsmithApiKey: '<langsmith API key>', // optional
agents: [], // Your previous agents definition
})
],
})To
let runtime = new CopilotRuntime({
agents: {
'sample_agent': new LangGraphAgent({
deploymentUrl: "https://your-deployment-url",
langsmithApiKey: '<langsmith API key>', // optional
graphId: 'sample_agent', // Identical to what is defined in the `langgraph.json` graphs config.
}),
}
})And that's it! You're all set!