15. Multi-Agent Software Engineering
15.1 Why multiple agents?
A single agent can perform many tasks, but specialization can make workflows easier to control.
Example:
Main Agent
|
+--> Architect
|
+--> Developer
|
+--> Tester
|
+--> Reviewer
|
+--> Security
|
+--> Documentation
15.2 Feature workflow
Requirement:
Add user authentication.
Step 1 — Explore
Find:
- Authentication code
- Database models
- API routes
- Existing tests
Do not modify files.
Step 2 — Architecture
Design the authentication architecture.
Do not modify files.
Return:
- Components
- Data model
- API endpoints
- Security considerations
- Tests
Step 3 — Implement
Implement the approved design.
Follow AGENTS.md.
Run relevant tests.
Step 4 — Test
Analyze authentication coverage.
Add or recommend:
- Happy path
- Invalid credentials
- Missing credentials
- Authorization failures
- Edge cases
Step 5 — Review
Review the changes.
Do not modify files.
Report correctness and maintainability findings.
Step 6 — Security
Perform a security review.
Focus on:
- Password handling
- Tokens
- Authorization
- Input validation
- Secrets
Step 7 — Documentation
Update documentation for the final implementation.
15.3 Parallel vs sequential work
Some tasks can be parallelized:
Main Agent
/ \
v v
Tester Security
Other tasks should be sequential:
Architecture
|
v
Implementation
|
v
Testing
|
v
Fixes
Do not parallelize tasks that depend on the result of earlier work.
15.4 Human in the loop
Humans should remain involved in decisions involving:
- Architecture
- Security
- Data loss
- Production
- External side effects
- Large refactors
Exercise
Design a multi-agent workflow for:
Build a payment API.
Include:
- Explorer
- Architect
- Developer
- Tester
- Security
- Reviewer
- Documentation
- Human approval points