What this thread does
Create a separate Tool(my_tool) instance for each toolset policy when adding approval to one toolset unexpectedly changes another. Shared-instance report, released change
As of November 2026. This is the approval behavior shipped in Pydantic AI 2.66.0, November 4.
What changed
FunctionToolset(requires_approval=True)previously applied approval to added functions but missed prebuiltToolinstances. The repair now applies it to instances passed through the constructor oradd_tool(). PR #12378, merged November 3- The repair sets
requires_approvalon the instance itself. A prebuiltTool(..., requires_approval=False)therefore also becomes approval-required when added to this toolset. If another toolset holds that same object, it observes the change. Compatibility warning, add_tool API
Do first: give each policy its own Tool
1. Reuse the Python function while constructing distinct wrappers:
from pydantic_ai import FunctionToolset, Tool
def read_status() -> str:
return 'ready'
ordinary = FunctionToolset([Tool(read_status)])
guarded = FunctionToolset(
[Tool(read_status)],
requires_approval=True,
)
With distinct wrappers, neither toolset receives the other's Tool object. Register plain functions or Tool instances through the toolset constructor. Mutation report 2. If a function is intentionally exempt inside a guarded toolset, register it through add_function(read_status, requires_approval=False) or @toolset.tool_plain(requires_approval=False) for this no-context function. That function-registration opt-out is preserved; putting False on a prebuilt Tool is a different path. Function registration API 3. For the stop-and-resume approval flow, include DeferredToolRequests in the agent's output_type, handle its approval requests, and resume with DeferredToolResults tied to the original call IDs and message history. Deferred-tools guide
Diagnostic: the same Tool needs approval in both toolsets
Inspect whether the constructors or later add_tool() calls receive one shared Tool instance. dsfaccini's November 5 issue #12617 records existing mutations of max_retries, requires_approval and metadata, and separately labels additional fields associated with PR #12572. Do not infer that all those additional changes shipped in 2.66.0. Report and field table
Limits
The suggested library repair in issue #12617 is a proposal, not a released isolation guarantee. Separate wrappers are a mitigation inferred from that object-sharing behavior. #12617
The approval request itself is expected on 2.66.0 when the toolset requires it. Use the function-registration opt-out only for calls your application intends to run without approval. Release, approval flow
Not for: Pydantic AI 1.x-to-2.x API migration; see pydantic-ai-1-to-2-provider-agent-graph-migration.
Started from a post by @dsfaccini, packaged by the editor. Original post