Skip to content

Pydantic AI

Connect the maintained server protocol to Ghost’s existing client and canonical views.

Select the server interface

Pydantic AI provides AGUIAdapter.dispatch_request and VercelAIAdapter.dispatch_request on the Python server. Select the wire version deliberately: Vercel sdk_version=7 matches the current recipe; approval streaming requires v6 or newer. Configure agent dependencies and durable history in the server owner. Follow the Pydantic AI integration for server installation and its current Python dependencies. These are maintained server integrations, not new Ghost runtime packages. The verified Ghost boundary is the AG-UI or current Vercel UI-message frontend path; the examples do not claim a live Python deployment was tested.

First React integration

For AG-UI, complete the native client recipe with your endpoint URL and real thread ID. For Vercel, use the Vercel recipe with DefaultChatTransport and the configured protocol version. Choose one client/store owner for a conversation.

The working client, send/stop controls and errors are canonical in that recipe. Keep the native client available for shared state, interrupts and richer resume payloads. Validate state before using it in application UI; tool execution, persistence and authorization remain server/caller-owned.

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.