swarms
Python framework stocked with ready-made multi-agent patterns, not a minimal core to build on
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=3runs a fixed number of reasoning turns, whilemax_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, andfallback_modelsrotates 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_urlormcp_urlspoints the agent at one or more MCP servers, whose tools then appear with no further configuration. - Add capabilities as markdown skill files —
skills_dirpoints at a directory holding one folder per skill, each with aSKILL.mdin Anthropic's Agent Skills format. On each run only the skills whose description matches the task are appended to the system prompt; callhandle_skills()with no task to load every one of them instead. - Switch on memory that survives a restart —
persistent_memory=Truewrites aMEMORY.mdunder 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 whatevercontext_lengthyou 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_memorytakes a vector database instead when you want retrieval over external documents. - Compose agents into a swarm, then swap the shape by name —
SequentialWorkflowpasses each output to the next agent,ConcurrentWorkflowgives the same task to all of them, andAgentRearrangetakes a flow string such as"researcher -> writer, editor"for anything in between.SwarmRouterdispatches fifteen shapes from oneswarm_typename — 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:AgentRearrangealso needs its flow string,DebateWithJudgereads its three agents in pro, con and judge order, andBatchedGridWorkflowtakes its list of tasks at run. - Express real dependencies as a graph —
GraphWorkflowtreats 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_completefires per node for progress reporting, andto_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
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.