You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/agents.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -630,12 +630,14 @@ try:
630
630
agent.run_sync('Please call the tool twice', usage_limits=UsageLimits(tool_calls_limit=1))
631
631
except UsageLimitExceeded as e:
632
632
print(e)
633
-
#> The next tool call would exceed the tool_calls_limit of 1 (tool_calls=1)
633
+
"""
634
+
With the next tool call(s), the projected amount of tool calls (2) would exceed the limit of 1.
635
+
"""
634
636
```
635
637
636
638
!!! note
637
639
- Usage limits are especially relevant if you've registered many tools. Use `request_limit` to bound the number of model turns, and `tool_calls_limit` to cap the number of successful tool executions within a run.
638
-
- These limits are enforced at the final stage before the LLM is called. If your limits are stricter than your retry settings, the usage limit will be reached before all retries are attempted.
640
+
- The `tool_calls_limit` is checked before executing tool calls. If the projected total would exceed the limit, no tools from that batch are executed.
0 commit comments