III. Focused Agents
Each agent does one thing well. Complex workflows compose specialized agents.
The Problem
Monolithic Agents
When agents try to do everything:
- Become unmaintainable quickly
- Fail unpredictably
- Can't be reused across contexts
- Violate context budgets
- Have unclear failure modes
Focused Agents
Single responsibility enables:
- Clear, maintainable capabilities
- Isolated, testable components
- Reuse across many workflows
- Efficient context usage
- Obvious debugging path
The Solution
God Agent
Super Agent: 8000 tokens
Expert in everything:
- Research
- Design
- Implementation
- Testing
- Deployment
- Monitoring
- ...and more
Result: 40% success rate, 0 reuse
Composed Agents
Workflow composition: research → plan → implement → validate
Each agent: 300-800 tokens
- research-agent — 500 tokens
- plan-agent — 600 tokens
- implement-agent — 400 tokens
- validate-agent — 300 tokens
Result: 95% success rate, 8.3x reuse
Unix Philosophy for AI
The Unix philosophy (1978) still applies:
Do One Thing
Single, clear purpose
Work Together
Compose into workflows
Standard Interfaces
Markdown, JSON, YAML
Reusable
Shareable patterns
Why It Works
::: info Single Responsibility Principle From software engineering (Robert C. Martin):
"An agent should have only one reason to execute"
Examples:
validate-yaml: One responsibility (validation)do-everything-kubernetes: Multiple responsibilities :::
The Composition Model
| Layer | Size | Example |
|---|---|---|
| Skills | 100-300 tokens | read-file, validate-yaml |
| Agents | 300-800 tokens | research-agent, plan-agent |
| Workflows | 2-7 agents | research → plan → implement |
| Profiles | 10-50 workflows | kubernetes-ops domain |
::: code-group
research-best-practices:
purpose: Gather information from docs
single_responsibility: true
validate-yaml:
purpose: Check YAML syntax and schema
single_responsibility: true
generate-tests:
purpose: Create test cases from specs
single_responsibility: true
do-kubernetes-stuff:
purpose: Everything Kubernetes
single_responsibility: false # Too vague
research-and-implement:
purpose: Research then implement
single_responsibility: false # Two jobs
everything-for-statefulsets:
purpose: All StatefulSet operations
single_responsibility: false # Not focused
:::
Real-World Evidence
Before: Monolithic Agent
| Metric | Result |
|---|---|
| Agent Size | 8000 tokens |
| Success Rate | 40% |
| Time per Task | 2 hours |
| Reuse Count | 0 workflows |
| Context Usage | 75% |
After: Composed Agents
| Metric | Result |
|---|---|
| Agent Size | 300-600 tokens each |
| Success Rate | 95% |
| Time per Task | 20 minutes |
| Reuse Count | 8.3x average |
| Context Usage | 20-30% per agent |
Improvement: 6x faster, 2.4x more reliable, infinitely more reusable
Agent Composition Pattern
::: code-group
workflow: create-kubernetes-application
phases:
- research:
agent: research-k8s-patterns
output: research-bundle.md
- plan:
agent: plan-statefulset
inputs: [research-bundle.md]
output: design-spec.md
- implement:
agents:
- generate-manifest
- create-tests
inputs: [design-spec.md]
outputs: [manifest.yaml, tests/]
execution: parallel
- validate:
agents:
- validate-yaml
- run-tests
inputs: [manifest.yaml, tests/]
execution: sequential
# manifest-generator agent
## Responsibilities
Generate Kubernetes manifests
## Skills Used
- yaml-processing (structure output)
- file-operations (write manifests)
- git-operations (commit results)
## Does NOT Handle
- Research (use research-agent)
- Validation (use validate-agent)
- Deployment (use deploy-agent)
## Input Contract
required:
- design-spec: markdown file
- namespace: string
## Output Contract
- manifest.yaml: K8s manifest
- metadata.json: generation details
:::
The 52-Agent Validation
52 Agents
Production system
2-7 Per Workflow
Composed capabilities
8.3x Reuse
Average per agent
Isolated Fixes
One agent, not system
Top reused agents:
validate-yaml: 47 workflowsgenerate-tests: 23 workflowscommit-with-context: 52 workflows (universal)
Implementation Checklist
- Define clear, single responsibility per agent
- Agents answer "What is the ONE thing this does?"
- Standard input/output contracts defined
- Agents compose into documented workflows
- Track reuse metrics (target 3+ workflows)
Anti-Patterns
The God Agent
Wrong: Single agent handles all tasks (12,000 tokens)
You are an expert in research, design, implementation,
testing, deployment, monitoring, documentation...
Right: Specialized agents for each responsibility
Overlapping Responsibilities
Wrong:
research-and-plan(two jobs)implement-and-test(two jobs)
Right:
research(one job)plan(one job)implement(one job)test(one job)
Hyper-Specialization
Wrong: Agent per line of code
- generate-yaml-line-1
- generate-yaml-line-2
- generate-yaml-line-3
Right: Agent per cohesive task
- generate-kubernetes-manifest
Related Factors
| Factor | Relationship |
|---|---|
| II. Context Loading | Smaller agents delegate to sub-agents |
| IV. Continuous Validation | Validation agents check implementation |
| VII. Smart Routing | Router selects best-fit agent |
| XII. Package Patterns | Agents packaged into profiles |