Skip to content
Agentmart
Submit a tool

CLAUDE.md · kyegomez/swarms

CLAUDE.md from kyegomez/swarms: 1180 lines covering Installation & Setup, Project Layout, Core Primitive: Agent, Memory & Persistence (v12) and more.

Template by kyegomez

IndexedApache-2.0★ 7,291
Write a review

Install

Works with Claude Code. Read the repository before you give any tool access to your data.

curl -fsSL https://raw.githubusercontent.com/kyegomez/swarms/master/CLAUDE.md -o CLAUDE.md

Read it and adapt it to your project before use.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The CLAUDE.md file that kyegomez/swarms (7,291 stars) keeps for coding agents. It has 1180 lines in 18 sections: Installation & Setup; Project Layout; Core Primitive: Agent; Memory & Persistence (v12); Tools; Streaming; Multi-Agent Structures; Utility Execution Helpers; Async Support; MCP Tool Integration; Conversation Management; Choosing the Right Structure; Common Patterns & Recipes; Contributing: WARP Git Messages (required); Contributing: Disclose AI authorship (required); Contributing: Update the framework docs (required); Comments: one line, only when needed; What to Avoid. Use it as a model for your own project's instructions.

Use cases: prompt-engineering

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

What's in it

A CLAUDE.md file: project memory Claude Code loads at the start of every session.

For
Claude Code
Length
1,180 lines
File
CLAUDE.md

Sections

  1. Installation & Setup
  2. Project Layout
  3. Core Primitive: Agent
  4. Memory & Persistence (v12)
  5. Tools
  6. Streaming
  7. Multi-Agent Structures
  8. Utility Execution Helpers
  9. Async Support
  10. MCP Tool Integration
  11. Conversation Management
  12. Choosing the Right Structure
  13. Common Patterns & Recipes
  14. Contributing: WARP Git Messages (required)
  15. Contributing: Disclose AI authorship (required)
  16. Contributing: Update the framework docs (required)
  17. Comments: one line, only when needed
  18. What to Avoid

First lines (shown under the repo's Apache-2.0 license)

# CLAUDE.md — Swarms Framework Guide

This file teaches you how to build agents and multi-agent systems with the **Swarms** framework. Read it before writing any code in this repo.

## Live documentation

This file can lag the code. For current signatures and pages, query the docs MCP server or the plain-text docs:

Two hosted MCP servers give an assistant live Swarms context instead of training data that may predate a rename:

| Server | URL | Key | What it does |
|---|---|---|---|
| Docs | `https://docs.swarms.world/mcp` | none | Searches and reads the current documentation |
| Marketplace | `https://swarms.world/mcp` | Swarms API key for calls | Searches, reads and publishes agents, prompts and tools on [swarms.world](https://swarms.world) |

The whole documentation is also available as plain text at [docs.swarms.world/llms.txt](https://docs.swarms.world/llms.txt) (an index) and [docs.swarms.world/llms-full.txt](https://docs.swarms.world/llms-full.txt) (every page).

Claude Code:

```bash
claude mcp add --transport http swarms-docs https://docs.swarms.world/mcp
claude mcp add --transport http swarms-marketplace https://swarms.world/mcp \
  --header "Authorization: Bearer $SWARMS_API_KEY"
```

Cursor, in `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "swarms-docs": { "url": "https://docs.swarms.world/mcp" },
    "swarms-marketplace": {
      "url": "https://swarms.world/mcp",
      "headers": { "Authorization": "Bearer ${env:SWARMS_API_KEY}" }
    }
  }
}
```

---

## Installation & Setup

```bash
pip install swarms
```

Set your LLM API key as an environment variable before running:

```bash
export OPENAI_API_KEY="sk-..."        # OpenAI / GPT models
export ANTHROPIC_API_KEY="sk-ant-..." # Claude models
export GROQ_API_KEY="..."             # Groq
# Any provider supported by LiteLLM works
```

All imports come from the top-level `swarms` package:

```python
from swarms import (
    Agent,
    SequentialWorkflow,
    ConcurrentWorkflow,
    AgentRearrange,
    GraphWorkflow,
    SwarmRouter,
    MixtureOfAgents,
    HierarchicalSwarm,
    GroupChat,
    MajorityVoting,
    # ...
)
```

---

## Project Layout

```
swarms/
├── swarms/
│   ├── structs/         # All agent + multi-agent structures (61 files)
│   │   ├── agent.py             # Core Agent class
│   │   ├── conversation.py      # Conversation / memory management
│   │   ├── sequential_workflow.py
│   │   ├── concurrent_workflow.py
│   │   ├── agent_rearrange.py
│   │   ├── graph_workflow.py
│   │   ├── swarm_router.py      # Single-entry-point router
│   │   ├── mixture_of_agents.py
│   │   ├── hiearchical_swarm.py
│   │   ├── groupchat.py
│   │   ├── majority_voting.py
│   │   ├── council_as_judge.py
│   │   ├── debate_with_judge.py
│   │   ├── heavy_swarm.py
│   │   ├── round_robin.py
│   │   ├── planner_worker_swarm.py
│   │   ├── auto_swarm_builder.py
│   │   └── multi_agent_exec.py  # run_agents_concurrently + friends
│   ├── tools/           # Tool utilities, MCP, schema conversion
│   └── utils/           # Logging, formatting helpers
├── examples/            # 586 runnable examples
│   ├── single_agent/
│   ├── multi_agent/
│   ├── tools/
│   └── guides/
└── v12_examples/        # New v12 feature examples
```

Look in `examples/` first before writing new code — there is almost certainly an existing example close to what you need.

---

## Core Primitive: Agent

`Agent` is the single building block everything else composes. All multi-agent structures wrap one or more `Agent` instances.

### Minimal agent

```python
from swarms import Agent

agent = Agent(
    agent_name="Analyst",
    model_name="gpt-5.4",
    max_loops=1,
)

result = agent.run("Summarise the current state of LLM research.")
print(result)
```

### Key constructor parameters

| Parameter | Type | Default | Purpose |
|---|---|---|---|
| `agent_name` | str | `"swarm-worker-01"` | Unique name — used for memory file paths |
| `agent_description` | str | generic | Shown to orchestrators for routing |
| `system_prompt` | str | built-in | The agent's persona / instructions |
| `model_name` | str | `"gpt-5.4"` | Any LiteLLM model string |
| `max_loops` | int \| `"auto"` | `1` | Loops before returning; `"auto"` = autonomous until done |
| `tools` | list[Callable] | `None` | Python functions the agent can call |
| `streaming_on` | bool | `False` | Stream tokens to stdout |
| `interactive` | bool | `False` | REPL mode — prompt user for input each loop |
| `context_length` | int | `None` | Token budget; triggers compression at 90 % |
| `context_compression` | bool | `True` | Auto-summarise when near context limit (v12) |
| `persistent_memory` | bool | `False` | Read/write MEMORY.md across restarts (v12); opt in explicitly |
| `temperature` | float or None | `None` | Sampling temperature; omitted from requests when unset |
| `max_tokens` | int | model's max output | Max tokens per LLM call. Unset resolves to the model's own output limit |
| `reasoning_effort` | str | `None` | `"low"`, `"medium"`, `"high"` for reasoning models |
| `thinking_tokens` | int | `None` | Extended thinking budget (Claude) |
| `output_type` | str | `"str-all-except-first"` | How to format returned output |
| `mcp_url` | str | `None` | MCP server URL to load tools from |
| `handoffs` | list | `None` | Agents this agent can hand off to |
| `plan_enabled` | bool | `False` | Generate a plan before execution |
| `autosave` | bool | `False` | Save agent state to disk after each run |

### Autonomous loop (`max_loops="auto"`)

Signals

Stars
7,291
Forks
1,051
Open issues
167
Last commit (this folder)
Oct 14, 2026 (14 days ago)
Last release
Dec 27, 2024 (1 year ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

CLAUDE.md · kyegomez/swarms. Agent Mart. https://agentmart.dev/templates/kyegomez-swarms-claude-md (last updated 2026-10-24)