CLI Commands Reference
This page provides detailed documentation for all Swarms CLI commands, including their parameters, usage examples, and common use cases. For a guided walkthrough, see the CLI Tutorial. For an end-to-end multi-agent workflow you can build right now, see the Quickstart Tutorial.Setup & Configuration Commands
init
Interactive project-scaffolding wizard. Creates a.env file with your API keys, a workspace directory, and runs validation. It does not create an agents.yaml.
Usage:
--dir(optional) — Project directory (default: prompted interactively)
- Prompts for a project directory (skipped when
--diris given; Enter uses the current directory) - Prompts for a
WORKSPACE_DIRlocation (default:<project_dir>/workspace) and creates it - Shows a table of nine providers (OpenAI, Anthropic, Google, Groq, Mistral, Together AI, Cohere, xAI, OpenRouter). Enter their numbers separated by commas,
all, or press Enter to skip, then paste each key at a hidden prompt - Optionally collects a
SWARMS_API_KEY, needed for--marketplace-prompt-id - Writes
.envto the project directory:WORKSPACE_DIR, the keys you entered, and commented-out placeholders for the rest - Validates the result: at least one provider key, the workspace directory, and the
.envfile
onboarding
Run a comprehensive environment setup check to verify your Swarms installation.onboarding prints a note and then runs exactly the same checks as setup-check.
Usage:
--verbose(optional) - Show detailed diagnostics and version detection steps
- Python version (requires 3.10+)
- Swarms version (the installed version; no update check)
- API keys: passes if at least one of
OPENAI_API_KEY,ANTHROPIC_API_KEY,GOOGLE_API_KEY, orCOHERE_API_KEYis set - Dependencies: tries to import
torch,transformers,litellm, andrich.torchandtransformersare not Swarms dependencies, so this row warns unless you installed them yourself - Environment file: a non-empty
.envin the current directory - Workspace directory:
WORKSPACE_DIRis set and exists. Importing Swarms creates./agent_workspaceand sets the variable when it is unset, so this check normally passes
setup-check
Runs the environment checks listed under onboarding. When every check passes, it prints a next-step tip. Usage:--verbose(optional) - Enable detailed output
get-api-key
Open your browser to retrieve API keys from the Swarms platform. Usage:https://swarms.world/platform/api-keys in your default browser.
check-login
Writes a local login marker and reports success. It does not contact the Swarms platform or validate any key: the first run writeslogged_in to ~/.cache/swarms/auth (mode 0600), and later runs find that file and print “Authentication verified”. Use swarms setup-check to see which API keys are set.
Usage:
Agent Creation & Execution Commands
agent
Create and run a custom agent with specified parameters. The task parameter is optional - if not provided, the CLI creates the agent and prints its configuration without running it (it does not start an interactive REPL). Useswarms chat if you want a live interactive session.
Usage:
--name- Name of the agent--description- Description of the agent’s purpose--system-prompt- System prompt defining agent behavior (can use--marketplace-prompt-idinstead)
--task- Task to execute (if omitted, the agent is created but not run)--model-name- LLM model to use (default: “gpt-5.4”, theAgentclass default; the--helptable’s “default: gpt-4” is out of date)--temperature- Temperature setting (0.0-2.0)--max-loops- Maximum loops (integer or “auto” for autonomous). Any other value exits with an error--interactive- After the first response to--task, keep prompting you for follow-up input (default: off, despite the--helptext)--no-interactive- Disable interactive mode (already the default)--verbose- Enable verbose output--streaming-on- Stream tokens to the terminal--context-length- Context window size--retry-attempts- Number of LLM retry attempts--return-step-meta- Accepted but has no effect;Agenthas no such parameter--dashboard- Print the agent’s configuration dashboard when it is created--autosave- Save agent state to disk after runs--saved-state-path- File name for saved state. A relative path is written inside the agent’s workspace directory,$WORKSPACE_DIR/agents/<agent-name>-<id>/--user-name- Username for the agent--mcp-url- MCP server URL to load tools from--marketplace-prompt-id- Fetch the system prompt from the Swarms marketplace (requiresSWARMS_API_KEY); replaces--system-prompt--auto-generate-prompt- Build the system prompt from the agent’s name, description, and existing prompt--dynamic-temperature-enabled- Vary temperature between loops--dynamic-context-window- Enable the dynamic context window.Agentturns this on by default, butswarms agentpassesFalseunless you give the flag--output-type- Output type (e.g., “str”, “json”)
chat
Start an interactive chat agent with optimized defaults for conversation. The agent runs withmax_loops="auto", temperature=1.0, dynamic temperature, and a dynamic context window. After each answer it prompts for your next message. Type exit, quit, bye, or q, or press Enter on an empty line, to end the session.
Usage:
--name- Agent name (default: “Swarms Agent”)--description- Agent description (default: “A Swarms agent that can chat with the user”)--system-prompt- Custom system prompt--model-name- LLM model to use (default: “gpt-5.1”)--task- Initial task/message to start the conversation
--temperature or --max-loops, are ignored by chat.
Examples:
Start a basic chat:
run-agents
Execute agents from a YAML configuration file. Usage:--yaml-file- Path to YAML configuration file (default: “agents.yaml”)
swarm_architecture section with a task: the command builds a SwarmRouter from the agents and runs that task. See the Configuration page for YAML file format.
load-markdown
Load agents from markdown files with YAML frontmatter, and print a table of the agents it built. The agents are not run, and they exist only for the duration of the command, so this is mainly a way to validate agent files. Usage:--markdown-path- Path to markdown file or directory
--concurrent- Concurrent processing defaults totrueand there is no--no-concurrentflag, so this is currently always on whether or not the flag is passed
name, description, model_name (or model), temperature, max_loops, mcp_url, and streaming_on from the frontmatter. The body becomes the system prompt.
Swarm Operations Commands
autoswarm
Generate and execute an autonomous swarm configuration based on a task. The command asks the model for a swarm spec, always writes it to disk as a ready-to-run Python file, and then runs it unless you pass--no-run.
Usage:
--task- Task description for the swarm--model- Model name for swarm generation (e.g., “gpt-5.4”). It has no default; omitting it fails with “Model name cannot be empty”
-o,--output- Output file path for the generated Python script-d,--output-dir- Directory to create the generated Python script in (created if missing; ignored when-ois given)--no-run- Only write the generated Python file; do not execute the swarm
-o, the file is named autoswarm_<swarm-name>.py, in --output-dir or the current directory.
Example:
heavy-swarm
Run HeavySwarm with specialized agents for complex task analysis. HeavySwarm breaks down tasks into questions and uses worker agents to process them. Usage:--task- Task for HeavySwarm to process
--loops-per-agent- Number of execution loops per agent (default: 1). Not accepted byHeavySwarm; see the warning above--question-agent-model-name- Model for question generation (default: “gpt-5.4”)--worker-model-name- Model for worker agents (default: “gpt-5.4”)--random-loops-per-agent- Enable random loops (1-10 range). Not accepted byHeavySwarm; see the warning above--verbose- Enable verbose output
llm-council
Run the LLM Council where multiple agents collaborate on a task, providing different perspectives and evaluating responses. The CLI uses the default council: four members ongpt-5.1, gemini-2.5-flash, anthropic/claude-sonnet-4-5, and xai/grok-4-1-fast-reasoning each answer, review and rank each other’s anonymized answers, and a gpt-5.1 chairman synthesizes the final response. Set keys for OpenAI, Google, Anthropic, and xAI before running it. See LLM Council.
Usage:
--task- Task or question for the council to process
--verbose- Show verbose output (default: False; the CLI’s--verboseflag is off unless passed, regardless ofLLMCouncil’s own internal default)
Discovery Commands
models
List, search, and inspect every LLM model available through LiteLLM. The catalog stays in sync as providers ship new models — no CLI update required. Usage:--provider <name>— Restrict the list to one provider (e.g.anthropic,openai,groq). The provider is the prefix before/in the model name, or inferred from names such asgpt-*,claude*, andgemini*--search <pattern>— Substring + fuzzy search by model name (up to 40 results)--info <model>— Show context window, capabilities, and per-1M-token pricing
--info takes precedence over --search, which takes precedence over --provider. The catalog is LiteLLM’s model map, so it reflects the LiteLLM version you have installed.
Examples:
List every model, grouped by provider:
--info, the CLI suggests the closest matches.
tips
Display random tips and tricks for using the CLI. The startup banner picks one tip per invocation; this command lets you pull them on demand. Usage:--count <n>— Number of distinct random tips to print (default: 1)--category <name>— Restrict to one of:commands,agents,swarms,models,pro,trivia,env,community--all— Print every tip in the selected category (or every category if none given)
⚡ Pro tip:, 💡 Did you know:, 🪄 Hint:, 🔥 Hot tip:, etc.) are randomized per render for visual variety.
Utility Commands
upgrade
Update Swarms to the latest version. Usage:pip install --upgrade swarms, using whichever pip is first on your PATH.
Command Categories
Global Help
-h/--help is available on the CLI as a whole:
swarms <command> --help prints the same full reference table rather than a filtered, command-specific view.
The --help table is hand-written and lags the parser: it omits the tips and models commands and their flags (--count, --category, --all, --search, --info, --provider) as well as the autoswarm flags -o, -d, and --no-run, and it lists stale defaults for --model-name and --interactive. This page reflects the parser. Every flag is accepted by every command, but each command only reads the flags documented for it here.
Running swarms with no command prints the banner followed by an argparse usage error.
Common Flags
Many commands support these common flags:--verbose— Enable detailed output--task— Specify a task to execute--model-name— Specify the LLM model foragentandchat(seeswarms modelsfor the catalog)--temperature— Control randomness (0.0-2.0)--max-loops— Set iteration limits (integer orauto)
Error Recovery
If a command fails, the CLI classifies the error and prints targeted recovery hints. For example:401 Unauthorized→ suggestsswarms initorswarms get-api-keymodel_not_found→ suggestsswarms models --search <name>- Missing
WORKSPACE_DIR→ suggestsswarms init 429 RateLimit→ suggests using a smaller--model-name- Network timeout → suggests
swarms setup-check --verbose
Next Steps
CLI Tutorial
A complete, hands-on tour of every command in order
Quickstart Tutorial
Build a real multi-agent workflow step by step
Configuration
YAML, markdown, and environment configuration
CLI Overview
Return to the CLI overview