Fan Out to Workers and Merge
Some tasks are several independent questions in one. Split the task, answer each piece on its own, then merge.
Implement orchestrate(llm, task, max_workers=4) returning {"subtasks": [...], "answer": str, "calls": int}.
- Plan. Ask the model to split
taskinto independent subtasks, as a JSON list of strings. Cap atmax_workers; if the reply is unparseable, treat the whole task as one subtask rather than failing. - Work. Ask the model to do each subtask. One call each, no shared context between them.
- Merge. One final call with every worker's output, asking for a single combined answer.
calls must therefore be len(subtasks) + 2. The tests check that arithmetic against the model's own call count, so no extra calls.