SpreadSheetSwarm runs its agents at the same time and records each agent’s answer as a row: agent name, task, result and timestamp. You can give every agent the same task, or load agents from a CSV file where each row has its own task. With autosave=True, the rows are appended to a CSV file you can open in any spreadsheet tool.
Reference: SpreadSheetSwarm.
1. Run every agent on one task
Three analysts look at the same launch plan, each from its own angle:3 of 3 agents finished, then one answer per analyst. The agents run in parallel, so the run takes about as long as the slowest agent.
autosave is False by default, so this run writes nothing to disk.
2. Read the summary
run() returns a dict. Continuing from step 1:
Every
run() starts a fresh run_id, outputs and tasks_completed, so a second run returns only its own rows. export_to_json() returns the latest run as a JSON string with the same keys, minus the two timestamps.
3. Save rows to a CSV file
Withautosave=True, each run appends its rows to the CSV at save_file_path and writes a JSON copy of the summary to the swarm’s workspace folder. max_loops=2 runs every agent twice, one loop after the other, so this run makes four rows:
- The header row is written only when the file is new. Later runs append below it, each with its own
Run ID. - The swarm does not create the CSV’s folder. Create it first, as above.
- Without
save_file_path, the CSV is namedspreadsheet_swarm_run_id_<hex>.csvand goes in the workspace folder. - Each agent starts every loop on a fresh conversation, so loops are independent samples, not revisions.
4. Give each agent its own task from a CSV
A CSV withagent_name and task columns defines both the agents and their work. Pass it as load_path and call run() with no task. The other columns set the agent’s settings; description becomes the agent’s agent_description.
- With no
agentspassed, the firstrun()builds one agent per row with AgentLoader.run()with no task then callsrun_from_config(), which runs each agent on its own row’s task. - A blank cell leaves that setting at the
Agentdefault. Agents built from the CSV print their replies, sinceprint_ondefaults toTrue. - An agent whose name has no task in the CSV is skipped by
run_from_config(). - If you pass
agentsas well, callswarm.load_from_csv()yourself to add the CSV’s agents and tasks.
5. Spot a failed agent
One agent’s failure does not stop the others. Its row still appears, withresult set to "Error: " plus the error message, and it is not counted in tasks_completed:
autosave=True, the failed row is saved to the CSV too, so check the Result column for Error: when you read the file back.
Tips
- Give every agent a distinct
agent_name. Rows show only the name, and CSV tasks are matched to agents by name. - Set
print_on=Falseon agents you build yourself when you only want the rows. - Read token usage with
swarm.usage, which adds up every agent’s provider usage. - Pass at least
agentsorload_path. With neither, the constructor raisesValueError("No agents are provided.").
Next steps
- SpreadSheetSwarm reference
- AgentLoader, for the CSV columns an agent accepts
- ConcurrentWorkflow, to run agents in parallel without the spreadsheet bookkeeping