Agentic Workflows
An agentic workflow breaks a complex task into stages where AI agents handle each step, with or without human oversight. The key insight: composition beats complexity.
Common Patterns
1. Sequential Pipeline
Each agent's output feeds the next:
Research Agent → Planning Agent → Coding Agent → Review Agent
Best for tasks with clear phases. Each agent is specialized and focused.
2. Orchestrator-Worker
A lead agent delegates subtasks to specialized workers:
# Orchestrator decides what to do
tasks = orchestrator.plan("Build a REST API for user management")
# Workers execute in parallel
for task in tasks:
worker = spawn_agent(task.agent_type)
worker.execute(task)
This pattern scales well — add more workers without changing the orchestrator.
3. Evaluator-Optimizer
One agent generates, another evaluates, repeat until quality threshold:
Generator → Evaluator → feedback → Generator → Evaluator → ✓
Useful for code quality, writing, and any task with measurable criteria.
Designing Workflows
When building agentic workflows, consider:
- Checkpoints — save state between stages so you can resume on failure
- Human-in-the-loop — decide where humans approve vs. where agents run autonomously
- Error boundaries — agents will fail; design for graceful recovery
- Cost awareness — each agent turn costs tokens; set budgets and limits
Anti-Patterns
- Over-agenting — using agents for tasks a simple script handles fine
- Unbounded loops — always set maximum iterations
- Shared mutable state — agents stepping on each other's work
- Trust without verify — always validate agent outputs before applying them