-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Automation Commands
Claude-Flow v2 introduces powerful automation capabilities that intelligently orchestrate AI agents for complex workflows. The automation system combines smart agent spawning, dependency management, and advanced coordination patterns.
The automation commands provide:
- ๐ง Intelligent Agent Selection: Automatically spawns optimal agents based on task complexity
- โก MLE-STAR Workflow Engine: Machine Learning Engineering via Search and Targeted Refinement
- ๐ Stream-JSON Chaining: Real-time agent-to-agent output piping
- ๐๏ธ Interactive & Non-Interactive Modes: Flexible execution patterns
- ๐ Real-time Progress Tracking: Visual task boards and status monitoring
# Auto-spawn agents based on task complexity
claude-flow automation auto-agent --task-complexity <level> [options]
# Smart agent spawning with specific requirements
claude-flow automation smart-spawn --requirement <description> [options]
# Select optimal workflow for project type
claude-flow automation workflow-select --project-type <type> [options]
# Execute workflow from JSON/YAML files
claude-flow automation run-workflow <file> [options]
# MLE-STAR Machine Learning Engineering workflow (flagship)
claude-flow automation mle-star [options]Automatically spawns optimal agents based on task complexity analysis.
claude-flow automation auto-agent --task-complexity <level> [options]| Level | Agents | Description |
|---|---|---|
| low/simple | 2 agents | 1 coordinator + 1 developer |
| medium/moderate | 4 agents | 1 coordinator + 2 developers + 1 researcher |
| high/complex | 8 agents | 2 coordinators + 3 developers + 2 researchers + 1 analyzer |
| enterprise/massive | 15 agents | 3 coordinators + 5 developers + 3 researchers + 2 analyzers + 2 testers |
# Enterprise-level task with optimal agent configuration
claude-flow automation auto-agent --task-complexity enterprise --swarm-id enterprise-api๐ฏ OPTIMAL AGENT CONFIGURATION:
๐ค coordinator: 3 agents
๐ค developer: 5 agents
๐ค researcher: 3 agents
๐ค analyzer: 2 agents
๐ค tester: 2 agents
๐ Total agents: 15
โ
Auto-agent spawning completed
๐ 15 agents spawned and configured for enterprise complexity tasks
Intelligently spawns agents based on specific requirements and provides recommendations.
claude-flow automation smart-spawn --requirement <description> [options]# Web development project
claude-flow automation smart-spawn --requirement "web-development" --max-agents 8
# Data analysis workflow
claude-flow automation smart-spawn --requirement "data-analysis" --max-agents 6
# Enterprise API development
claude-flow automation smart-spawn --requirement "enterprise-api-development" --max-agents 12The system analyzes requirements and suggests optimal agent configurations:
๐ง Smart spawning agents based on requirements...
๐ Requirement: web-development
๐ข Max agents: 8
๐ฏ RECOMMENDED AGENT CONFIGURATION:
๐ค coordinator: 1 agents - Task orchestration
๐ค coder: 3 agents - Core development work
๐ค tester: 1 agents - Quality assurance
๐ค researcher: 2 agents - Information gathering
๐ค analyst: 1 agents - Data analysis
๐ SUMMARY:
๐ Total recommended: 8 agents
๐ข Max allowed: 8 agents
โ
Configuration: Within limits
Selects and configures optimal workflows based on project type and priorities.
claude-flow automation workflow-select --project-type <type> --priority <priority>| Type | Phases | Duration | Agents |
|---|---|---|---|
| web-app | planning โ design โ frontend โ backend โ testing โ deployment | 2-4 weeks | coordinator(1) + developer(3) + tester(1) + researcher(1) |
| api | specification โ design โ implementation โ testing โ documentation | 1-2 weeks | coordinator(1) + developer(2) + tester(1) + researcher(1) |
| data-analysis | collection โ cleaning โ analysis โ visualization โ reporting | 1-3 weeks | coordinator(1) + researcher(2) + analyzer(2) + developer(1) |
| enterprise | requirements โ architecture โ development โ integration โ testing โ deployment โ monitoring | 2-6 months | coordinator(2) + developer(5) + researcher(2) + analyzer(1) + tester(2) |
- speed: +50% agents, parallel execution
- quality: +100% testing, code review stages
- cost: Minimal agents, sequential execution
- balanced: Optimal speed/quality/cost ratio
# API project optimized for speed
claude-flow automation workflow-select --project-type api --priority speedExecutes workflows from JSON/YAML files with Claude CLI integration.
claude-flow automation run-workflow <workflow-file> [options]--claude # Enable Claude CLI integration for actual execution
--non-interactive # Run in non-interactive mode (no prompts)
--output-format <format> # Output format (text, json, stream-json)
--variables <json> # Override workflow variables (JSON format)
--max-concurrency <n> # Maximum concurrent tasks (default: 3)
--timeout <ms> # Execution timeout in milliseconds
--verbose # Enable detailed logging{
"name": "API Development Workflow",
"agents": [
{"id": "architect", "type": "architect", "name": "System Designer"},
{"id": "coder", "type": "coder", "name": "API Developer"},
{"id": "tester", "type": "tester", "name": "Quality Engineer"}
],
"tasks": [
{
"id": "design",
"name": "Design API Architecture",
"assignTo": "architect",
"description": "Create comprehensive API design"
},
{
"id": "implement",
"name": "Implement Endpoints",
"assignTo": "coder",
"depends": ["design"],
"description": "Build REST API endpoints"
},
{
"id": "test",
"name": "Write Tests",
"assignTo": "tester",
"depends": ["implement"],
"description": "Create comprehensive test suite"
}
]
}# Execute custom workflow with Claude integration
claude-flow automation run-workflow my-api-workflow.json --claude --non-interactiveThe MLE-STAR (Machine Learning Engineering via Search and Targeted Refinement) workflow is Claude-Flow's flagship automation feature for ML engineering tasks.
claude-flow automation mle-star [options]- ๐ Web Search Phase: Finds state-of-the-art ML approaches and solutions
- ๐๏ธ Foundation Building: Creates baseline models and training infrastructure
- ๐ฏ Targeted Refinement: Focuses deep optimization on high-impact components
- ๐๏ธ Ensemble Methods: Intelligent model combination beyond simple averaging
- โ Comprehensive Validation: Rigorous testing with data leakage prevention
--claude # Enable Claude CLI integration (recommended)
--dataset <path> # Path to dataset file (default: ./data/dataset.csv)
--target <column> # Target column name (default: target)
--output <dir> # Model output directory (default: ./models/)
--name <experiment> # Experiment name for tracking
--search-iterations <n> # Web search iterations (default: 3)
--refinement-iterations <n> # Refinement cycles (default: 5)
--max-agents <n> # Maximum agents to spawn (default: 6)
--interactive # Use interactive mode with master coordinator
--non-interactive # Force non-interactive mode (default for MLE-STAR)
--output-format <format> # Output format (stream-json enables chaining)
--chaining # Enable stream-json chaining between agents
--no-chaining # Disable stream-json chaininggraph TB
A[Web Search & Foundation Discovery] --> B[Foundation Model Building]
B --> C[Ablation Analysis]
C --> D[Targeted Refinement]
D --> E[Ensemble Creation]
E --> F[Comprehensive Validation]
F --> G[Production Deployment]
subgraph "Phase 1: Parallel"
A
B
end
subgraph "Phase 2: Sequential"
C
D
end
subgraph "Phase 3: Parallel"
E
F
end
# Basic MLE-STAR execution (non-interactive by default)
claude-flow automation mle-star --dataset sales-data.csv --target revenue --claude
# MLE-STAR with stream chaining
claude-flow automation mle-star --dataset data.csv --target price --claude --output-format stream-json
# Custom configuration with more iterations
claude-flow automation mle-star \
--dataset customer-data.csv \
--target churn \
--output models/churn/ \
--name "customer-churn-prediction" \
--search-iterations 5 \
--refinement-iterations 8 \
--max-agents 8๐ง MLE-STAR: Machine Learning Engineering via Search and Targeted Refinement
๐ฏ This is the flagship automation workflow for ML engineering tasks
๐ Workflow: MLE-STAR Machine Learning Engineering Workflow
๐ Description: Complete Machine Learning Engineering workflow using MLE-STAR methodology
๐ Methodology: Search โ Foundation โ Refinement โ Ensemble โ Validation
โฑ๏ธ Expected Runtime: 2-4 hours
๐ Configuration:
Dataset: customer-data.csv
Target: churn
Output: models/churn/
Claude Integration: Enabled
Execution Mode: Non-interactive (default)
Stream Chaining: Enabled
๐ก Running in non-interactive mode: Each agent will execute independently
๐ Stream chaining enabled: Agent outputs will be piped to dependent agents
๐ Executing 6 tasks in 3 phases...
๐ Phase 1: 2 concurrent tasks
๐ Phase 2: 2 concurrent tasks
๐ Phase 3: 2 concurrent tasks
๐ MLE-STAR workflow completed successfully!
๐ Results: 6/6 tasks completed
โฑ๏ธ Duration: 2h 15m 30s
๐ Execution ID: workflow-exec-1704067200000
When --output-format stream-json is enabled, agents automatically pipe their outputs to dependent agents:
# Agent A generates stream-json output
claude --print --output-format stream-json "Task 1"
โ (stdout piped automatically)
# Agent B receives Agent A's output and continues
claude --print --input-format stream-json --output-format stream-json "Task 2"
โ (stdout piped automatically)
# Agent C completes the chain
claude --print --input-format stream-json "Task 3"Look for these console messages:
๐ Enabling stream chaining from task1 to task2๐ Chaining: Piping output from previous agent to Agent Name
- Each agent spawns independently
- Outputs are processed automatically
- No user prompts or intervention required
- Ideal for CI/CD and automation pipelines
- Single master coordinator manages all agents
- User can interact during execution
- Real-time decision making possible
- Better for exploratory workflows
# Force non-interactive (default for automation commands)
--non-interactive
# Use interactive mode with master coordinator
--interactive
# Auto-detect based on environment
# (no flag = non-interactive for automation commands)All automation commands provide real-time progress tracking:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค CONCURRENT TASK STATUS โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ RUNNING (3 agents): โ
โ ๐ฌ Analyze Dataset [โโโโโโโโโโ] 2m 15s โ
โ ๐ป Build Foundation Model [โโโโโโโโโโ] 1m 45s โ
โ โก Optimize Performance [โโโโโโโโโโ] 45s โ
โ โ
COMPLETED (2): โ
โ โ Web Search Research 3m 20s โ
โ โ Data Quality Analysis 2m 55s โ
โ โณ QUEUED: 1 tasks waiting โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ ๐ Progress: 67% (4/6) โ โก Active: 3 โ โ Failed: 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Create reusable workflow templates for common patterns:
# Create template from successful workflow
claude-flow automation export-template --workflow-id exec-123 --name "api-development"
# Apply template to new project
claude-flow automation apply-template api-development --variables '{"project":"my-api"}'- fail-fast: Stop on first error
- continue: Continue despite errors
- retry: Automatic retry with exponential backoff
- Max Concurrency: Control parallel task execution
- Timeout Management: Per-task and global timeouts
- Memory Limits: Prevent resource exhaustion
- Load Balancing: Distribute tasks across available resources
# Begin with basic complexity assessment
claude-flow automation auto-agent --task-complexity medium# CI/CD pipelines: non-interactive
claude-flow automation mle-star --dataset data.csv --target price --claude --non-interactive
# Exploratory work: interactive
claude-flow automation mle-star --dataset data.csv --target price --claude --interactive# Complex ML pipelines benefit from chaining
claude-flow automation mle-star --dataset data.csv --target price --claude --output-format stream-json# Use appropriate agent counts
claude-flow automation smart-spawn --requirement "simple-script" --max-agents 3
claude-flow automation smart-spawn --requirement "enterprise-system" --max-agents 12# Create reusable workflows for common patterns
claude-flow automation workflow-select --project-type api --priority speed > api-speed.json
claude-flow automation run-workflow api-speed.json --claude --non-interactive- 84.8% SWE-Bench Solve Rate: Superior problem-solving through intelligent coordination
- 2.8-4.4x Speed Improvement: Parallel execution and optimized task distribution
- 32.3% Token Reduction: Efficient coordination reduces redundant operations
- Automatic Optimization: Self-tuning based on task complexity and resource availability
# GitHub Actions example
- name: Run MLE-STAR Pipeline
run: |
claude-flow automation mle-star \
--dataset ${{ inputs.dataset }} \
--target ${{ inputs.target }} \
--claude \
--non-interactive \
--output-format stream-jsonRUN npm install -g claude-flow@alpha
CMD ["claude-flow", "automation", "mle-star", "--claude", "--non-interactive"]- Stream Chaining - Deep dive into agent-to-agent output piping
- MLE-STAR Workflow - Complete methodology guide
- Agent System Overview - Understanding the 64-agent ecosystem
- Workflow Orchestration - Advanced coordination patterns
- Non-Interactive Mode - CI/CD and automation setup
๐ Next Steps: Try the MLE-STAR workflow on your dataset:
claude-flow automation mle-star --dataset your-data.csv --target your-target --claude