pypi pydantic-ai 2.64.0
v2.64.0 (2026-10-30)

2 hours ago

What's Changed

⚠️ Compatibility Notes

  • Raise an error status a retrying transport gave up on as ModelHTTPError, so fallback moves on by @DouweM in #11934
  • Send stored response, item, conversation and container IDs back only to the endpoint that created them, via Model.accepts_server_state by @DouweM in #11774
  • Make json-repair an optional dependency, needed only by Coder and RepairToolArguments by @mpfaffenberger in #11768
  • Turn off strict tool schemas for Coder's tools by default, with Coder(strict=True) to opt in by @mpfaffenberger in #11743
  • Surface every nested RepoContext instruction file between a traversed path and the working directory, without repeating the root file by @DouweM in #11687
  • Add output_speech_timestamps to report word timing of realtime speech, on Azure AI Voice Live by @DouweM in #11685
  • Make the ModelFallback capability constructible from agent specs by @DouweM in #11679
  • Add a first_event_timeout model setting so a stream that never starts can fall back by @DouweM in #11582
  • Dispatch OnlineEvaluation evaluators once per durable run instead of on every replay by @DouweM in #11577
  • Show the harness Planning plan in the plan tools' results instead of a per-request reminder copy by @DouweM in #11521
  • Add agent artifact security scanning for Memory and Skills with ArtifactScanner by @mpfaffenberger in #11470
  • Fix AnthropicModel.count_tokens rejecting all-deferred tool requests and undercounting server tools on the Anthropic API by @dsfaccini in #11343
  • Accept plain functions as evaluators in pydantic_evals by @dmontagu in #10292
  • Remove unresolvable RealtimeEvent from pydantic_ai.agent.__all__ by @adtyavrdhn in #10189
  • Add RunContext.load_capability to load on-demand capabilities from code by @adtyavrdhn in #10090
  • Add a ModelFallback capability, a per-attempt prepare_model_request hook, and RetryModelRequest by @DouweM in #9348

🚀 Features

  • Let @agent.system_prompt(dynamic=True) append its changes with on_change='append' to keep the cached prompt by @DouweM in #11445
  • Pair DetectLoops tool results with the response that made the calls by @mpfaffenberger in #11551
  • Add BoxdSandbox: a workspace that runs Coder, Shell, FileSystem and every other harness capability in a boxd machine by @MichielMAnalytics in #11367
  • Add a ModelFallback capability, a per-attempt prepare_model_request hook, and RetryModelRequest by @DouweM in #9348
  • Add Harness Reminder(scope='conversation') for reminders that stay in the message history by @DouweM in #11642
  • Add output_speech_timestamps to report word timing of realtime speech, on Azure AI Voice Live by @DouweM in #11685
  • Cache the schema of ModelRequestContext durable capability operations across agent construction by @DouweM in #11776
  • Make the ModelFallback capability constructible from agent specs by @DouweM in #11679
  • Report word timestamps of ElevenLabs Agents speech with output_speech_timestamps by @DouweM in #11784
  • Record CI provenance on Pydantic Evals experiment spans with OpenTelemetry vcs.* and cicd.* attributes by @dmontagu in #10294
  • Accept plain functions as evaluators in pydantic_evals by @dmontagu in #10292
  • Add logfire.scorer.score_type and logfire.scorer.run_id to online evaluation result events by @dmontagu in #10293
  • Add the OpenTelemetry test.suite.name and test.case.name attributes to Pydantic Evals spans by @dmontagu in #11538
  • Turn off strict tool schemas for Coder's tools by default, with Coder(strict=True) to opt in by @mpfaffenberger in #11743
  • Make json-repair an optional dependency, needed only by Coder and RepairToolArguments by @mpfaffenberger in #11768
  • Teach Coder to read what the task names, check stated requirements, and delegate only when asked by @mpfaffenberger in #11811
  • Let AskUser answerers receive RunContext by @dsfaccini in #11662
  • Add agent artifact security scanning for Memory and Skills with ArtifactScanner by @mpfaffenberger in #11470
  • Add ModelResponse.model_id recording the model the agent sent each request to by @DouweM in #11807
  • Save function evaluators to Dataset files under the function's name by @dmontagu in #10425
  • State how nested instruction files relate in RepoContext instructions when nested_traversal is on by @DouweM in #11698
  • Add a first_event_timeout model setting so a stream that never starts can fall back by @DouweM in #11582
  • Add sticky to ModelFallback to keep a conversation on the fallback model that answered by @DouweM in #11330
  • Add RunContext.load_capability to load on-demand capabilities from code by @adtyavrdhn in #10090

🐛 Bug Fixes

  • Preserve nested SpanTree attributes during JSON round-trips and mark omitted Google embedding and ElevenLabs usage as unmeasured to avoid false zero automatic costs by @dsfaccini in #11912
  • Fall back from Native Output on Bedrock when the installed botocore predates outputConfig by @DouweM in #11694
  • Close the IPythonKernel client's zmq context on shutdown with jupyter-client before 8.7 by @DouweM in #11716
  • Deliver queued realtime messages after a mid-reply reconnect on OpenAI, Azure and xAI by @DouweM in #11678
  • Keep the Gemini Live event stream alive when a resumed session lost a tool call without an id by @DouweM in #11680
  • Search a mixed CodeMode Tool Search corpus with search_tools, so a native deferred tool no longer declares the sandboxed ones by @DouweM in #11638
  • Release a closed realtime session's run state by reference counting by @TejasS1233 in #11240
  • Show the harness Planning plan in the plan tools' results instead of a per-request reminder copy by @DouweM in #11521
  • Dispatch OnlineEvaluation evaluators once per durable run instead of on every replay by @DouweM in #11577
  • Fix AnthropicModel.count_tokens rejecting all-deferred tool requests and undercounting server tools on the Anthropic API by @dsfaccini in #11343
  • Stop advertising CodeExecutionTool on the Bedrock AnthropicModel clients by @DouweM in #11790
  • Turn on the unified cache setting for GPT-5.6 and later with the Azure OpenAI v1 API by @DouweM in #11749
  • Keep the usage and response ID a primed stream received when the consumer leaves it without iterating by @DouweM in #11783
  • Keep Shell's job files in a private temp directory when the workspace isn't writable by @mpfaffenberger in #11809
  • Inline $refs under propertyNames and contains for OpenRouter Google models and custom prefer_inlined_defs transformers by @jukebox in #10859
  • Strip regex patterns Bedrock rejects from strict JSON schemas in BedrockJsonSchemaTransformer by @adtyavrdhn in #11831
  • Remove unresolvable RealtimeEvent from pydantic_ai.agent.__all__ by @adtyavrdhn in #10189
  • Keep finished BackgroundTools results in the history when a run pauses for deferred tools by @wangrat in #11752
  • Let FileSystem edit_file edit non-UTF-8 text files that read_file reads, honoring expected_hash by @mpfaffenberger in #11851
  • Make SubAgents children that share usage run under the parent's usage_limits by @mpfaffenberger in #11853
  • Publish AgentSpec schema fields for Advisor, SummarizingCompaction, ManagedPrompt and PyaiDocs by @mpfaffenberger in #11857
  • Let an asyncpg pool type-check as PostgresMemoryStore's PostgresPool by @mpfaffenberger in #11856
  • Let capability specs set the AbstractCapability base fields id, description and defer_loading by @mpfaffenberger in #11858
  • Publish AgentSpec schema fields for CodeMode, ModalSandbox, and Skills by @mpfaffenberger in #11859
  • Fix SubAgents under Temporal for a named agent with its own model and self with a model menu by @mpfaffenberger in #11862
  • Fix capability events emitted from tools under prefix_tools() by @mpfaffenberger in #11863
  • Make V1-style result.usage() warn instead of raising TypeError by @DouweM in #11884
  • Accept list-typed content from OpenAI-compatible Chat Completions servers by @DouweM in #11885
  • Don't show the first-run banner for runs an installed package starts by @DouweM in #11893
  • Stop waiting for a stalled BedrockConverseModel call or stream read when its request is cancelled or times out by @DouweM in #11850
  • Mark request-scoped SystemPromptParts visible: false in OTel spans of requests the model no longer sees them on by @DouweM in #11772
  • Send stored response, item, conversation and container IDs back only to the endpoint that created them, via Model.accepts_server_state by @DouweM in #11774
  • End tool results before a mid-conversation system entry on Claude Haiku 5.5, so it doesn't read the entry as tool output by @DouweM in #11785
  • Carry ModelResponse.canonical_system through Vercel AI and AG-UI message round-trips by @DouweM in #11794
  • Judge each attempt's model in FileUnderstanding, and let prepare_model_request persist history changes by @DouweM in #11802
  • Report no audio input for OpenAI's non-audio models and no video input on Bedrock outside Nova by @DouweM in #11812
  • Label RepoContext instruction files above the working directory as ../AGENTS.md instead of by absolute path by @DouweM in #11689
  • Let on_run_error, shielded capability cleanup and the model stream close run when an anyio scope cancels a run by @dsfaccini in #10479
  • Honor compatible compactions in Responses continuation by @dsfaccini in #11861
  • Run DynamicWorkflow sub-agents under the parent run's usage_limits instead of the 50-request default by @mpfaffenberger in #11962
  • Fix web_fetch leaking script/style source into markdown content by @pydanty[bot] in #8329
  • Keep StepPersistence failure records when an anyio scope cancels a run by @dsfaccini in #11993
  • Ignore max_retries in OpenAI, Anthropic and Gemini batch requests instead of raising UserError by @DouweM in #11931
  • Raise an error status a retrying transport gave up on as ModelHTTPError, so fallback moves on by @DouweM in #11934
  • Surface every nested RepoContext instruction file between a traversed path and the working directory, without repeating the root file by @DouweM in #11687

📦 Dependencies

New Contributors

Full Changelog: v2.63.0...v2.64.0

Don't miss a new pydantic-ai release

NewReleases is sending notifications on new releases.