Loading...
Loading...
Use when wiring an external agent framework (LangGraph, CrewAI, PydanticAI, Mastra, ADK, LlamaIndex, Agno, Strands, Microsoft Agent Framework, or others) into a CopilotKit application via the AG-UI protocol.
npx skill4agent add copilotkit/skills copilotkit-integrationscopilotkit-docssearch-docssearch-code.mcp.jsonCopilotRuntimeuseAgentuseFrontendTooluseRenderToolCalluseHumanInTheLoop| Framework | Language | AG-UI Client (route.ts) | AG-UI Server Adapter | Agent Port |
|---|---|---|---|---|
| LangGraph (Python, self-hosted) | Python | | | 8123 |
| LangGraph (Python, LangGraph Platform) | Python | | LangGraph Platform (managed) | varies |
| LangGraph (JS) | TypeScript | | Built into | 8123 |
| CrewAI Flows | Python | | | 8000 |
| CrewAI Crews | Python | | | 8000 |
| PydanticAI | Python | | | 8000 |
| Mastra | TypeScript | | Built into | Next.js dev server |
| Google ADK | Python | | | 8000 |
| LlamaIndex | Python | | | 9000 |
| Agno | Python | | | 8000 |
| Strands | Python | | | 8000 |
| Microsoft Agent Framework (Python) | Python | | | 8000 |
| Microsoft Agent Framework (.NET) | C# | | | 8000 |
| A2A Middleware | Python + TS | | Per-agent (mixed frameworks) | 9000-9002 |
| MCP Apps | TypeScript | | N/A (middleware on BuiltInAgent) | 3108 |
Is your agent written in TypeScript/JavaScript?
YES --> Is it a Mastra agent?
YES --> Use Mastra integration (references/integrations/mastra.md)
NO --> Is it a LangGraph JS agent?
YES --> Use LangGraph JS integration (references/integrations/langgraph.md, JS section)
NO --> Use BuiltInAgent with MCP Apps middleware or HttpAgent
NO (Python or .NET) -->
Which framework?
LangGraph --> references/integrations/langgraph.md
CrewAI --> references/integrations/crewai.md
PydanticAI --> references/integrations/pydantic-ai.md
Google ADK --> references/integrations/adk.md
LlamaIndex --> references/integrations/llamaindex.md
Agno --> references/integrations/agno.md
Strands --> references/integrations/strands.md
MS Agent Fw --> references/integrations/ms-agent-framework.md
Multiple agents (A2A) --> references/integrations/a2a.mdimport { CopilotKitProvider } from "@copilotkit/react";
import "@copilotkit/react/styles.css";
export default function RootLayout({ children }) {
return (
<CopilotKitProvider runtimeUrl="/api/copilotkit" agent="my_agent_name">
{children}
</CopilotKitProvider>
);
}agentCopilotRuntime({ agents: { my_agent_name: ... } })src/app/api/copilotkit/route.tsimport {
CopilotRuntime,
ExperimentalEmptyAdapter,
copilotRuntimeNextJSAppRouterEndpoint,
} from "@copilotkit/runtime";
import { NextRequest } from "next/server";
// Import the appropriate agent class for your framework
const runtime = new CopilotRuntime({
agents: {
my_agent: new SomeAgentClass({ url: "http://localhost:8000/" }),
},
});
export const POST = async (req: NextRequest) => {
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
runtime,
serviceAdapter: new ExperimentalEmptyAdapter(),
endpoint: "/api/copilotkit",
});
return handleRequest(req);
};const { state, setState } = useAgent<{ proverbs: string[] }>({
name: "my_agent",
initialState: { proverbs: [] },
});useFrontendTool({
name: "setThemeColor",
parameters: [
{ name: "themeColor", description: "Hex color value", required: true },
],
handler({ themeColor }) {
setThemeColor(themeColor);
},
});useRenderToolCall({
name: "get_weather",
description: "Get weather for a location.",
parameters: [{ name: "location", type: "string", required: true }],
render: ({ args }) => <WeatherCard location={args.location} />,
}, []);useHumanInTheLoop({
name: "go_to_moon",
description: "Go to the moon on request.",
render: ({ respond, status }) => (
<MoonCard status={status} respond={respond} />
),
}, []);STATE_SNAPSHOT@copilotkit/reactuseAgentuseFrontendTooluseRenderToolCalluseHumanInTheLoopCopilotSidebarCopilotPopup@copilotkit/runtimeCopilotRuntimeExperimentalEmptyAdapter@copilotkit/runtime/langgraphLangGraphAgentLangGraphHttpAgent@ag-ui/clientHttpAgent@ag-ui/crewaiCrewAIAgent@ag-ui/mastraMastraAgent@ag-ui/llamaindexLlamaIndexAgent@ag-ui/a2a-middlewareA2AMiddlewareAgent@ag-ui/mcp-apps-middlewareMCPAppsMiddleware