Operation Batching
Group related tool calls into a single model turn instead of issuing many small round-trips. Parallel tool calling, where supported, further reduces wall-clock time.
How It Works
If the agent needs to read three files, search a directory, and run a test, all requests are included in one assistant turn. The model receives all results together in the next turn, rather than alternating request/response for each operation.
Benefits
- fewer total turns per task
- lower cumulative prompt growth (system prompt and context are sent once per batch, not per call)
- reduced latency from fewer network round-trips
When to Use
Batch when operations are independent and their results are needed together to make the next decision. Do not batch when an early result would change which later operations are needed.
See Also
- Stateful Tracking in Agent Loops — batching is more effective when the agent tracks state across operations.
- Dynamic Tool Loading — batching reduces the per-turn cost of loading tools.
- Generator Invocation — one generator call replaces a whole sequence of individual file writes.
- Subagents as Context Firewalls — independent children share no context, which is what makes parallel dispatch of a batch possible.
- Event-Driven Waiting — one blocking wait instead of N polls is batching applied to the waiting half of a dispatch.
Tools
- OpenAI Parallel Tool Calls — API support for calling multiple functions in one assistant turn.
- AutoGen — multi-agent conversation framework that supports batched and parallel execution.