@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
46 lines (33 loc) • 1.09 kB
Markdown
PydanticAI — wired via the bare `HttpAgent` from `@ag-ui/client`.
```bash
pnpm add @ag-ui/client
```
```typescript
import {
CopilotRuntime,
createCopilotRuntimeHandler,
} from "@copilotkit/runtime/v2";
import { HttpAgent } from "@ag-ui/client";
const runtime = new CopilotRuntime({
agents: {
default: new HttpAgent({
url: process.env.PYDANTIC_AI_URL ?? "http://localhost:8000/",
}),
},
});
const handler = createCopilotRuntimeHandler({
runtime,
basePath: "/api/copilotkit",
});
export default { fetch: handler };
```
On the Python side, PydanticAI exposes an AG-UI-compliant endpoint via its built-in
ASGI adapter. The URL you pass to `HttpAgent` is that endpoint (e.g. an FastAPI route
that returns a streaming response of AG-UI events).
## Gotcha — no suffix required
Unlike LlamaIndex (`/run`) and Agno (`/agui`), PydanticAI does not mandate a specific
sub-path. Whatever path your Python server mounts the AG-UI app at — use that.
Source: `docs/content/docs/integrations/pydantic-ai/quickstart.mdx`.