Skip to content
Star

Pydantic AI

Connect a Pydantic AI server to an AG-UI or Vercel AI SDK client.

Choose the server protocol

Use AGUIAdapter.dispatch_request for an AG-UI client or VercelAIAdapter.dispatch_request for the Vercel AI SDK. Set sdk_version=7 for the Vercel recipe. Approval streaming requires v6 or later. Follow the Pydantic AI UI integration guide to configure the agent and authentication. The checked examples cover the frontend clients.

First React integration

For AG-UI, follow Connect an AG-UI endpoint with your endpoint URL and thread ID. For Vercel, follow Connect the AI SDK and point DefaultChatTransport at your configured route. Use one client and store per conversation.

Read shared state, interrupts, and resume data from the native client. Validate shared state before using it in the view.

Customize for the job

Use server-owned history for conversation integrity. Client-submitted approval/history is not an authorization boundary; authorize sensitive actions against the authenticated user inside server tools. Map custom UI data deliberately.

Troubleshooting

An HTTP success with no answer often means the endpoint speaks a different protocol or protocol version. Confirm the server route, credentials and event content type before changing Ghost. For unavailable native operations, retain the native API or implement a narrow application adapter; do not report unsupported behavior as success. See Pydantic AI's documentation and stability for each side of the boundary.