> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.world/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Examples

> Practical Swarms CLI examples for setup, agents, YAML teams, and troubleshooting

Command reference: [CLI Commands](https://docs.swarms.world/cli/commands.md). Tutorial walkthrough: [CLI Tutorial](https://docs.swarms.world/cli/tutorial.md).

## Getting started

### Help and onboarding

```bash theme={null}
swarms --help
swarms onboarding
swarms get-api-key
swarms setup-check
```

`setup-check` validates Python version, package install, API keys, dependencies, and workspace configuration. The checks are local: they confirm a key is set, not that the provider accepts it. It also shows whether `SWARMS_API_KEY` is set. That key is optional, so the row never fails.

## Single-agent examples

### Research agent

```bash theme={null}
swarms agent \
  --name "Research Assistant" \
  --description "AI research specialist" \
  --system-prompt "You are an expert research assistant. Provide structured, evidence-based answers." \
  --task "Summarize key quantum computing breakthroughs from the last two years" \
  --model-name "claude-sonnet-4-6" \
  --temperature 0.1 \
  --max-loops 3
```

### Code review agent

```bash theme={null}
swarms agent \
  --name "Code Reviewer" \
  --description "Reviews code for security issues" \
  --system-prompt "You are a senior engineer focused on security and best practices." \
  --task "Review this code for vulnerabilities: def process(data): return eval(data)" \
  --model-name "claude-sonnet-4-6" \
  --temperature 0.05 \
  --max-loops 2 \
  --verbose
```

### Agent with MCP

```bash theme={null}
swarms agent \
  --name "MCP Agent" \
  --description "Answers questions with MCP tools" \
  --system-prompt "Use MCP tools when they help answer the task." \
  --task "Find recent news about climate policy and summarize findings" \
  --model-name "claude-sonnet-4-6" \
  --mcp-url "https://your-mcp-server.example/sse" \
  --max-loops 5
```

## Multi-agent from YAML

Create `research_team.yaml`:

```yaml theme={null}
agents:
  - agent_name: "Data Collector"
    model_name: "claude-sonnet-4-6"
    system_prompt: "Gather and organize relevant information."
    temperature: 0.1
    max_loops: 3
  - agent_name: "Data Analyzer"
    model_name: "claude-sonnet-4-6"
    system_prompt: "Analyze data and extract insights."
    temperature: 0.2
    max_loops: 4
  - agent_name: "Report Writer"
    model_name: "claude-sonnet-4-6"
    system_prompt: "Write a clear report from the analysis."
    temperature: 0.3
    max_loops: 3

swarm_architecture:
  name: "Research-Team-Swarm"
  description: "Collect data, analyze it, and write a report"
  swarm_type: "SequentialWorkflow"
  task: "Research the current state of solid-state batteries"
```

Run:

```bash theme={null}
swarms run-agents --yaml-file research_team.yaml
```

## Load agents from Markdown

```bash theme={null}
swarms load-markdown --markdown-path ./agents/researcher.md
```

Each `.md` file uses frontmatter for `name`, `description`, `model_name`, `temperature`, `max_loops`, `mcp_url`, and `streaming_on`, and a body used as the system prompt. The command builds and lists the agents without running them.

> [!WARNING]
>
> In Swarms 15.0.3, passing a directory to `--markdown-path` fails with `Unsupported file type`. Load one file at a time.

## Deep analysis

`swarms heavy-swarm` currently fails on every run with a `TypeError`, because the CLI passes `loops_per_agent` and `random_loops_per_agent` to a `HeavySwarm` constructor that no longer accepts them. Use the [Python API](https://docs.swarms.world/api/heavy-swarm.md) instead. `swarms llm-council --task "..."` works, and needs OpenAI, Google, Anthropic, and xAI keys for its default members.

## Configuration templates

```yaml theme={null}
# simple_agent.yaml
agents:
  - agent_name: "Simple Assistant"
    model_name: "claude-sonnet-4-6"
    system_prompt: "You are a helpful AI assistant."
    temperature: 0.7
    max_loops: 1

swarm_architecture:
  name: "Simple-Assistant-Swarm"
  description: "A single general-purpose assistant"
  swarm_type: "SequentialWorkflow"
  task: "Hello, world!"
```

## Troubleshooting

| Issue | What to try |
| - | - |
| Auth errors | `swarms setup-check` to see which keys are set, then verify them in `.env` |
| Missing workspace | `export WORKSPACE_DIR=/path/to/workspace` |
| Command not found | `pip install -U swarms` and confirm CLI on `PATH` |

## Related

* [CLI Commands](https://docs.swarms.world/cli/commands.md)
* [CLI Configuration](https://docs.swarms.world/cli/configuration.md)
* [Quickstart tutorial](https://docs.swarms.world/examples/cli/quickstart-tutorial.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.