pypi pydantic-ai 2.71.0
v2.71.0 (2026-11-18)

one hour ago

What's Changed

⚠️ Compatibility Notes

  • Let Peers(network) join an InMemoryPeerNetwork under the agent's name, and rename PeerNetwork to PeerConnection by @dsfaccini in #13777
  • Add StavProvider for the Stav European inference gateway by @bwentzel in #12750
  • Add Otari as an OpenAI-compatible gateway provider by @tbille in #13584
  • Add auth to StackOne, deprecating api_key, to match the other hosted MCP capabilities by @mpfaffenberger in #13735
  • Add grep_tool_result and unit='bytes' reads for ToolOutputLimits spills by @mpfaffenberger in #13752
  • Run remote CodeMode turns as Temporal activities so long snippets don't trip the deadlock detector by @adtyavrdhn in #13756
  • Add DeferredToolRequests.validated_args so an approver sees the arguments a deferred tool call will run with by @dsfaccini in #13693
  • Deprecate DEPRECATED_ANTHROPIC_MODELS, which Pydantic AI no longer uses by @dsfaccini in #13795
  • Pause again when a deferred pause whose step also ran other tools is resumed without deferred_tool_results by @adtyavrdhn in #13051
  • Keep a run paused when content is queued at a DeferredToolRequests or PendingModelResponse pause, and have BackgroundTools wait for its tasks at a DeferredToolRequests pause by @adtyavrdhn in #13054
  • Keep approval-required and external tools native under CodeMode(tools='all') by @mpfaffenberger in #13742
  • Type the in-process MCP server arm of MCPToolsetClient as a protocol instead of mcp.server.fastmcp.FastMCP, so strict pyright accepts it on FastMCP 3 and 4 by @adtyavrdhn in #13721

🚀 Features

  • Let Peers(network) join an InMemoryPeerNetwork under the agent's name, and rename PeerNetwork to PeerConnection by @dsfaccini in #13777
  • Add anthropic_previous_message_id setting for Anthropic message threads by @Harshil-Jani in #12259
  • Add StavProvider for the Stav European inference gateway by @bwentzel in #12750
  • Add title and metadata to ConversationRecord, set with ConversationStore.update() by @DouweM in #12311
  • Add Otari as an OpenAI-compatible gateway provider by @tbille in #13584
  • Add DenyUnanswered harness capability to answer deferred calls by @pydanty in #12584
  • Route agent runs with ModelRouter by @DouweM in #9046
  • Add ReportStaleFiles to tell the model when workspace files it read change or are deleted by @mpfaffenberger in #13750
  • Add ToolBridge, which keeps the tool list fixed behind tool_search, tool_describe and tool_call so the prompt cache holds for large or changing tool sets by @mpfaffenberger in #13744
  • Add Shell(secret_env=), masking the secrets it injects in what the tools return by @mpfaffenberger in #13622
  • Add auth to StackOne, deprecating api_key, to match the other hosted MCP capabilities by @mpfaffenberger in #13735
  • Add grep_tool_result and unit='bytes' reads for ToolOutputLimits spills by @mpfaffenberger in #13752
  • Raise an HTTP 408 from a provider as ModelTimeoutError by @adtyavrdhn in #13838
  • Add WrapUpAtLimits harness capability to end a run with a final answer instead of UsageLimitExceeded by @mpfaffenberger in #13670
  • Add LabelCrossModelHistory to tell the model when earlier assistant turns came from another model by @mpfaffenberger in #13749
  • Allow, ask about, or deny tool calls and shell commands by rule with PermissionRule in Harness Permissions by @mpfaffenberger in #13751
  • Add ReportRemainingBudget to tell the model how much of its usage limits and spend budgets is left on every request by @mpfaffenberger in #13747
  • Add CurrentTime so an agent knows today's date, or the current hour, in a time zone you pick by @mpfaffenberger in #13754
  • Add ReportToolErrors to send an unhandled tool exception to the model as a failed tool result instead of ending the run by @mpfaffenberger in #13745
  • Add RequireVerification to send a coding agent back to run its checks when it tries to finish after an unverified edit by @mpfaffenberger in #13753
  • Run remote CodeMode turns as Temporal activities so long snippets don't trip the deadlock detector by @adtyavrdhn in #13756
  • Add Goal to keep unattended runs working until a caller-defined completion check passes by @mpfaffenberger in #13733
  • Support Gemini 4 Neon (gemini-4-neon) on GoogleModel by @dsfaccini in #13928

🐛 Bug Fixes

  • Keep the stored xAI function name when replaying WebSearchTool calls by @pydanty in #10021
  • Add DeferredToolRequests.validated_args so an approver sees the arguments a deferred tool call will run with by @dsfaccini in #13693
  • Cut every URL in a PlaywrightBrowser attach error to its origin, not only the exact cdp_url by @dsfaccini in #13796
  • Deprecate DEPRECATED_ANTHROPIC_MODELS, which Pydantic AI no longer uses by @dsfaccini in #13795
  • Stop rebuilding the active-capability set for every deferred capability on every hook by @adtyavrdhn in #13812
  • Skip serializing model request span attributes when the span is sampled out by @adtyavrdhn in #13813
  • Pause again when a deferred pause whose step also ran other tools is resumed without deferred_tool_results by @adtyavrdhn in #13051
  • Keep the stale-thinking-block recovery of AnthropicModel.count_tokens for later counts when the request carries a ModelSettingsDeltaPart by @dsfaccini in #13833
  • Send a lost Sprite create again in SpritesSandboxBackend instead of only looking it up by @adtyavrdhn in #13827
  • Keep a run paused when content is queued at a DeferredToolRequests or PendingModelResponse pause, and have BackgroundTools wait for its tasks at a DeferredToolRequests pause by @adtyavrdhn in #13054
  • Restore empty tool_args when Anthropic streams a zero-argument mcp_tool_use by @adtyavrdhn in #13834
  • Skip Anthropic content blocks and deltas of a type the SDK doesn't know, with a warning by @adtyavrdhn in #13836
  • Classify Bedrock ModelErrorException and Groq 498 errors by @adtyavrdhn in #13837
  • Keep approval-required and external tools native under CodeMode(tools='all') by @mpfaffenberger in #13742
  • Close the debounce generator of stream_text() and stream_response() when the consumer stops early, instead of leaving it to the garbage collector by @dsfaccini in #13859
  • Fix realtime retained-audio and ImageUrl errors that read "a openai realtime session", and give session.send() WAV errors their own wording by @dsfaccini in #13794
  • Skip attribute docstrings in durable capability-operation schemas, which take seconds to read on Python 3.11 and 3.12 by @dsfaccini in #13891
  • [gh-aw] Write session frames larger than the capture pipe whole instead of failing the run with Errno 11 by @dsfaccini in #13915
  • Say which FunctionToolset defaults reach a Tool instance, in its docstrings and docs/toolsets.md by @dsfaccini in #13621

New Contributors

Full Changelog: v2.70.0...v2.71.0

Don't miss a new pydantic-ai release

NewReleases is sending notifications on new releases.