Skip to main content
POST
/
v1
/
auto-swarm-builder
/
completions
Auto-Generate Agent Swarm
curl --request POST \
  --url https://api.example.com/v1/auto-swarm-builder/completions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "max_loops": 1,
  "execution_type": "return-agents",
  "model_name": "gpt-4.1",
  "task": "<string>",
  "max_tokens": 123
}
'
{
  "success": true,
  "job_id": "<string>",
  "outputs": {},
  "type": "auto-swarm-builder",
  "timestamp": "<string>",
  "usage": {}
}

Headers

x-api-key
string
required

Body

application/json

Schema for the Auto Swarm Builder input configuration.

Attributes: name (Optional[str]): The name of the swarm. description (Optional[str]): A description of the swarm. max_loops (Optional[int]): Maximum number of loops to run (default: 1). return_agents (Optional[bool]): Whether to return agents after building (default: True). model_name (Optional[str]): The model name to use for the swarm (default: "gpt-4.1"). generate_router_config (Optional[bool]): Whether to generate router configuration (default: False). task (Optional[str]): The main task for the swarm (required). max_tokens (Optional[int]): The maximum number of tokens to use for the swarm.

name
string | null

The name of the swarm.

description
string | null

A description of the swarm.

max_loops
integer | null
default:1

Maximum number of loops to run.

execution_type
enum<string> | null
default:return-agents

The type of execution to perform.

Available options:
return-agents,
return-swarm-router-config,
return-agents-objects
model_name
string | null
default:gpt-4.1

The model name to use for the swarm.

task
string | null

The task for the swarm, if any.

max_tokens
integer | null

The maximum number of tokens to use for the swarm.

Response

Successful Response

Schema for the Auto Swarm Builder API response.

Attributes: success (bool): Whether the swarm was built successfully. job_id (Optional[str]): The job ID of the swarm. outputs (Optional[dict]): The outputs of the auto swarms builder. type (Optional[str]): The type of the swarm execution. timestamp (Optional[str]): The timestamp of the swarm execution. usage (Optional[dict]): The usage statistics of the swarm execution.

success
boolean
required

Whether the swarm was built successfully.

job_id
string | null

The job ID of the swarm.

outputs
Outputs · object

The outputs of the auto swarms builder.

type
string | null
default:auto-swarm-builder

The type of the swarm execution.

timestamp
string | null

The timestamp of the swarm execution.

usage
Usage · object

The usage of the swarm execution.