Skip to main content

Multi-Agent CLI Orchestration Research Platform

Project description

zwarm

Multi-agent CLI for orchestrating coding agents. Spawn, manage, and converse with multiple Codex sessions in parallel.

Installation

# From the workspace
cd /path/to/labs
uv sync

# Or install directly
uv pip install -e ./zwarm

Requirements:

  • Python 3.13+
  • codex CLI installed and authenticated

Environment:

export OPENAI_API_KEY="sk-..."        # Required for Codex
export WEAVE_PROJECT="entity/zwarm"   # Optional: Weave tracing

Two Modes

zwarm has two ways to orchestrate coding agents:

Mode Who's in charge Use case
zwarm interactive You Manual control, experimentation
zwarm orchestrate LLM Autonomous task execution

Both use the same underlying session manager - the orchestrator LLM has access to the exact same tools you do.


Interactive Mode

You are the orchestrator. Spawn sessions, check on them, continue conversations.

zwarm interactive

Commands

Command Description
spawn "task" Start a session (waits for completion)
spawn --async "task" Start async (returns immediately)
spawn -d /path "task" Start in specific directory
ls List all sessions
? <id> Quick peek: status + latest message
show <id> Full details: all messages, tokens, etc.
c <id> "msg" Continue conversation (waits)
ca <id> "msg" Continue async (returns immediately)
kill <id> Stop a running session
rm <id> Delete session entirely
killall Stop all running sessions
clean Remove sessions older than 7 days
q Quit

Example Session

$ zwarm interactive

> spawn "Add a login function to auth.py"
✓ Started session a1b2c3d4, waiting...
[a1b2c3d4] codex (completed) - 32s
Response: I've added a login function with JWT support...

> spawn --async "Fix the type errors in utils.py"
✓ Session: b2c3d4e5 (running in background)

> spawn --async "Add unit tests for auth.py"
✓ Session: c3d4e5f6 (running in background)

> ls
1 running | 2 done

ID         │   │ T │ Task                        │ Updated │ Last Message
a1b2c3d4   │ ✓ │ 1 │ Add a login function...     │ 2m      │ I've added a login function...
b2c3d4e5   │ ✓ │ 1 │ Fix the type errors...      │ 30s ★   │ Fixed 3 type errors in...
c3d4e5f6   │ ● │ 1 │ Add unit tests...           │ 5s      │ (working...)

> ? b2c3d4e5
✓ b2c3d4e5 Fixed 3 type errors: Optional[str] -> str | None, added missing...

> c a1b2c3d4 "Now add password hashing with bcrypt"
Continuing session a1b2c3d4...
[a1b2c3d4] codex (completed) - 28s
Response: Done! I've updated the login function to use bcrypt...

> rm b2c3d4e5
✓ Deleted session b2c3d4e5

> q

Session Status Icons

Icon Status
Running
Completed
Failed
Killed
Recently completed (< 60s)

Orchestrate Mode

An LLM is the orchestrator. Give it a task and it delegates to coding agents.

zwarm orchestrate --task "Build a REST API with authentication"

The orchestrator LLM uses the same tools available in interactive mode:

Tool Description
delegate(task, ...) Start a new session
converse(id, msg) Continue a conversation
peek_session(id) Quick status check
check_session(id) Full session details
list_sessions() List all sessions with needs_attention flags
end_session(id, delete=False) Kill/delete a session

Task Input

# Direct
zwarm orchestrate --task "Build a REST API"

# From file
zwarm orchestrate --task-file task.md

# From stdin
echo "Fix the bug in auth.py" | zwarm orchestrate

Configuration

zwarm looks for config in this order:

  1. --config flag
  2. .zwarm/config.toml
  3. config.toml in working directory

Minimal Config

[weave]
enabled = true
project = "your-entity/zwarm"

[executor]
adapter = "codex_mcp"
model = "gpt-5.1-codex-mini"

Full Config Reference

[orchestrator]
lm = "gpt-5-mini"
max_steps = 100

[orchestrator.compaction]
enabled = true
max_tokens = 100000
threshold_pct = 0.85
target_pct = 0.7

[executor]
adapter = "codex_mcp"
model = "gpt-5.1-codex-mini"
sandbox = "workspace-write"
timeout = 300

[weave]
enabled = true
project = "your-entity/zwarm"

[watchers]
enabled = true
watchers = [
    { name = "progress" },
    { name = "budget", config = { max_steps = 50, max_sessions = 10 } },
    { name = "delegation_reminder", config = { threshold = 10 } },
]

Session Management

Sessions are the core abstraction. Each session is a conversation with a Codex agent.

Lifecycle

spawn → running → completed/failed
                      ↓
              continue → running → completed
                              ↓
                        continue → ...

Storage

.zwarm/sessions/<uuid>/
├── meta.json           # Status, task, model, messages, tokens
└── turns/
    ├── turn_1.jsonl    # Raw codex output for turn 1
    ├── turn_2.jsonl    # Output after first continue
    └── ...

Sync vs Async

Mode Spawn Continue Use case
Sync spawn "task" c id "msg" Sequential work, immediate feedback
Async spawn --async "task" ca id "msg" Parallel work, batch processing

Async sessions return immediately. Poll with ls or ? to check status.


Watchers

Watchers monitor agent behavior and intervene when needed.

Watcher Purpose
progress Detects stuck/spinning agents
budget Enforces step/session limits
scope Detects scope creep
delegation_reminder Nudges orchestrator to delegate

Configure in config.toml:

[watchers]
enabled = true
watchers = [
    { name = "progress" },
    { name = "budget", config = { max_steps = 50 } },
]

CLI Reference

zwarm init              # Initialize .zwarm/ in current directory
zwarm interactive       # Start interactive REPL
zwarm orchestrate       # Start LLM orchestrator
zwarm exec              # Run single executor directly (testing)
zwarm status            # Show current state
zwarm history           # Show event history
zwarm clean             # Remove old sessions

Project Structure

zwarm/
├── src/zwarm/
│   ├── sessions/           # Session management (core)
│   │   ├── manager.py      # CodexSessionManager
│   │   └── __init__.py
│   ├── tools/
│   │   └── delegation.py   # Orchestrator tools (delegate, converse, etc.)
│   ├── cli/
│   │   └── main.py         # CLI commands and interactive REPL
│   ├── core/
│   │   ├── config.py       # Configuration loading
│   │   ├── compact.py      # Context window management
│   │   └── state.py        # State persistence
│   ├── watchers/           # Trajectory alignment
│   └── orchestrator.py     # Orchestrator agent
├── docs/
│   └── INTERNALS.md        # Technical architecture
└── README.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zwarm-2.3.5.tar.gz (94.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zwarm-2.3.5-py3-none-any.whl (109.3 kB view details)

Uploaded Python 3

File details

Details for the file zwarm-2.3.5.tar.gz.

File metadata

  • Download URL: zwarm-2.3.5.tar.gz
  • Upload date:
  • Size: 94.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for zwarm-2.3.5.tar.gz
Algorithm Hash digest
SHA256 30765169b35f668bd5b48b045638bf01f8d128c6111bde6f9099d12c6b4c62d0
MD5 6941336a04817b0ad2d828951a9b7760
BLAKE2b-256 76c4b4e52b1e0a9cb84d60954eeaa4a29cb5aee9e6ea39ad51c3fcf5c423d48b

See more details on using hashes here.

File details

Details for the file zwarm-2.3.5-py3-none-any.whl.

File metadata

  • Download URL: zwarm-2.3.5-py3-none-any.whl
  • Upload date:
  • Size: 109.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for zwarm-2.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7e79cd759b975b0ddac173b260749bc3a32f1cea778e8f3041301e37fa27b2ef
MD5 d1e99ac679c0c3fbd0febb111e45187f
BLAKE2b-256 fc9dcd0718ac9721e447a5db560c9f5fcfa5232b469195c064235f3f95e32b87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page