Multi-Agent vs Single Agent: This example covers batch processing for multi-agent swarms (
/v1/swarm/batch/completions). For batching single agent tasks, see Batch Agent Completions (Single Agent)./v1/swarm/batch/completions.This is ideal for:
- Evaluating the same swarm configuration across many tasks
- Running different swarm types side‑by‑side
- Large‑scale research, content generation, or analysis workloads
Quick Start: Batch Swarm Completion
Each item in the batch is a fullSwarmSpec (the same structure used for /v1/swarm/completions).
- Python
- TypeScript
- Rust
Interpreting the Response
The endpoint returns an array of results, one per item in the batch, in the same order as the request. Each entry is leaner than the single-swarm/v1/swarm/completions response — there is no job_id, swarm_type, or execution_time field, and the swarm’s output is under result, not output:
"status": "error" and a detail message instead of result/usage:
swarm_name, status, and usage.billing_info.total_cost for auditing, cost tracking, and monitoring across your batch workloads. Check each entry’s status before reading result — a failed swarm does not raise an HTTP error for the whole batch, it just reports "status": "error" in its own slot.