pypi pydantic-ai 2.78.0
v2.78.0 (2026-12-02)

2 hours ago

What's Changed

⚠️ Compatibility Notes

  • Attach a workspace a capability function supplies before for_run, so for_run can read ctx.workspace by @DouweM in #10528
    • A for_run now sees a workspace a capability function supplies, where it used to see an unattached placeholder. When nothing else supplies the workspace, the run now calls its capability functions before the other capabilities' for_run instead of alongside them, and under durable execution a capability whose for_run reads ctx.workspace only when it's .attached, next to such a function, now adds steps to the history of a run already in flight. In pax, a plugin that wraps its workspace factory in another capability, such as BubblewrappedWorkspace(DynamicCapability(...)), and returns a sandbox now fails the run instead of running in the sandbox: return the workspace capability from the capability function directly, or supply it up front.
  • Configure pax input bindings, queue delivery, and non-modal questions by @dsfaccini in #13162
    • Pax's USER_ONLY_SETTINGS gains the five new input.* settings, so a comparison of it to a fixed set sees five more values. LivePrompt.keys now passes PromptKeys a new optional unknown callback. With no input.* setting changed, the keys, busy delivery, the question and approval picker and the composer frame stay as before. Two things do change: a queued prompt held for editing is left out of the footer's queued count, and the launch hints also name /input.
  • Route agent-graph waits through BaseDurabilityCapability.durable_sleep, making them durable on AWS Lambda, Absurd and pgtask by @DouweM in #13274
    • On AWS Lambda, Absurd and pgtask, a run that waits between polls of a background response or a BatchModelRequests batch now suspends the execution for each wait, and the engine runs it again, instead of sleeping in the process. Let AWS Lambda executions that are waiting on a background response or batch finish before you deploy the upgrade: replayed mid-poll, they fail as a non-deterministic replay. Absurd and pgtask tasks recorded before the upgrade still replay, but they wait once more through each wait they had already done.
  • Fail a CodeMode run when a DBOS replay diverges inside run_code, and drop the elapsed-time limit under every durable engine by @adtyavrdhn in #13527
    • Under DBOSDurability and AWSLambdaDurability, a replay that diverges inside CodeMode's run_code now fails the run instead of returning a result built from another step's checkpoint. Deploy changed agent code as a new DBOS application version or Lambda published version, as the engine docs already require. CodeMode's max_duration_seconds resource limit is now off under every durable engine, not only Temporal, even when set explicitly: move time-bounded work into a tool, or use a remote pool's request_timeout as the wall-clock bound.
  • Make WrapUpAtLimits wrap up at cost_limit and before the run's timeout=, keeping output tools on the final request by @mpfaffenberger in #14164
    • WrapUpAtLimits with a cost_limit or a run timeout= now returns a wrapped-up answer instead of raising UsageLimitExceeded or RunTimedOut once the next step is projected not to fit. Pass WrapUpAtLimits(timeout_margin=None) to keep raising RunTimedOut at the deadline. LimitName gains 'cost_limit' and 'timeout', so an exhaustive match on it has to handle the two new values, and DEFAULT_WRAP_UP_PROMPT is reworded.
  • Rename CurrentTime to AnnounceCurrentTime, keeping CurrentTime as a deprecated alias by @DouweM in #14447
    • The harness capability CurrentTime is renamed AnnounceCurrentTime, and pydantic_ai_harness.current_time moves to pydantic_ai_harness.announce_current_time. The old name, the old module and a CurrentTime spec block still work, with a HarnessDeprecationWarning. The options and the default id don't change. CurrentTime is now a subclass of AnnounceCurrentTime, so isinstance(AnnounceCurrentTime(), CurrentTime) is False.
  • Refuse realtime sessions in durable workflow code, and document the supported recipe by @DouweM in #14526
    • With a durability capability such as TemporalDurability, DBOSDurability, PrefectDurability or a Harness engine's, on the agent or passed for one call, an agent's realtime session, answer_webrtc_offer(), create_client_secret() and hang_up() now raise UserError in the code the engine replays (a workflow, flow or orchestration, an AWS Lambda durable handler, or an Absurd or pgtask task). They used to run there unrecorded. Open the session outside the workflow, or start durable work from a tool, as the realtime deployment docs' "Durable execution" section shows; inside a durable activity, step or task they still run, and DBOSAgent and PrefectAgent now allow them there too, which they used to refuse.
  • Run a trailing positional prompt in pax, read it from stdin with -, and print non-string output as JSON with --output-format by @DouweM in #14702
    • In a one-shot pax -p run, an agent output that isn't a str now prints as JSON (pydantic_core.to_json) instead of str(). An example is an agent loaded with -a that sets output_type=City. A script that read the old str() text needs to parse JSON. A str output prints as before.
  • Mark output tool call and return parts with tool_kind='output' and add is_output_tool_part() by @DouweM in #14707
    • An output tool's ToolCallPart, and the return parts answering it, now carry tool_kind='output', so a test that compares them with == or a snapshot needs the field added. The Vercel AI adapter adds providerMetadata: {'pydantic_ai': {'tool_kind': 'output'}} to output tool chunks and dumped UIMessage parts, and the AG-UI adapter puts the marker in the encrypted_value of output tool calls and results, so frontends that snapshot or strictly validate these events see it. A Prefect flow retried across the upgrade re-runs, once, the model-request and tool tasks whose history holds output tool parts, because their cache keys change.
  • Retry a FallbackModel on Temporal unless every model failed with a non-retryable error by @DouweM in #14770
    • On Temporal, FallbackExceptionGroup is no longer non-retryable, as the v2.77.0 Temporal docs listed it. A FallbackModel whose models all failed with retryable errors (rate limits, outages, dropped connections), or whose fallback_on response handler rejected every response, now has its model request activity retried by the activity's retry policy instead of failing at once, and under the default unlimited policy it retries until a model answers or the activity times out, as a single model already did; a chain whose models all failed with non-retryable errors (authentication, quota, context window, a UserError) still fails on its first attempt. To keep failing at once, add 'FallbackExceptionGroup' to the retry policy's non_retryable_error_types, or set maximum_attempts.
  • [mcp-context] Stop MCP sampling on a kept-alive stdio connection from hanging on the agent's own concurrency limiter by @pydanty in #14914
    • In a plain agent.run() on a kept-alive stdio MCPToolset with a legacy session (FastMCP 3, or FastMCP 4 with Client(mode='legacy')), a sampling ConcurrencyLimitedModel that shares the agent's ConcurrencyLimiter is refused with UserError again, as on v2.76.0, and the agent gets that as the tool's error. This includes a limiter with spare capacity, whose runs completed on v2.77.0. Give the sampling model its own ConcurrencyLimiter.
  • Record ToolReturn.content as returned so durable runs reject non-UserContent items like plain runs by @DouweM in #14921
    • A durable run whose tool returns ToolReturn.content items that aren't UserContent, such as an {'kind': 'image-url', 'url': ...} dict, now raises the same ValueError as a plain run, after the tool-execution hooks, instead of continuing with the dict rebuilt as an ImageUrl, DocumentUrl or UploadedFile. On Temporal, an uncaught one fails the workflow task, which Temporal retries until a fix is deployed; return UserContent items, or replace them in an after_tool_execute hook. On Absurd, a tool call with such content isn't checkpointed and runs again when the task replays, and on every engine a worker on v2.77.0 or earlier can't resume a run that recorded such content, so let runs whose hooks repair it finish before you roll back or run mixed versions.
  • Fall back past a model whose profile can't serve the request, with a new ModelFeatureUnsupportedError by @DouweM in #14983
    • A request that a model's profile can't serve (Native, Tool, text or image output, or a forced tool_choice) now raises ModelFeatureUnsupportedError, a UserError that is also a ModelRequestRejectedError. except ModelAPIError and except AgentRunError handlers, custom fallback_on and retry_on predicates, and on_model_request_error hooks now see it, so check isinstance(e, ModelFeatureUnsupportedError) first to keep treating it as a configuration error. FallbackModel and ModelFallback now move on to the next model instead of raising, and when every model is incapable they raise a FallbackExceptionGroup, which a plain except UserError doesn't catch: to keep raising on the first incapable model, leave the error out of fallback_on, as in FallbackModel(..., fallback_on=lambda e: isinstance(e, ModelAPIError) and not isinstance(e, ModelFeatureUnsupportedError)), and give a Temporal workflow in flight across the upgrade worker versioning or a patch if its own code caught that UserError around agent.run and kept issuing commands.
  • Accumulate streamed OpenAI text in linear time, and stop padding raw_content up to content_index by @dsfaccini in #15077
    • With OpenAIResponsesModel streaming raw reasoning (response.reasoning_text.delta, which gpt-oss models and DeepSeek send), ThinkingPart.provider_details['raw_content'] now has one entry per content_index, in the order the indices first arrive. A gap no longer pads the list with '', and a negative index gets its own entry instead of counting from the end of the list or raising IndexError. Code that reads an entry at its content_index position can get a different entry from a stream that sends its indices out of order, and the next request sends the entries back in that order, so use a non-streaming request to get them in content_index order; streams that send their indices in order are unchanged.
  • Let Pax use a System One decision model for smart_search, relevance compaction, and a system_one tool by @mpfaffenberger in #15123
    • Pax's DEFAULT_PLUGINS gains the built-in system_one declaration, so existing installs list a new enabled system_one row in /plugins. It adds nothing until run.decision_model is set, and /plugins disable system_one turns it off.
  • Add ModelResponseRejectedEvent to set a rejected streamed response apart from the retry, in the event stream and the Vercel AI and AG-UI adapters by @dsfaccini in #15126
    • AgentStreamEvent and HandleResponseEvent gain ModelResponseRejectedEvent, so an exhaustive match over them stops type-checking. A run that rejects a streamed response now emits the event, plus a data-model-response-rejected part in its own step through the Vercel AI adapter, or a CUSTOM event and a new assistant message for the retry through AG-UI; on a streamed request with an after_model_request hook, the hook runs and the response's usage is counted when the model stream ends, not when the consumer leaves it. Durable runs with an event_stream_handler need no upgrade step on Temporal, DBOS or Prefect, but on AWS Lambda, Azure Durable Task, Absurd and pgtask, let in-flight runs finish before upgrading (the Absurd and pgtask READMEs don't say so yet): a Lambda or Azure replay that meets a rejection breaks on the new handler step, and an Absurd or pgtask replay skips the rejection event and delivers one event twice.
  • Stream MistralModel content as text, not as an output tool call, when text output is allowed by @dsfaccini in #15129
    • With MistralModel, consider a streamed run whose output type allows text alongside output tools (output_type=[str, M]), or a request_stream call with output tools and allow_text_output=True. When the model writes an output tool's JSON as content, it now returns that content as text instead of M, as agent.run and request() already did. Use a structured-only output type (M, ToolOutput(M) or NativeOutput(M)) when the output must be M, or parse the text with M.model_validate_json(output).
  • Report Pax to herdr as pax, and let a distribution of Pax report its own name by @mpfaffenberger in #15136
    • Pax's herdr plugin now reports agent and source as pax instead of clai2, also when Pax runs as the deprecated clai2 command. Herdr's sidebar and herdr agent list now show Pax panes as pax, so herdr scripts that match clai2 in herdr agent list or pane.get output need to match pax. For sidebar rows, use [ui.sidebar.agents] rows. The rows_by_agent.clai2 key the docs used to suggest makes herdr reject the whole config file.
  • Stream MistralModel content as text, not as an output tool call, when text output is not allowed by @dsfaccini in #15188
    • With MistralModel, a streamed run whose output type doesn't allow text (output_type=M or ToolOutput(M)), or a request_stream call with output tools and allow_text_output=False, now streams content the model writes, instead of calling the output tool, as a TextPart, as agent.run and request() already did. When that content is M's JSON, output_type=M still returns M, but parsed once the response ends and with no partial outputs, while ToolOutput(M) asks the model to call the tool and retries. For structured output that the model writes as content, use NativeOutput(M) or PromptedOutput(M); output tool calls the model makes natively stream as before.
  • Re-send a nested instruction file that changed since RepoContext surfaced it by @dsfaccini in #15190
    • When a nested instruction file changes after a note in the conversation inlined it, RepoContext's nested traversal now sends it again as a new ContextFilePart at the message tail. To compare the two, a run's first traversal of such a directory makes the workspace calls a first surface makes. A Temporal or DBOS run that traversed an already-surfaced directory before the upgrade makes more workspace calls on replay than it recorded, so let such runs finish, or version the deployment, before upgrading.
  • Install the published gh-aw engine's runtime from hash-locked, exact versions by @dsfaccini in #15200
    • A gh-aw workflow that imports the engine definition from main now installs the exact hash-locked versions in src/pydantic_ai_harness/gh-aw/requirements.txt on its next recompile, wheels only. Before, it installed the newest versions that met the floors. A package that the workflow's steps: installs and requirements.txt also pins ends at the pinned version. To keep another version of a pinned package, install it in the workflow's pre-agent-steps:, which run after the engine's install. A workflow's own engine: version: that differs from the definition's still installs by name, with a warning.
  • Run a union output function whose argument is Optional[...], X | None or a type alias, instead of raising TypeError or returning the argument by @dsfaccini in #15204
    • With NativeOutput([...]) or PromptedOutput([...]), an output function whose argument is Optional[X], X | None or a type alias now runs when the model picks it. It used to be skipped, so the raw argument became the output, or to raise TypeError, and code that read that raw argument now gets the function's return value. A value that before_output_process or on_output_validate_error returns now goes to such a function, or to a type alias listed directly as a union member, when that's the first member in union order whose type the value matches, instead of going to a later member or becoming the output as is.
  • Return an inline user image from AGUIAdapter.load_messages as BinaryImage, not plain BinaryContent by @dsfaccini in #15329
    • AGUIAdapter.load_messages now returns an inline user image as BinaryImage instead of plain BinaryContent, as ModelMessagesTypeAdapter and VercelAIAdapter already do. This covers images from a data source and from a retired binary part's data. The loaded image no longer compares equal to a plain image BinaryContent, and type(item) is BinaryContent is False. Check it with isinstance(item, BinaryContent) or item.is_image, and build expected images as BinaryImage when you compare reloaded history. Model requests don't change.
  • Raise failed AWS credential refreshes as ModelConnectionError on Bedrock, so FallbackModel falls back by @pydanty in #15409
    • On BedrockConverseModel and BedrockEmbeddingModel, a failed AWS credential refresh now raises ModelConnectionError, with botocore's error as its __cause__. This covers CredentialRetrievalError and MetadataRetrievalError, such as an ECS or EC2 metadata endpoint that doesn't answer. An except, fallback_on=, retry_on= or Temporal non_retryable_error_types that names those classes or BotoCoreError no longer matches; name ModelConnectionError instead. FallbackModel now falls back and RetryOnModelErrors retries. A Temporal agent with a FallbackModel falls back at once instead of Temporal retrying the request, and a Temporal agent that lists ModelAPIError as non-retryable no longer retries the failure.
  • Send gpt-oss's mid-conversation system prompts as <system> blocks on every host by @DouweM in #15427
    • gpt-oss providers that used to send a mid-conversation SystemPromptPart as a system message now send it as a <system> block in a user turn. These include CrusoeProvider, CerebrasProvider, TogetherProvider, AzureProvider, VLLMProvider, OllamaProvider, and OpenAIProvider with a base_url that serves gpt-oss. The system prompt also gets the framing announcement from the first request, so a conversation already in progress misses the prompt cache once. To keep the native role, pass profile={'supports_inline_system_prompts': True} to the model.
  • Refuse get_output() and stream_output() after StreamedRunResult.cancel() by @DouweM in #15545
    • After StreamedRunResult.cancel(), get_output() and stream_output() now raise the same UserError as result, instead of returning an output validated from the interrupted response. A stream_output() loop still running when cancel() is called raises at its next step. Read what was received from response or all_messages() instead. Calling cancel() on a response the provider had already finished no longer marks the run complete at that point. The response is recorded, result becomes available and after_run runs once the stream is consumed, for example with get_output().
  • Run a Temporal wait's ask on the worker's copy of HandleDeferredToolCalls and AskUser, not the sandbox's by @DouweM in #15567
    • Rolling deploys on Temporal: new runs schedule an activity type that workers on v2.77.0 or earlier don't register. Upgrade every worker on the task queue before new runs start, as the Temporal docs say.
  • Send reasoning_effort for thinking on mistral:mistral-large-latest, which is now Mistral Large 4 by @dsfaccini in #15648
    • A run on mistral-large-latest that sets thinking now sends reasoning_effort ('low', 'medium' or 'high'), which it used to drop. thinking=False sends 'low'. On a private deployment whose mistral-large-latest still points at a model without reasoning, such as mistral-large-2512, that request now fails with a 400. Remove thinking there, since it had no effect.
  • Stop type names from one get_conflicting_type_names call leaking into FunctionSignature renders with another set by @dsfaccini in #15654
    • From v2.67.0, render, render_definition and render_type_definitions reused the names from the last FunctionSignature.get_conflicting_type_names call even when given another set. That set could be hand-built, come from another call, or be derived from the returned one, such as names | other or frozenset(names). Those renders now get the v2.66 names back: a type whose name is in the set is prefixed with the name of the function rendered. To keep a call's names, pass the set that get_conflicting_type_names returned itself.
  • Include a SpeechPart transcript in the plain-text output of run_stream() by @dsfaccini in #15656
    • When a model emits text and speech in one response, run_stream() with plain-text output now includes the SpeechPart transcript in the text from get_output() and stream_output(), as run() does. An output validator or output hook now sees the joined text, and run_stream() raises UnexpectedModelBehavior when the validator or hook rejects it. Change the validator or hook to accept the transcript. stream_text() still leaves the transcript out, and so does output that a schema or a TextOutput function parses.
  • Fix MistralModel gaps: thinking on DeepSeek V4.1 Flash and GLM-5.3, strict tools, extra_headers, client timeouts, usage details and error mapping by @dsfaccini in #15691
    • Three request changes on MistralModel:

      • thinking on deepseek-v4-1-flash-1017 and the GLM-5.3 IDs (zai-glm-5-3, zai-glm-5-3-flash, zai-glm-5, zai-glm-latest, glm-5-latest) now sends reasoning_effort instead of being dropped.
      • extra_headers is now sent instead of being dropped with a warning.
      • A tool or ToolOutput with strict=True now sends function.strict, which Mistral enforces, on models whose profile has no JSON schema transformer.

      To keep the earlier request, leave thinking unset, or remove the header or the strict=True.

    • Three behavior changes:

      • A stream that ends before its terminal chunk has state='incomplete' instead of 'complete'.
      • An error from a legacy httpx.AsyncClient raises a model error, such as ModelConnectionError, instead of the raw httpx error, so catch ModelAPIError.
      • The client MistralProvider creates now times out at its documented 600 s instead of the SDK's 300 s. A custom http_client with its own timeout now times out at that value. Set the timeout model setting to choose a timeout per request.
    • MistralReasoningEffort gains 'minimal' and 'xhigh', so an exhaustive match on it stops type-checking.

    • MistralModel(json_mode_schema_prompt=...), SIMPLE_JSON_TYPE_MAPPING and VALID_JSON_TYPE_MAPPING now warn with PydanticAIDeprecationWarning. Use PromptedOutput(template=...) or the profile's prompted_output_template instead.

  • Support tool_choice='required' and forced output tools for GPT-5.6 Sol, GPT-6 Sol and Astra, and GPT-6.1 Sol and Terra on BedrockConverseModel by @dsfaccini in #15800
    • On BedrockConverseModel, requests with tools to GPT-5.6 Sol, GPT-6 Sol and Astra, and GPT-6.1 Sol and Terra now carry a toolChoice. A run with an output tool sends {'any': {}}, and function tools in a run that can end with text send {'auto': {}}. tool_choice='required' and a single forced tool are now sent instead of raising UserError. To keep the previous requests, pass profile={'bedrock_supports_tool_choice': False} to BedrockConverseModel.
  • End a UI stream with the protocol error event when the on_cancel callback raises by @dsfaccini in #15806
    • When a UI adapter's on_cancel callback raises, the stream now ends with the protocol's error event, such as AG-UI's RUN_ERROR or Vercel AI's error chunk, as an on_complete failure already does. Before, the exception propagated from run_stream(), dispatch_request() or transform_stream(). To keep the exception propagating, override on_error in a subclass of the adapter's event stream and re-raise it.
  • End an AG-UI stream at the RUN_ERROR that on_complete yields, and close on_complete and on_cancel generators when the stream is closed by @dsfaccini in #15819
    • On AG-UI, RUN_FINISHED no longer follows a RUN_ERROR that on_complete yields on a successful run. Calling aclose() on a UI adapter's event stream, such as the one AGUIAdapter.run_stream() returns, while an on_complete or on_cancel generator is suspended now runs that callback's finally before aclose() returns, and raises any exception the cleanup raises. Before, the cleanup ran later in another task and its exception went to the event loop's exception handler. To keep aclose() from raising, catch and log errors in the callback's finally.
  • Fail an AGUIAdapter resume that gives one interruptId two different answers, instead of applying the last by @dsfaccini in #15820
    • An AG-UI resume that lists one interruptId more than once with different answers now ends the run with a RUN_ERROR, and no tool runs. Before, the last entry's answer was applied. AGUIAdapter.deferred_tool_results raises UserError for such input. Send one ResumeEntry per interrupt with the user's final answer; repeating an identical entry still works.
  • Run a SubAgents delegation to self outside the durable unit on every durable engine by @DouweM in #15831
    • On Prefect and Render Workflows, a SubAgents run that delegates only to self and is in flight during the upgrade can't reuse its recorded delegate_task result. If the child's tools aren't idempotent, let such runs finish before upgrading.

🚀 Features

  • Support WebSearch and WebFetch with DeepSeek Flash through a new DeepSeekResponsesModel by @dsfaccini in #14962
  • Record Permissions allow/ask/deny decisions as span attributes, so a denied call is distinguishable in a trace by @mpfaffenberger in #14986
  • Add WorkLog and ResetCompaction, which clear the context and point the model at a searchable log of its earlier work by @dsfaccini in #14957
  • Make WrapUpAtLimits wrap up at cost_limit and before the run's timeout=, keeping output tools on the final request by @mpfaffenberger in #14164
  • Add ModelResponseRejectedEvent to set a rejected streamed response apart from the retry, in the event stream and the Vercel AI and AG-UI adapters by @dsfaccini in #15126
  • Re-send a nested instruction file that changed since RepoContext surfaced it by @dsfaccini in #15190
  • Let DynamicWorkflow run scripts on remote Monty workers with monty_sandbox by @adtyavrdhn in #14941
  • Fall back past a model whose profile can't serve the request, with a new ModelFeatureUnsupportedError by @DouweM in #14983
  • Mark output tool call and return parts with tool_kind='output' and add is_output_tool_part() by @DouweM in #14707
  • Route agent-graph waits through BaseDurabilityCapability.durable_sleep, making them durable on AWS Lambda, Absurd and pgtask by @DouweM in #13274
  • Send MP3 and MP4 tool results to gemini-4-neon inside its GoogleInteractionsModel function_result by @DouweM in #15065
  • Add a StructuredJudge evaluator that asks a judge typed questions and reports each answer, several in one request by @DouweM in #8529
  • Record when the model was asked and how long it took as ModelResponse.request_timestamp and ModelResponse.duration by @DouweM in #15345
  • Advertise models, embedded context, and coding tool cards in pax acp by @mpfaffenberger in #15739
  • Support WebSearch and WebFetch with DeepSeek Flash on Chat Completions through a new DeepSeekChatModel by @dsfaccini in #15664
  • Add Amazon Ergo 1.0 support on Bedrock Converse by @dsfaccini in #15757
  • Add Cloudflare Workers AI support by @dsfaccini in #10557
  • Let PostgresConversationStore run on a caller's connection=, so a save joins the application's transaction by @dsfaccini in #15814
  • Add HatchetDurability, a Hatchet durable execution backend by @DouweM in #15743
  • Run a Temporal wait's ask on the worker's copy of HandleDeferredToolCalls and AskUser, not the sandbox's by @DouweM in #15567
  • Send OpenAI web search results back on later requests with openai_include_web_search_results by @dsfaccini in #15773
  • Collapse context-gathering tool calls in Pax and drop the empty run_code header by @mpfaffenberger in #15305
  • Show AGENTS.md updated in the Pax status row after an instruction file reloads, and the appended text in /system_prompt by @dsfaccini in #15191
  • Add pax acp to serve Pax's stock agent over the Agent Client Protocol by @mpfaffenberger in #15139
  • Let Pax set a per-model context window in /model settings and default it from vLLM's max_model_len by @mpfaffenberger in #15134
  • Let Pax use a System One decision model for smart_search, relevance compaction, and a system_one tool by @mpfaffenberger in #15123
  • Add /auto-compact and threshold_tokens to set when Pax compacts automatically by @adtyavrdhn in #14929
  • Run a trailing positional prompt in pax, read it from stdin with -, and print non-string output as JSON with --output-format by @DouweM in #14702
  • Configure pax input bindings, queue delivery, and non-modal questions by @dsfaccini in #13162

🐛 Bug Fixes

  • Raise GraphBuildingError instead of AssertionError or a hang when GraphBuilder.build(validate_graph_structure=False) meets a join that no start node reaches by @dsfaccini in #15073
  • [mcp-context] Stop MCP sampling on a kept-alive stdio connection from hanging on the agent's own concurrency limiter by @pydanty in #14914
  • Accumulate streamed OpenAI text in linear time, and stop padding raw_content up to content_index by @dsfaccini in #15077
  • Run a union output function whose argument is a TypedDict or NewType instead of returning the argument by @pydanty in #14931
  • Stop graph.iter() waiting forever when override_next([]) drops a join's task while an outer join is open by @dsfaccini in #15117
  • Keep run_id and conversation_id stable when a durable run re-enters on Absurd, pgtask, AWS Lambda and Render by @mpfaffenberger in #14642
  • Stop CancelledError escaping async with graph.iter() when the run ends while other tasks still run by @dsfaccini in #15074
  • Raise a RuntimeError that names the map when a map's downstream_join_id is not the ID of a join by @dsfaccini in #15130
  • Cap fastmcp-slim below 4.2.6 so a dropped kept-alive stdio MCPToolset stops its server by @dsfaccini in #15177
  • Look up a Responses stream that ended before response.completed in the OpenAI conversation before openai_conversation_id trims through it by @dsfaccini in #15038
  • Say when a read_tool_result offset is past the end of a spilled result by @mpfaffenberger in #14982
  • Stream MistralModel content as text, not as an output tool call, when text output is allowed by @dsfaccini in #15129
  • Replace the Parent fork run not found error with one that names the join, its parent fork and the fix by @dsfaccini in #15092
  • Stream MistralModel content as text, not as an output tool call, when text output is not allowed by @dsfaccini in #15188
  • Leave no overrides in force when Agent.override() raises by @dsfaccini in #15144
  • Keep the parameters whose type hints resolve in the AgentSpec and Dataset JSON schemas by @dsfaccini in #14773
  • Run a union output function whose argument is Optional[...], X | None or a type alias, instead of raising TypeError or returning the argument by @dsfaccini in #15204
  • Fix new_messages() for a resumed run when a history processor removes or inserts a message after the request ReinjectSystemPrompt rebuilt by @dsfaccini in #15206
  • Fail a CodeMode run when a DBOS replay diverges inside run_code, and drop the elapsed-time limit under every durable engine by @adtyavrdhn in #13527
  • Mask secret_env in live shell output events by @adtyavrdhn in #15068
  • Record content in a durable unit only if the worker allows it by @adtyavrdhn in #14312
  • Keep a custom identifier on BinaryContent and FileUrl across AGUIAdapter round trips by @dsfaccini in #15212
  • Stop naming an agent self when one of its own methods calls run() or another entry point by @dsfaccini in #15219
  • Build each PartEndEvent from its own part, so a stream with many parts stays linear and a tool call without a name no longer ends the wrong part by @dsfaccini in #15210
  • Record a failed streamed model request's error on its chat span by @dsfaccini in #15203
  • Infer the agent name from the caller in Agent.iter, WrapperAgent.iter and WrapperAgent.compact_history by @dsfaccini in #15218
  • Stop a threaded run of an unnamed agent from raising AssertionError: Name already set by @dsfaccini in #15308
  • Point a failed run's pydantic_ai.new_message_index at the run's own messages in pydantic_ai.all_messages by @dsfaccini in #15209
  • Return an inline user image from AGUIAdapter.load_messages as BinaryImage, not plain BinaryContent by @dsfaccini in #15329
  • Answer 422, not 500, from UIAdapter.dispatch_request when a client file field fails validation by @dsfaccini in #15332
  • Stop keyed FileStepStore writes from re-reading every earlier snapshot file and event line by @DouweM in #15019
  • Run an argv named like a shell builtin as the program in DaytonaSandboxBackend and SpritesSandboxBackend by @DouweM in #15009
  • Match Skills include and exclude names after NFKC normalization, so a lowered skill selected with compatibility characters is offered by @DouweM in #14605
  • Stop OpenSandboxBackend from reattaching after every operation once aclose() ran mid-operation by @DouweM in #15006
  • Keep calls a tool deferred while running in the DeferredToolRequests that run_stream() ends on by @DouweM in #15062
  • Deliver EnqueuedMessagesEvent for content queued when a Temporal run continues as new by @DouweM in #14404
  • Carry a ModelFallback candidate's model-name string across the durable step boundary by @adtyavrdhn in #13249
  • Keep native tool returns ahead of function tool calls when AGUIAdapter loads messages by @adtyavrdhn in #13375
  • Summarize a history larger than SummarizingCompaction's summarizer window in chunks by @DouweM in #14824
  • Record ToolReturn.content as returned so durable runs reject non-UserContent items like plain runs by @DouweM in #14921
  • Refuse realtime sessions in durable workflow code, and document the supported recipe by @DouweM in #14526
  • Raise ModelConnectionError when a stream misses the finish_reason that openai_chat_streaming_requires_finish_reason requires by @DouweM in #14769
  • Attach a workspace a capability function supplies before for_run, so for_run can read ctx.workspace by @DouweM in #10528
  • Stop BackgroundTools advertising background calls in sequential runs, and warn that its tools run in the foreground by @DouweM in #14445
  • Record and count the usage of a streamed attempt the provider billed before it failed by @DouweM in #14399
  • Document how providers cache instructions, and pin GPT-6.2 leading-input instructions to OpenAI's own API by @DouweM in #14529
  • Close a discarded Vercel AI tool call with tool-input-error so the frontend doesn't run it by @DouweM in #14638
  • Correct the RunContext.model_settings docstring on what wrap_model_request sees after its handler by @dsfaccini in #15416
  • Handle strings holding a lone surrogate in ToolCallPart.args_as_dict() and ToolReturnPart.structured_content() by @dsfaccini in #15352
  • Stop GoogleInteractionsModel raising TypeError through a caller-built Client on an httpx2 client that sets no timeout by @dsfaccini in #15636
  • Classify a ChatGPT subscription's usage_limit_reached error as ModelQuotaExceededError by @DouweM in #15443
  • Answer 422 from AGUIAdapter.build_run_input for a lone surrogate when the body also carries unsupported content by @dsfaccini in #15605
  • Send reasoning_effort for thinking on mistral:mistral-large-latest, which is now Mistral Large 4 by @dsfaccini in #15648
  • Include a SpeechPart transcript in the plain-text output of run_stream() by @dsfaccini in #15656
  • Stop type names from one get_conflicting_type_names call leaking into FunctionSignature renders with another set by @dsfaccini in #15654
  • Close Agent, Provider, FallbackModel and MCPToolset when their exit runs inside a cancelled AnyIO scope by @dsfaccini in #15651
  • Raise clear errors for unsupported AudioUrl/ImageUrl/VideoUrl.format by @adtyavrdhn in #13374
  • Drop non-dict provider_details sent by a client to the Vercel AI and AG-UI adapters by @adtyavrdhn in #13367
  • Keep ToolReturn.tools when ToolOutputLimits reduces a result by @DouweM in #15462
  • Retry a FallbackModel on Temporal unless every model failed with a non-retryable error by @DouweM in #14770
  • Keep Prefect cache keys stable when a capability without an id contributes tools by @DouweM in #15340
  • Stop FallbackCompaction dropping a background summary that fits as stale by @DouweM in #15580
  • Return -32002 (Resource not found) for unknown ACP sessions by @mpfaffenberger in #15738
  • Move draft-07 definitions under $defs in strict tool schemas on plain AsyncAnthropic clients, so their $refs resolve by @dsfaccini in #15392
  • Inline tool schemas for DeepSeek V3.2 on Bedrock, which sends $ref object arguments as JSON strings by @DouweM in #15561
  • Fix MistralModel gaps: thinking on DeepSeek V4.1 Flash and GLM-5.3, strict tools, extra_headers, client timeouts, usage details and error mapping by @dsfaccini in #15691
  • Require opentelemetry-api>=1.37.0 in pydantic-evals so online evaluation events export by @dsfaccini in #15772
  • Refuse get_output() and stream_output() after StreamedRunResult.cancel() by @DouweM in #15545
  • End an AG-UI stream at the RUN_ERROR that an on_error override or on_cancel callback yields by @pydanty in #15399
  • Number the section tags in LLMJudge and GEval prompts when the judged content contains one by @dsfaccini in #15695
  • End a UI stream with the protocol error event when the on_cancel callback raises by @dsfaccini in #15806
  • Preserve Vercel AI ToolReturn metadata across serialization by @dsfaccini in #15780
  • Support tool_choice='required' and forced output tools for GPT-5.6 Sol, GPT-6 Sol and Astra, and GPT-6.1 Sol and Terra on BedrockConverseModel by @dsfaccini in #15800
  • Raise failed AWS credential refreshes as ModelConnectionError on Bedrock, so FallbackModel falls back by @pydanty in #15409
  • Restrict tool.uv.environments and the harness smol and boxlite extras to CPython by @dsfaccini in #15837
  • Release a run's deps by reference counting when a tool raises under end_strategy='exhaustive' by @dsfaccini in #15813
  • End an AG-UI stream at the RUN_ERROR that on_complete yields, and close on_complete and on_cancel generators when the stream is closed by @dsfaccini in #15819
  • Fail an AGUIAdapter resume that gives one interruptId two different answers, instead of applying the last by @dsfaccini in #15820
  • Add GPT-6.2 Sol and Astra to the Bedrock Converse profile gate by @pydanty in #14580
  • Keep the signature of a ThinkingPart without text in AG-UI streams by @pydanty in #15424
  • Run a SubAgents delegation to self outside the durable unit on every durable engine by @DouweM in #15831
  • Give durable model request hooks the guarded run context, so ctx.enqueue() refuses as in other durable hooks by @DouweM in #15343
  • Share the CompactOnRequest toolset with its per-run copies so durable engines accept it by @DouweM in #15394
  • Send gpt-oss's mid-conversation system prompts as <system> blocks on every host by @DouweM in #15427
  • Fall back to Pax's plaintext credential files when the Secret Service collection stays locked by @mpfaffenberger in #15143
  • Report Pax to herdr as pax, and let a distribution of Pax report its own name by @mpfaffenberger in #15136
  • Report Pax /compact token totals against the context size the status row shows by @mpfaffenberger in #15132
  • Keep Pax session-browser delete confirmation open across idle keyboard polls by @pydanty in #15094
  • Move Pax into the project directory of a resumed Claude Code or Codex session by @mpfaffenberger in #15093
  • Keep the extras Pax was installed with in /update and the install hints by @DouweM in #14814
  • Keep event loop errors, such as Windows WinError 10054 on socket teardown, off the pax TUI by logging them to asyncio.log by @mpfaffenberger in #14641
  • Fix relative docs links in the OpenAICompaction and two Anthropic docstrings that pointed one directory too shallow by @dsfaccini in #15091
  • Print Pax headless resume warnings to stderr by @pydanty in #15612
    Full Changelog: v2.77.0...v2.78.0

Don't miss a new pydantic-ai release

NewReleases is sending notifications on new releases.