Skip to content

ToolOutput max_retries is unused. #4678

@CisterMoke

Description

@CisterMoke

Initial Checks

Description

The max_retries parameter from the ToolOutput class is never used. Initialization happens via the OutputToolset.build class method that returns an OutputToolset object with max_retries set to the default value of 1.
See

return cls(processors=processors, tool_defs=tool_defs)
and

Minimal, Reproducible Example

import os
os.environ["OPENAI_API_KEY"] = "XXXXX"

from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai.output import ToolOutput


class Foo(BaseModel):
    bar: str


agent = Agent(
    "openai:gpt-5.2",
    
    output_type=ToolOutput(Foo, max_retries=3)
)

print(agent.toolsets[0].output_schema.toolset.max_retries)
#> 1

Logfire Trace

No response

Python, Pydantic AI & LLM client version

  • Python:
  • Pydantic AI:
  • LLM provider SDK:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport that something isn't working, or PR implementing a fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions