SIGN IN SIGN UP

Add a Pydantic AI example Bot (#56)

* Add a Pydantic AI example Bot

A third framework example beside LangGraph and Mastra, and the first in another
language. A real Pydantic AI agent served over AG-UI: the surface's tools arrive
per run and their calls stream back to OpenBot to run through the gateway, so the
process drives a governed browser it has no direct access to, the same contract
as the Bot in the box.

Self-contained (its own pyproject.toml, outside the Bun workspaces), imports the
AG-UI helper from whichever module path the installed pydantic-ai exposes, and
answers /health like the other examples.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Use the AG-UI adapter that pydantic-ai actually ships

The first version imported handle_ag_ui_request from pydantic_ai.ui.ag_ui with
a fallback to pydantic_ai.ag_ui. Neither exists in current pydantic-ai: the
module exposes AGUIAdapter, and there is no top-level ag_ui module, so the Bot
failed at import before serving a single request.

Serve with AGUIAdapter.dispatch_request(request, agent=agent) instead, verified
against pydantic-ai 2.33.0: the server boots, /health answers, and a RunAgentInput
POST with a granted tool streams RUN_STARTED then the model call (frontend tools
accepted, AG-UI events emitted as SSE). Pin the dependency to the tested release
and correct the README note.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Give the Pydantic example a key, a free port, and the shipped model default

The endpoint read no header, which is the one thing an example must not
teach now that the server sends a Bot's key on every run: it takes a run
from anyone who can reach the port. Guarded by REQUIRE_KEY, the same
optional guard the LangGraph example carries.

4202 sits in the band the in-box agents use, 4200 and 4201. The examples
step by a hundred, 4300 and 4400, and 4500 is the supervisor, so 4600.

gpt-4.1 is not what this deployment ships; gpt-5.5 is the default
everywhere else. Also record that Pydantic AI calls /responses rather
than /v1/chat/completions, which decides whether a given gateway can
serve this at all, and ignore the egg-info that the README's own install
step leaves behind.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: David McKay <davidmckayv@users.noreply.github.com>
F
Francesco committed
574b4cd4c6bbdff519674928f60eb0d767ffb3f2
Parent: a6fe829
Committed by GitHub <noreply@github.com> on 8/24/2026, 4:48:03 PM