Overview
The Auto Agent Builder generates agent configurations from a task. You describe what you want accomplished; a single builder agent designs the smallest team that covers it and returns each agent’s name, description, system prompt, and model choice as ready-to-useAgentSpec entries.
Two things to know up front:
- It designs, it does not run. The response contains agent configurations only — no agents are constructed or executed, and nothing beyond the single builder call is billed. Pipe the returned roster into
/v1/swarm/completions(or any multi-agent endpoint) to actually run it. - Available on all tiers. Unlike its siblings Graph Workflow and Batched Grid Workflow, this endpoint is not premium-gated. It is billable, so your account needs a credit balance above $1.00.
POST /v1/auto-agent-builder/completions
Base URL: https://api.swarms.world (production) or your custom deployment URL
Architecture
The builder only designs the roster. Running it is a separate call you make yourself, shown dashed above.Authentication
All requests require an API key passed in thex-api-key header:
Input Parameters
AutoAgentBuilderInput Schema
Output Parameters
AutoAgentBuilderOutput Schema
Generated agent entries
Each entry inagents is a complete AgentSpec. The builder writes these four fields:
Every other
AgentSpec field with a non-null default is also present at that default, e.g. max_tokens: 16000, max_loops: 1 and role: "worker". Fields whose default is null are left out.
Usage Schema
Cost Calculation
The endpoint bills one builder-agent call:- Input and output tokens: priced at the builder’s model (
model_name, or the builder default) plus a 15% service fee - Flat builder-agent fee: $0.01 per request, however many agents it generates
total_cost = input_cost + output_cost + cost_per_agent. No night-time discount applies. The generated agents cost nothing until you run them. See Pricing to look up a model’s current price.
Error Responses
Examples
Minimal request
Exact roster size
Build a team, then run it
The returned roster round-trips unmodified into the swarm endpoint:Best Practices
- Let the builder decide the size.
max_agentsis a ceiling, not a target — the builder prefers the smallest team that covers the task. Reach fornum_agentsonly when you need an exact count. - Set runtime settings on the returned roster.
agent_kwargsdoes not reach the response, so set fields likemax_loopsormax_tokenson each returned agent before posting the roster. - Review before running. The roster is plain JSON — inspect or edit the system prompts and model choices before posting them to a completions endpoint, especially for cost-sensitive workloads.
Rate Limits
Standard tier-based rate limits apply. See Rate Limits.Support
- Documentation: https://docs.swarms.ai
- Email: kye@swarms.world
- Community: https://discord.gg/EamjgSaEQf