Agent orchestration and swarm management for multi-agent development
Project description
AgentSwarm
AgentSwarm is a lightweight orchestration layer for coordinating multiple AI agent CLIs inside a codebase. It assumes you already generated project scaffolding (specs, task markdown, etc.) using the multi-agent template, and gives you tools to:
- Deploy agent processes from a single configuration file.
- Assign / redirect tasks programmatically using each agent's non-interactive CLI.
- Monitor progress and state through persistent deployment metadata (and optional workflow execution).
The system deliberately separates three layers:
| Layer | Responsibility | Git folders |
|---|---|---|
| Planning Template | Generate specs/tasks for each agent | specs/, .agents/*/tasks.md |
| AgentSwarm Runtime | Launch agents, manage processes, run workflows | src/agentswarm, agentswarm, .agentswarm/ |
| Management CLI (optional) | Real-time interventions (fix/modify/assign tasks) | scripts/, future agent_cli/ |
Quick Start
# 1. Create / update agentswarm.yaml (see below)
# 2. Install dependencies
./install.sh
# 3. Launch a swarm using the local config
./agentswarm deploy
# 4. Inspect status
./agentswarm status
# 5. Stop / scale / run workflows as needed
./agentswarm scale codex 1
./agentswarm workflow list
AgentSwarm persists deployment metadata in .agentswarm/state.json, so the CLI can always report which agents are running and with which configuration.
Command templates for agent CLIs
AgentSwarm runs each agent through its CLI launcher. To keep things non-interactive, configure the correct pattern per agent inside agentswarm.yaml:
agents:
codex:
instances: 2
command_template: "codex exec '{task}'"
gemini:
instances: 1
command_template: "gemini -p '{task}'"
qwen:
instances: 1
command_template: "qwen -p '{task}'"
claude:
instances: 1
command_template: "claude -p '{task}'" # if your Claude CLI supports -p
| Agent CLI | Non-interactive pattern | Example command |
|---|---|---|
| Codex | codex exec "…" |
codex exec "Implement cache layer" |
| Gemini | gemini -m <model> -p "…" |
gemini -m 1.5-pro-latest -p "Summarize feedback from tasks.md" |
| Qwen | qwen -p "…" |
qwen -p "Add pagination to list results" |
| Claude | claude -p "…" |
claude -p "Review architecture for blockers" |
With those templates in place, AgentSwarm can hand any task string to the agent without prompting for interactive input.
Run agentswarm doctor any time you need to validate that command templates and dependencies are wired up correctly. It will highlight missing command_template values, dependency gaps, or assignment-rule sync issues before you start a deployment.
Available placeholders inside command_template:
{task}→ Primary task payload (single entry or all tasks joined with&&){task_list}→ Tasks joined by spaces (useful for argument lists){tasks_json}→ JSON array of every task string{project}→ Absolute path to the project root passed via--project{agent}/{instance}→ Agent type and instance id at runtime
Local-first CLI workflow
AgentSwarm includes dedicated command groups for managing the local-first task system alongside deployment orchestration.
agentswarm task
| Command | Description |
|---|---|
agentswarm task create "Add loading spinners" --agent codex --scope frontend/ |
Creates a local-### task and appends it to the correct agent section. |
agentswarm task list --status pending --format json |
Lists tasks with optional filters; JSON output makes it easy to feed other automations. |
agentswarm task start local-003 --no-git |
Marks the task as in_progress, opening a work session without creating a new branch. |
agentswarm task complete local-003 --skip-qa |
Runs QA commands (unless skipped) and records the completion in .local-state/active-work.json. |
agentswarm task status / agentswarm task resume |
Summarises backlog counts and resumes the most recent work session automatically. |
agentswarm spec
| Command | Description |
|---|---|
agentswarm spec create-feature "Realtime metrics" --requires-frontend --agent codex --agent claude |
Generates a spec-kit compatible folder with spec.md, plan.md, tasks.md, and implementation/ scaffolding. |
agentswarm spec list-features |
Enumerates existing feature folders under specs/. |
agentswarm spec validate feature-name |
Ensures required files and implementation subdirectories exist. |
agentswarm local
| Command | Description |
|---|---|
agentswarm local init |
Bootstraps .local-state/ with README + state files. |
agentswarm local status |
Shows pending/in-progress/completed counts plus the next actionable task. |
agentswarm local validate |
Checks for missing dependency references or uninitialised state. |
agentswarm agents assign
Push new task payloads into a running deployment without redeploying:
agentswarm agents assign codex --tasks "specs/payment-flow/tasks.md#codex,docs/ADR-009.md"
The orchestrator persists the updated task list next to each process in .agentswarm/state.json, so agentswarm agents list --format json reports commands, PIDs, and task assignments alongside process health.
Example task payload
Most teams keep human-readable task lists in specs/<feature>/tasks.md or .agents/<agent>/tasks.md. You can feed those files to the agents by putting instructions in the command template:
command_template: "gemini -m 1.5-pro-latest -p \"Read specs/payment-flow/tasks.md, find all tasks tagged @gemini, execute them sequentially\""
That results in commands such as:
gemini -m 1.5-pro-latest -p "Read specs/payment-flow/tasks.md, find all @gemini tasks, execute them sequentially"
Deployment guidance from the CLI
agentswarm deploy --guideprints the deployment matrix plus each agent'scommand_template, so you can confirm non-interactive invocation before launching anything.agentswarm deploy --dry-runstill shows the classic plan table; it now adds follow-up suggestions for monitoring and workflow commands.agentswarm doctor --check-commands --verify-tasksconfirms referenced binaries are onPATHand that every task file listed in your config exists.- Task ownership stays inside the markdown specs: agents parse
## @agentsections inspecs/.../tasks.md. The CLI never injects@codexor@claudeinto command strings—it simply hands each agent the file/anchor to read. - Template sync CI can skip the richer CLI smoketests by leaving
AGENTSWARM_RUN_TEMPLATE_TESTSunset. SetAGENTSWARM_RUN_TEMPLATE_TESTS=1when you want the full suite (guide + doctor validations) to run locally or in a release pipeline.
The repository ships with a starter specification at specs/default/tasks.md, which maps to the default agentswarm.yaml. Update those files (or generate new ones from Spec Kit) before handing work to the swarm.
Management / Intervention CLI (concept)
While the runtime keeps agents alive, project managers often need to redirect them mid-flight. A simple Click CLI can sit on top of AgentSwarm to do that:
# scripts/agent_cli.py (simplified)
@click.group()
def agent():
"""Intervene with active agents"""
@agent.command()
@click.argument("agent_type")
@click.argument("instruction")
def fix(agent_type, instruction):
subprocess.run(f"{agent_type} -p 'URGENT FIX: {instruction}'", shell=True)
The template includes example commands (fix, modify, assign, reassign, standup, etc.) that you can expand. Hook this into your workflow by adding a top-level scripts/agent wrapper that calls the Click CLI.
Repository structure
agentswarm/ # base wrapper script (creates venv if present)
bin/ # (in template) holds the runtime wrapper when deployed
src/agentswarm/ # core runtime + workflow engine
├─ core/ # process orchestration (deploy/scale/monitor)
├─ workflows/ # optional workflow execution layer
└─ lib/ # shared helpers (moved from top-level lib/)
scripts/intelligent-auto-deploy.sh
# copies only runtime assets into template/agentswarm
install.sh # developer installer: venv + requirements
requirements.txt # python dependencies
VERSION # semantic-release updates this JSON payload
Development and deployment
- Install:
./install.sh(createsvenv/and installs requirements) - Run lint/tests:
pytest tests/backend - Deploy to template: The GitHub Actions workflow (.github/workflows/version-management.yml) uses semantic-release to bump
VERSIONand then syncs the minimal payload (src/,bin/agentswarm,install.sh,requirements.txt,VERSION) into the template repository.
The deployment script deliberately excludes development directories such as specs/, .github/, tests/, .vscode/, ensuring the template only receives runtime assets.
Next steps
- Add your own management CLI commands under
scripts/to record interventions. - Extend
agentswarm.yamlwith additional agents or workflows. - Use
./agentswarm workflow ...to run multi-agent workflows defined insrc/agentswarm/workflows/templates.py.
For more details, see the template documentation in templates/ and the DevOps README (synced via devops repo) for CI/CD integration.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multiagent_agentswarm-1.2.1.tar.gz.
File metadata
- Download URL: multiagent_agentswarm-1.2.1.tar.gz
- Upload date:
- Size: 60.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff85699b8df8bb89b23a4cbb27cd8bcd800e9e13f912ad01910c6eeb2fc155a6
|
|
| MD5 |
e4721325e6c22b099e87b4b4217fe41b
|
|
| BLAKE2b-256 |
4e5834315fcecf4e772ef4bee7a1f728df56ecdda5d0aa2277f7068de10fcf15
|
File details
Details for the file multiagent_agentswarm-1.2.1-py3-none-any.whl.
File metadata
- Download URL: multiagent_agentswarm-1.2.1-py3-none-any.whl
- Upload date:
- Size: 66.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e6d2b25c5de21ee4b68df885caeb7eeaf8a91c846fd50c170474758dcda064f
|
|
| MD5 |
ce16d7b8047b5798a9f56daa28f88253
|
|
| BLAKE2b-256 |
018e23613442665d8e8471ad6fa811c738c5dfd44bc00158bad9d1fd61dbd4d6
|