CLI Reference
swarmtest provides three commands: run, trim, and list-trees.
swarmtest run
Run a swarm test against a game server.
swarmtest run --game <game> --url <url> [options]Required Options
| Option | Description |
|---|---|
--game <game> | Game adapter to use. Available: tipo, playertwo |
--url <url> | WebSocket server URL (e.g., ws://localhost:5001) |
Optional Flags
| Option | Default | Description |
|---|---|---|
--agents <count> | 10 | Number of agents to spawn |
--duration <seconds> | 60 | Test duration in seconds |
--tick <ms> | 100 | Tick interval in milliseconds (how often each agent’s behavior tree is evaluated) |
--stagger <ms> | 200 | Delay between agent connections in milliseconds |
--regression-only | off | Only run saved regression trees (100% regression, 0% LLM, 0% handwritten) |
--explore-only | off | Only generate fresh LLM trees (0% regression, 100% LLM, 0% handwritten) |
--no-llm | off | Disable LLM tree generation (50% regression, 50% handwritten) |
--no-trim | off | Skip post-run tree trimming |
--json | off | Write a JSON report to ./reports/ in addition to console output |
--tree-dir <dir> | ./trees/<game>/ | Directory for the tree library |
Examples
# Basic test: 10 agents, 60 seconds, default behavior mix
swarmtest run --game tipo --url ws://localhost:5001
# Stress test: 50 agents for 5 minutes
swarmtest run --game tipo --url ws://localhost:5001 --agents 50 --duration 300
# Exploration: only LLM-generated trees, with JSON output
swarmtest run --game tipo --url ws://localhost:5001 --explore-only --json
# Regression-only: replay saved trees without LLM
swarmtest run --game tipo --url ws://localhost:5001 --regression-only
# Offline mode: no LLM, no API key needed
swarmtest run --game playertwo --url ws://localhost:3000 --no-llm
# Fast tick rate for timing-sensitive tests
swarmtest run --game tipo --url ws://localhost:5001 --tick 50 --stagger 100Behavior Mix
The behavior mix determines what proportion of agents use each behavior source:
| Mode | Regression | LLM | Handwritten |
|---|---|---|---|
| Default | 40% | 40% | 20% |
--regression-only | 100% | 0% | 0% |
--explore-only | 0% | 100% | 0% |
--no-llm | 50% | 0% | 50% |
Graceful Shutdown
Press Ctrl+C (SIGINT) or send SIGTERM to gracefully stop a running test. The swarm will:
- Stop all agent behavior loops
- Send disconnect messages to the server
- Close all WebSocket connections
- Drain remaining findings
- Save recorded trees
- Print the final report
swarmtest trim
Trim similar trees from the tree library. Trees with action sequences that are more than 80% similar (by default) are deduplicated.
swarmtest trim --game <game> [options]Options
| Option | Default | Description |
|---|---|---|
--game <game> | (required) | Game name (tipo, playertwo) |
--threshold <number> | 0.2 | Similarity threshold (0-1). Lower values = more aggressive trimming. 0.2 means trees with >80% similarity are candidates for removal. |
--tree-dir <dir> | ./trees/<game>/ | Tree library directory |
Example
# Trim tipo trees with default threshold
swarmtest trim --game tipo
# Aggressive trimming (remove trees with >60% similarity)
swarmtest trim --game tipo --threshold 0.4
# Trim from a custom directory
swarmtest trim --game tipo --tree-dir ./backup-trees/tipo/When two trees are similar, the trimmer keeps the one with more findings. Ties are broken by source priority: handwritten > recorded > llm.
swarmtest list-trees
List all saved regression trees in the library.
swarmtest list-trees --game <game> [options]Options
| Option | Default | Description |
|---|---|---|
--game <game> | (required) | Game name (tipo, playertwo) |
--tree-dir <dir> | ./trees/<game>/ | Tree library directory |
Example
swarmtest list-trees --game tipoOutput:
2 trees in ./trees/tipo/:
tree-1771647225060-tgbfcs
Source: recorded | Created: 2026-02-21T04:13:45.060Z
Tags: crash, desync
Findings: 3
Hash: 8f2a1b
tree-1771647265849-6h2srx
Source: llm | Created: 2026-02-21T04:14:25.849Z
Tags: protocol
Findings: 1
Hash: c4e7d3