Swarms Documentation

repository·master·Indexed 27 days ago

https://github.com/kyegomez/swarms

An enterprise-grade multi-agent orchestration framework for reliable, scalable, and adaptive agentic workflows. Swarms supports sequential, concurrent, and hierarchical architectures, integrating with the Model Context Protocol (MCP) and various LLMs. It provides a comprehensive CLI for managing agents, running complex workflows like LLM Council and HeavySwarm, and automating configurations via YAML or Markdown.

Tokens
10.5K
Snippets
46
Records
75
Agent score
86%

What's inside Swarms

  1. Quick Start with Swarms CLI Examples

    master

    To run the provided shell script examples in the examples/cli/ directory, make them executable and run the setup check script:

    chmod +x *.sh
    ./01_setup_check.sh

    Alternatively, you can execute them directly using bash:

    bash 01_setup_check.sh
  2. Configure AI coding assistants with CLAUDE.md

    master

    To help AI coding assistants (Claude Code, Cursor, Windsurf, Continue, etc.) write idiomatic Swarms code without extra prompting, you can use the CLAUDE.md file provided in the repository.

    Action: Drop CLAUDE.md (or symlink it as AGENTS.md or .cursorrules) into your project directory. This file contains instructions on the Agent primitive, multi-agent architectures (including SequentialWorkflow, ConcurrentWorkflow, AgentRearrange, GraphWorkflow, MixtureOfAgents, HierarchicalSwarm, and SwarmRouter), tools, streaming, memory, and MCP integration.

  3. Access Swarms documentation for humans and AI

    master

    Swarms provides multiple documentation formats depending on your needs:

    • Main Documentation: Comprehensive guides, API references, and tutorials at docs.swarms.world.
    • LLM-ingestible Docs (llms.txt): A single, machine-readable index designed for AI coding assistants (like Cursor, Claude Code, or Windsurf) to consume the entire documentation in one fetch. Point your AI tool to https://docs.swarms.world/llms.txt to enable idiomatic code generation.
    • API Reference: Detailed per-class documentation for core components like Agent, SequentialWorkflow, ConcurrentWorkflow, AgentRearrange, GraphWorkflow, and SwarmRouter at docs.swarms.world/api.
    • Environment Setup: Guidance on API keys, model providers, and configuration at docs.swarms.world/environment-setup.
  4. Configure DockerHub Secrets for GitHub Actions

    master

    To enable the automatic building and pushing of Docker images via GitHub Actions, you must configure two specific repository secrets in GitHub. This requires a DockerHub account and an access token with 'Read & Write' permissions.

    Required Secrets

    Secret NameValueDescription
    DOCKERHUB_USERNAMEYour DockerHub usernameYour DockerHub username (e.g., kyegomez)
    DOCKERHUB_TOKENYour DockerHub access tokenThe access token created in DockerHub Security settings

    Setup Steps

    1. Create Token: Log in to DockerHub, go to SecurityAccess Tokens, click New Access Token, name it, and set permissions to Read & Write. Copy the token immediately.
    2. Add to GitHub: In your GitHub repository, navigate to SettingsSecrets and variablesActions and add the two secrets listed above using the New repository secret button.
  5. Install Swarms from source

    master

    To install from the source code, clone the repository and install the requirements manually.

    # Clone the repository
    $ git clone https://github.com/kyegomez/swarms.git
    $ cd swarms
    $ pip install -r requirements.txt
  6. Configure Swarms via Onboarding and API Keys

    master

    Manage your Swarms configuration and credentials using the following commands:

    • Interactive Onboarding: swarms onboarding starts the interactive onboarding process.
    • Retrieve API Keys: swarms get-api-key retrieves your configured API keys.
    • Verify Authentication: swarms check-login verifies your current login status.
    swarms onboarding
    swarms get-api-key
    swarms check-login
  7. Use specific versions of the Swarms Docker image

    master

    For production stability, pin your deployment to a specific version tag instead of using latest.

    # Pull a specific version
    docker pull kyegomez/swarms:v8.0.4
    
    # Run with specific version
    docker run --rm kyegomez/swarms:v8.0.4 python -c "import swarms; print(swarms.__version__)"
  8. Build the Swarms Docker image locally

    master

    To build the image from source, ensure you have Docker and Git installed. Clone the repository and use the docker build command.

    # Clone the repository
    git clone https://github.com/kyegomez/swarms.git
    cd swarms
    
    # Build the image
    docker build -t swarms:latest .
    
    # Test the image
    docker run --rm swarms:latest python test_docker.py
  9. Create an Autonomous Agent with `max_loops="auto"`

    master

    Setting max_loops="auto" allows an agent to decide when a task is complete. The agent will continue reasoning and acting until it reaches a stopping condition. This is ideal for open-ended research or iterative tasks (e.g., write $\rightarrow$ review $\rightarrow$ revise).

    For latency or cost-sensitive production pipelines with well-defined steps, use a fixed integer for max_loops instead.

    from swarms import Agent
    
    agent = Agent(
        agent_name="Autonomous-Research-Agent",
        agent_description="An autonomous agent that conducts multi-step research independently.",
        system_prompt=(
            "You are an autonomous research agent. Break down complex tasks into steps, "
            "execute each step thoroughly, and signal completion only when the full task is done."
        ),
        model_name="gpt-5.4",
        max_loops="auto",       # Agent decides when it's done — no fixed iteration cap
        autosave=True,
        verbose=True,
    )
    
    # The agent will keep looping — planning, executing, and reflecting — until it
    # determines the task is fully complete.
    result = agent.run(
        "Research the current state of quantum computing, identify the top three "
        "hardware approaches, and summarize the key challenges each faces."
    )
    print(result)
  10. Quick Start with Swarms Docker Image

    master

    You can quickly pull and run the latest Swarms image from DockerHub. Use the latest tag for general testing or run an interactive shell to explore the environment.

    # Pull the latest image
    docker pull kyegomez/swarms:latest
    
    # Run a simple test
    docker run --rm kyegomez/swarms:latest python test_docker.py
    
    # Run with interactive shell
    docker run -it --rm kyegomez/swarms:latest bash