← Back to all projects

swarms

Python framework stocked with ready-made multi-agent patterns, not a minimal core to build on

OfficialApache-2.0
Stars
7.3k
Forks
1.1k
Open issues
485
Last commit
30 Oct 2026

What is swarms?

Swarms pairs one Agent class with a large stock of ready-made ways to run several agents together: a chain, a parallel fan-out, a directed graph, a director handing work to specialists, a panel that votes or debates. One router reaches fifteen of those shapes by name, so trying a different form of collaboration is usually an edit rather than a rewrite — though several also want a setting of their own, and one wants its three agents in a fixed order. Breadth is the cost as well as the appeal: in the 14.0.0 release the Agent constructor alone takes 89 named options, and the reference documentation has already drifted from the code on whether an agent's memory survives a restart. Read the defaults out of the source before the first production run, not out of the page that describes them.

What can you do with swarms?

  • Start with one agent and let it decide when to stop — max_loops=3 runs a fixed number of reasoning turns, while max_loops="auto" hands the stopping decision to the model, which keeps planning and acting until it declares the task done. Model names are LiteLLM identifiers, so an OpenAI, Anthropic or Groq id works as written, and fallback_models rotates through a list when the first one errors.
  • Give it tools and MCP servers — Plain Python functions with type hints and a description become callable tools — Swarms converts them into the schema the model sees. Setting mcp_url or mcp_urls points the agent at one or more MCP servers, whose tools then appear with no further configuration.
  • Add capabilities as markdown skill files — skills_dir points at a directory holding one folder per skill, each with a SKILL.md in Anthropic's Agent Skills format. On each run only the skills whose description matches the task are appended to the system prompt; call handle_skills() with no task to load every one of them instead.
  • Switch on memory that survives a restart — persistent_memory=True writes a MEMORY.md under the workspace directory, keyed by the agent's name so the next process started under that name picks it up. It is off by default, so nothing reaches disk unless you ask for it. Compression is separate and is on: in the 14.0.0 release it measures the running transcript against a fixed budget of 16,000 tokens rather than the model's own window, and overwrites whatever context_length you pass, so a summary replaces the transcript at roughly 14,400 tokens on every model. Where a memory file exists the raw log is copied to an archive folder first. long_term_memory takes a vector database instead when you want retrieval over external documents.
  • Compose agents into a swarm, then swap the shape by name — SequentialWorkflow passes each output to the next agent, ConcurrentWorkflow gives the same task to all of them, and AgentRearrange takes a flow string such as "researcher -> writer, editor" for anything in between. SwarmRouter dispatches fifteen shapes from one swarm_type name — a director delegating to workers, experts merged by an aggregator, a group chat, majority voting, a debate with a judge — but the name is not always enough on its own: AgentRearrange also needs its flow string, DebateWithJudge reads its three agents in pro, con and judge order, and BatchedGridWorkflow takes its list of tasks at run.
  • Express real dependencies as a graph — GraphWorkflow treats each agent as a node and each edge as a dependency, so a node runs only once everything upstream has finished and independent branches go in parallel without being asked. on_node_complete fires per node for progress reporting, and to_spec() writes out the topology and agent names without the agents themselves, so the shape of a workflow can live in version control.

Before you choose swarms

  • Tracing is on by default and, per the project's own documentation, records the task text, the agent's output and the full constructor configuration including system prompts; one environment variable turns it off.
  • Once a graph workflow is given a checkpoint directory its saved progress is keyed by the task text alone, so in the 14.0.0 release a repeat run of the same task resumes rather than starting over.Reported in#1762

Star history

17 Aug to 30 Oct · +274

7.1k7.3k

Frequently asked questions

Is swarms free for commercial use?

swarms is released under the Apache-2.0 licence — OSI-approved open source, which permits commercial use.

How can swarms be deployed?

swarms is available as Self-hosted / Managed cloud.