What This Example Shows
- A
choicequestion that picks theswarm_typefor a task - A
/v1/swarm/completionsrun of three copywriter agents with that swarm type - A second
choicequestion, whose options are the agent names, that picks the best draft from the swarm’soutput - What each step cost in a live run on production
Why This Matters
A swarm gives you several outputs, and someone still has to choose the architecture before the run and the winner after it. Hard-coded rules get both wrong as tasks vary, and asking another LLM agent to choose costs as much as a swarm member and returns prose. A decision model makes each choice for about $0.00002 and returns probabilities you can log, compare and threshold.Step 1: Setup
decide sends one decision completion and returns its answers.
Step 2: Pick the Swarm Type
Each option’s description tells the model when that architecture fits.Step 3: Run the Swarm
Three copywriters with different styles each write a draft. The swarm’soutput holds one {"role", "content"} message per agent, so drafts maps each agent’s name to its draft.
Step 4: Pick the Best Draft
The options are the agent names mapped toNone, so the model compares the drafts in the state rather than option descriptions.
The Live Run
The script above, run on production withgpt-5-mini:
Both decisions together cost about $0.00006, under 0.2% of the swarm run.
Other Decisions to Hand Off
The samechoice and noul questions fit other points in a multi-agent pipeline:
- Which specialist agent to call: a
choicewhose options are your agents’ names and descriptions, so only one agent runs instead of all of them. - Which
model_nameto use: achoicebetween a small and a large model, so hard tasks get the large model and easy ones stay cheap. - Whether the output needs another loop: a
noulon the swarm’s output, such as “Does this fully meet the brief?”, before you run it again with feedback.
Next Steps
- Gate and Judge an Agent: the same pattern around a single agent
- Available Multi-Agent Architectures: every
swarm_typeyou can offer as an option - Decision Models and SystemOne Reference: question types, errors and pricing