﻿# Pydantic AI rejects a parallel tool batch before exceeding its limit

Pydantic AI checks tool_calls_limit before executing a parallel batch; a batch exceeding the remaining cap is rejected instead of partially consuming available slots.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-pydantic-ai-parallel-tool-budget/
Language: en

## Budget the evidence collection work

A research agent can search, extract passages and inspect document metadata. The number of successful tool executions is a useful boundary when each operation consumes a limited service resource. Pydantic AI's [agent guide](https://pydantic.dev/docs/ai/core-concepts/agent/) provides `tool_calls_limit` for this purpose. It differs from limiting model turns: a model response can request several tools, and a turn with no tool execution still contributes to the reasoning conversation.

## Understand the parallel-batch check

The guide states that the limit is checked before tool execution. If the model returns parallel tool calls that would exceed the cap, none of those tools execute. Do not assume that the framework selects an affordable prefix and silently drops the rest. A caller collecting source evidence should be prepared for rejection of the whole pending batch, including tools whose individual cost would have fit within the remaining allowance.

## Read the counter's defined scope

The [usage reference](https://pydantic.dev/docs/ai/api/pydantic-ai/usage/) defines the cap in terms of successful tool calls. It is not a universal cap on every network attempt an implementation can make inside a tool. A tool that performs several external reads can generate more service traffic than its one successful invocation suggests. Model request limits, token limits and application-level service controls describe other dimensions of the workload and should be reviewed separately.

## Preserve work when the limit interrupts execution

The [exception reference](https://pydantic.dev/docs/ai/api/pydantic-ai/exceptions/) describes `UsageLimitExceeded`; the run does not return an ordinary result when a usage limit is hit. It also documents capturing run messages to retain completed work. Capture the evidence already obtained and the pending batch identity where continuation is needed. Earlier external operations remain real operations; the later limit error does not undo them or invalidate their recorded observations.

## Leave a path to an accepted report

Define whether exhausted collection should produce an explicit partial report through application handling or stop pending more authorized work. [Task budgets](/journal/learn-codex-task-budgets/) explain the allowance, while [tool observations](/journal/learn-codex-tool-observation/) explain the evidence actually collected. A helpful operational record distinguishes completed calls, an unexecuted rejected batch and remaining information gaps. That record prevents a user from reading the configured cap as proof that exactly that many source checks succeeded.
