v2/benchmark/docs/strategies.md
This guide provides detailed information about each of the 7 swarm strategies available in the benchmarking tool.
| Strategy | Best For | Coordination | Speed | Quality |
|---|---|---|---|---|
| Auto | General tasks | Adaptive | Variable | High |
| Research | Information gathering | Distributed | Medium | Very High |
| Development | Code creation | Hierarchical | Medium | High |
| Analysis | Data processing | Mesh | Slow | Very High |
| Testing | Quality assurance | Distributed | Fast | High |
| Optimization | Performance tuning | Hybrid | Slow | Medium |
| Maintenance | Updates & docs | Centralized | Fast | Medium |
The auto strategy intelligently selects the best approach based on task analysis.
# Pattern matching for strategy selection
keywords = {
"research": ["investigate", "analyze", "study", "explore"],
"development": ["build", "create", "implement", "code"],
"analysis": ["analyze", "process", "data", "metrics"],
"testing": ["test", "validate", "verify", "check"],
"optimization": ["optimize", "improve", "faster", "performance"],
"maintenance": ["update", "fix", "refactor", "document"]
}
swarm-benchmark run "Build a REST API with authentication" --strategy auto
# Auto-selects: development strategy
--hint parameterOptimized for information gathering, investigation, and exploratory tasks.
swarm-benchmark run "Research best practices for microservices architecture" \
--strategy research \
--mode distributed \
--max-agents 8
Designed for software development, code generation, and implementation tasks.
swarm-benchmark run "Develop user authentication microservice" \
--strategy development \
--mode hierarchical \
--max-agents 6 \
--quality-threshold 0.9
Optimized for data analysis, pattern recognition, and insight generation.
swarm-benchmark run "Analyze customer behavior patterns in sales data" \
--strategy analysis \
--mode mesh \
--parallel \
--quality-threshold 0.95
Specialized for test creation, validation, and quality assurance.
swarm-benchmark run "Create comprehensive test suite for payment API" \
--strategy testing \
--mode distributed \
--max-retries 2
Focused on performance improvement, efficiency, and resource optimization.
swarm-benchmark run "Optimize database query performance" \
--strategy optimization \
--mode hybrid \
--monitor \
--iterations 3
Designed for updates, documentation, refactoring, and system maintenance.
swarm-benchmark run "Update API documentation and refactor legacy code" \
--strategy maintenance \
--mode centralized \
--max-agents 3
| If your task involves... | Use this strategy |
|---|---|
| Multiple possible approaches | Auto |
| Information gathering | Research |
| Creating new code | Development |
| Processing data | Analysis |
| Ensuring quality | Testing |
| Improving performance | Optimization |
| Updating existing systems | Maintenance |
For complex projects, combine strategies:
# Research first
swarm-benchmark run "Research authentication methods" --strategy research
# Then develop
swarm-benchmark run "Implement chosen auth method" --strategy development
# Finally test
swarm-benchmark run "Test authentication system" --strategy testing
Each strategy supports custom parameters:
swarm-benchmark run "Task" \
--strategy development \
--strategy-params '{"code_style": "functional", "test_coverage": 0.95}'
Chain strategies for complex workflows:
# Research โ Development โ Testing pipeline
swarm-benchmark pipeline \
--stages research,development,testing \
--objective "Create authentication system"
Enable learning from previous runs:
swarm-benchmark run "Task" \
--strategy auto \
--adaptive \
--history-weight 0.3
Remember: The best strategy depends on your specific requirements. Benchmark different approaches to find what works best!