What You'll Build
In this tutorial, you'll create a multi-agent code review system using Doforu. The system will:
- Analyze code across multiple files simultaneously
- Assign specialized reviewers (security, performance, style)
- Aggregate results into a unified report
- Apply suggested fixes automatically
Prerequisites
- Doforu installed (install guide)
- Basic understanding of terminal/CLI
- An API key for your preferred LLM provider
Step 1: Understanding the Agent Orchestration Model
Before writing code, let's understand Doforu's core abstraction. A multi-agent workflow in Doforu consists of:
- Main Agent: The orchestrator that receives your goal and decomposes it
- Sub-Agents: Specialized agents that execute individual tasks
- Task Graph: A DAG (directed acyclic graph) defining task dependencies
- Tools: Capabilities each agent can invoke (read files, search, execute commands)
Step 2: Creating Your First Multi-Agent Configuration
Create a file called review-workflow.json:
{
"name": "code-review-workflow",
"agents": [
{
"name": "security-reviewer",
"role": "Identify security vulnerabilities including XSS, SQL injection, and insecure dependencies",
"tools": ["read_file", "grep", "web_search"],
"model": "claude-sonnet-4-2026"
},
{
"name": "performance-reviewer",
"role": "Identify performance bottlenecks, N+1 queries, memory leaks, and optimization opportunities",
"tools": ["read_file", "shell"],
"model": "gpt-5-2026"
},
{
"name": "style-reviewer",
"role": "Check code style, naming conventions, and adherence to project standards",
"tools": ["read_file", "grep"],
"model": "claude-sonnet-4-2026"
}
],
"workflow": {
"parallel": ["security-reviewer", "performance-reviewer", "style-reviewer"],
"aggregator": {
"agent": "review-aggregator",
"depends_on": ["security-reviewer", "performance-reviewer", "style-reviewer"],
"role": "Merge all review results into a single structured report with severity levels"
}
}
}Step 3: Running the Multi-Agent Workflow
Execute the workflow with Doforu's CLI:
# Run the multi-agent code review
doforu run review-workflow.json --target ./src
# Or use shorthand for ad-hoc multi-agent tasks
doforu review ./src --agents=3 --focus=security,performance,styleDoforu will immediately spawn 3 sub-agents in parallel, each analyzing your codebase from their specialized perspective.
Step 4: Understanding Parallel Execution
This is where Doforu's power shines. Instead of running reviews sequentially:
Sequential (traditional tools):
Step 1: Security Review (30s) โ Step 2: Performance Review (30s) โ Step 3: Style Review (30s)
Total: ~90 seconds
Parallel (Doforu):
Step 1: All 3 reviews start simultaneously
Total: ~30 seconds (3x faster!)For larger workflows with 10+ agents, the speedup becomes dramatic.
Step 5: Real-Time Monitoring
Doforu provides real-time visibility into agent progress:
# Watch agent execution in real-time
doforu run review-workflow.json --watch
# Output shows:
# [security-reviewer] ๐ Scanning for XSS vulnerabilities... DONE
# [performance-reviewer] โก Analyzing query patterns... IN PROGRESS
# [style-reviewer] ๐ Checking naming conventions... WAITINGStep 6: Consuming the Aggregated Result
Once all agents complete, the aggregator agent compiles the results:
{
"summary": {
"critical": 2,
"high": 5,
"medium": 12,
"low": 23
},
"findings": [
{
"severity": "critical",
"agent": "security-reviewer",
"file": "src/auth/login.ts",
"issue": "SQL injection vulnerability in raw query",
"suggestion": "Use parameterized queries instead of string concatenation"
}
],
"auto_fixes_applied": 8
}Advanced: Custom DAG Workflows
For complex scenarios, define dependencies between agents:
{
"workflow": {
"stages": [
{
"name": "analysis",
"parallel": ["dependency-checker", "complexity-analyzer"]
},
{
"name": "review",
"parallel": ["security-reviewer", "performance-reviewer"],
"depends_on": ["analysis"]
},
{
"name": "report",
"agent": "report-generator",
"depends_on": ["review"]
}
]
}
}This creates a pipeline where analysis completes before review begins, but agents within each stage run in parallel.
Next Steps
- Explore Doforu's built-in tools for file operations, search, and shell commands
- Learn about agent tool composition to build custom capabilities
- Join our community to share multi-agent workflows
Ready to experience true multi-agent development? Install Doforu and start building.