Skip to main content
Use Evolve Swarm to give each agent its own input files and sandbox. This guide summarizes a batch of support tickets, then combines the results into one report. Complete the Agent SDK quickstart first and keep EVOLVE_API_KEY set.

Process a batch

Pass one file map per worker to map. Each key is a filename; each value is its content. Here, each worker receives a different context/ticket.txt and writes output/summary.md. Save the JavaScript example as parallel.mjs, or the Python example as parallel.py.
Run the saved file. Each worker starts a billable agent run.
map returns one result per input, in input order. The example prints each successful worker’s summary and reports any failed items separately. concurrency limits active sandboxes across operations on this Swarm instance. The example allows two at once; the default is four. Remaining work waits for a free slot.

Combine the results

Pass results.success to reduce to combine successful outputs with one agent. It receives each worker’s files under context/item_<index>/, using the original input index. Add this after the map call. In Python, keep it inside the same async with block.
The report contains only successful workers’ summaries. Check results.error before treating it as a complete account of the batch.

Choose another operation

You can also pass bestOf / best_of to map to generate candidates for every input. This adds candidate and judge runs; concurrency still caps how many sandboxes run at once. See agent configuration for models and tools, or sessions to inspect previous runs.
Last modified on November 9, 2026