Skip to content

Commit 87dc6fd

Browse files
committed
docs: re-add note on limiting tool executions in tools-advanced documentation
1 parent fba06eb commit 87dc6fd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/tools-advanced.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ When a model returns multiple tool calls in one response, Pydantic AI schedules
377377

378378
Async functions are run on the event loop, while sync functions are offloaded to threads. To get the best performance, _always_ use an async function _unless_ you're doing blocking I/O (and there's no way to use a non-blocking library instead) or CPU-bound work (like `numpy` or `scikit-learn` operations), so that simple functions are not offloaded to threads unnecessarily.
379379

380+
!!! note "Limiting tool executions"
381+
You can cap tool executions within a run using [`UsageLimits(tool_calls_limit=...)`](agents.md#usage-limits). The counter increments only after a successful tool invocation. Output tools (used for structured output) are not counted in the `tool_calls` metric.
382+
380383
## See Also
381384

382385
- [Function Tools](tools.md) - Basic tool concepts and registration

0 commit comments

Comments
 (0)