Vibeleaderboard
← All Intel
Intel / repo

pydantic-ai v2.71.0 — v2.71.0 (2026-11-18)

Source
github.com
Author
dsfaccini
Date

Context

Among the many additions in Pydantic AI 2.71.0, the Python framework from Pydantic, one closes a gap in how people approve an agent's tool calls (release notes). When a tool is marked as needing approval, the agent pauses and hands back the pending call as `DeferredToolRequests` output for a person or a policy to approve or deny; the explanation of 2.69.0 covers how such paused calls are settled. Until this release, the approver saw the arguments exactly as the model wrote them, while the tool ran with the arguments Pydantic AI produced after validating them against the tool's schema. Pull request #13693 lists how the two can differ: values coerced to the declared type, keys the schema does not accept dropped, aliases resolved, URLs normalized and rewrites from an `after_tool_validate` applied. In its example, a model calls `toggle(flag='false')`, the approver sees the string `'false'`, and the tool receives the boolean `False`.

The release adds `DeferredToolRequests.validated_args`, keyed by tool call ID, holding the arguments each paused call will run with, including parameter defaults and values a validation hook added. According to the pull request, these are a JSON-compatible copy rather than the exact Python objects the tool receives, and fields hidden from serialization, for example with `Field(exclude=True)`, are left out. The existing `approvals` and `calls` fields still carry the model's arguments, so an approval screen has to read the new field to show what will actually run.

The pull request is open about what the field does not yet cover. Streamed runs started with `run_stream()` leave it empty for calls that end at an approval, and the built-in `ApprovalReviewer` and the ACP permission flow still decide from the model's arguments; each gap has a follow-up issue. When an approved run resumes, the call is validated again rather than reusing the values the approver saw, so a validation hook that does not give the same result every time could run different arguments. The pull request points to `ToolApproved(override_args=...)` for making the approved arguments the ones that run. The change is listed under compatibility notes because code that compares a `DeferredToolRequests` value, such as a test fixture, with one built without the new field will now find a difference.

Key takeaways · AI-distilled
  • The new `ToolBridge` keeps the tool list fixed behind `tool_search`, `tool_describe` and `tool_call`, so the prompt cache holds even when an agent has a large or changing tool set.
  • `WrapUpAtLimits` ends a run with a final answer instead of raising `UsageLimitExceeded`, and `ReportRemainingBudget` tells the model on every request how much of its usage limits and spend budgets is left.
  • `RequireVerification` sends a coding agent back to run its checks when it tries to finish after an unverified edit, and `ReportStaleFiles` tells the model when workspace files it read have changed or been deleted.
  • `PermissionRule` lets `Permissions` allow, ask about, or deny tool calls and shell commands by rule, and `Shell(secret_env=)` masks the secrets it injects in what the tools return.
  • Agent runs can now be routed with `ModelRouter`, and `LabelCrossModelHistory` tells the model when earlier assistant turns in its history came from a different model.
Terms in this piece · Glossary
  • AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
  • agent hook — A script the harness runs automatically at a fixed point in an agent's loop — before a tool call, after an edit, on session start.
  • agent harness — The scaffolding around a model that turns it into a working agent — the loop, the tools it can call, and the rules for when to stop.
More from dsfaccini
Recommended reads
Comments

Checking sign-in…

Loading comments…