Skip to main content
Premium Tier Required: The /v1/agent/batch/completions endpoint is restricted to Pro, Ultra, and Premium plan subscribers. Free tier users will receive a 403 error. Upgrade your account to access batch processing capabilities.
Single Agent vs Multi-Agent: This example covers batch processing for single agents (/v1/agent/batch/completions). For batching multi-agent swarms, see Batch Swarm Completions (Multi-Agent).
Batch size limit: A single request to /v1/agent/batch/completions accepts at most 10 AgentCompletion items. Requests with more than 10 items are rejected with an HTTP 400 error. To process larger volumes, split your work into chunks of 10 and submit multiple requests — see Batch Agent Completions at Scale for a chunking pattern.

What This Example Shows

  • Processing multiple agent tasks in a single request
  • Configuring different agents for different types of analysis
  • Efficient batch execution for multiple related tasks
  • Handling diverse task types with specialized agents

Quick Start

Batch Processing Benefits

  • Efficiency: Process multiple tasks in parallel
  • Cost Optimization: Reduce API call overhead
  • Consistency: Apply similar processing across multiple items
  • Scalability: Handle large volumes of work efficiently

Use Cases

Batch processing is ideal for:
  • Document Analysis: Review multiple contracts, reports, or documents
  • Data Processing: Analyze large datasets with multiple perspectives
  • Content Generation: Create variations of content for different audiences
  • Quality Assurance: Review multiple code files, designs, or content pieces
  • Customer Support: Process multiple support tickets with specialized agents

Expected Output

The batch processor will return results for each task:
  • Bloodwork analysis with diagnosis and recommendations
  • Radiology report summary in patient-friendly language
  • Each result maintains the structure and quality of individual agent runs

Environment Setup

Create a .env file in your project directory:

Advanced Batch Processing

You can extend this pattern to:
  • Dynamic Batching: Group similar tasks automatically
  • Priority Processing: Assign importance levels to different tasks
  • Result Aggregation: Combine multiple results into unified insights
  • Error Handling: Gracefully handle failures in individual batch items

Next Steps

After mastering batch processing, explore:
  • Multi-agent swarms for complex collaborative workflows
  • Sequential workflows for dependent tasks
  • Concurrent workflows for parallel execution
  • Agent routing for intelligent task distribution