Repository navigation
Add Pydantic AI plugin samples - #358
brianstrauch wants to merge 7 commits into
Conversation
|
We can optionally wait for beartype and pydantic releases before merging so we're not pinning commits |
DABH
left a comment
There was a problem hiding this comment.
Two issues reproduced locally: the documented live model is missing its provider dependency, and a second approval round leaves the workflow running after assertion failures. All 11 added tests pass.
| "beartype>=0.23.0,<0.24", | ||
| "logfire>=4.39,<5", | ||
| "mcp>=1.24,<2", | ||
| "pydantic-ai-slim[mcp,temporal]>=2.46.0,<3", |
There was a problem hiding this comment.
[P2] Include the OpenAI extra required by live mode
A clean uv sync --group pydantic-ai does not install openai, since neither the mcp nor temporal extra includes it. Consequently the documented model="gateway/openai:gpt-5.2" fails before making a request: infer_model("gateway/openai:gpt-5.2") raises an ImportError asking for the OpenAI provider dependency. This affects the live path in every sample even when PYDANTIC_AI_GATEWAY_API_KEY is set. Include the openai extra in this dependency group so the advertised live commands work.
| deferred_tool_results=deferred_results, | ||
| model=input.model, | ||
| ) | ||
| assert isinstance(resumed.output, str) |
There was a problem hiding this comment.
[P2] Handle additional approval rounds after resuming the agent
A resumed run can legitimately return another DeferredToolRequests, since delete_record remains available and still requires approval. For example, a model can request deletion of record 42, then request record 43 after receiving the first tool result. After the first approved tool runs, this assertion raises instead of exposing the next request. With the sample worker configuration, AssertionError repeatedly fails workflow tasks, leaving the execution running without a way to finish the next approval. Loop over deferred outputs until the agent returns a string, carrying forward the latest messages and clearing the decision for each new round.
Summary
Validation
All 11 Pydantic AI tests pass on Python 3.10 (Pydantic AI 2.54.0) and Python 3.14 (Pydantic AI 2.55.0). Lint, formatting, type checks on both Python versions, and lockfile validation pass.