Skip to content

Commit a3e980a

Browse files
authored
fix: rename prepare_tools to _prepare_tools (#1789)
1 parent e990245 commit a3e980a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pydantic_ai_slim/pydantic_ai/agent.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ class Agent(Generic[AgentDepsT, OutputDataT]):
132132
The type of data output by agent runs, used to validate the data returned by the model, defaults to `str`.
133133
"""
134134

135-
prepare_tools: ToolsPrepareFunc[AgentDepsT] | None
136-
"""
137-
Function invoked on each step, allowing the tools to be modified and filtered out as needed.
138-
"""
139-
140135
instrument: InstrumentationSettings | bool | None
141136
"""Options to automatically instrument with OpenTelemetry."""
142137

@@ -154,6 +149,7 @@ class Agent(Generic[AgentDepsT, OutputDataT]):
154149
_system_prompt_dynamic_functions: dict[str, _system_prompt.SystemPromptRunner[AgentDepsT]] = dataclasses.field(
155150
repr=False
156151
)
152+
_prepare_tools: ToolsPrepareFunc[AgentDepsT] | None = dataclasses.field(repr=False)
157153
_function_tools: dict[str, Tool[AgentDepsT]] = dataclasses.field(repr=False)
158154
_mcp_servers: Sequence[MCPServer] = dataclasses.field(repr=False)
159155
_default_retries: int = dataclasses.field(repr=False)

tests/test_agent.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,3 +1968,10 @@ def test_agent_run_result_serialization() -> None:
19681968
# Check that we can load the data back
19691969
deserialized_result = adapter.validate_json(serialized_data)
19701970
assert deserialized_result == result
1971+
1972+
1973+
def test_agent_repr() -> None:
1974+
agent = Agent()
1975+
assert repr(agent) == snapshot(
1976+
"Agent(model=None, name=None, end_strategy='early', model_settings=None, output_type=<class 'str'>, instrument=None)"
1977+
)

0 commit comments

Comments
 (0)