The Over-Engineering Trap
When people discover AI agents, there's a temptation to build agents for everything.
Resist this.
Agents are powerful, but they're also harder to test, harder to debug, more expensive to run, and more likely to surprise you in production. For the majority of AI automation tasks, a simple workflow is faster to build, more reliable to run, and easier to maintain.
The skill is knowing which architecture fits which problem.
What is a Workflow?
An AI workflow is a deterministic pipeline — a fixed sequence of steps where:
- The order of steps is decided by you, not the model
- Each step has a defined input and output
- The same input always follows the same path
- Control flow uses code logic (if/else, loops), not model decisions
Example workflow — blog post generation:
Step 1: Extract topic and keywords from user input [LLM]
Step 2: Search for recent articles on the topic [Tool]
Step 3: Write outline based on search results [LLM]
Step 4: Write each section of the outline [LLM, 4x]
Step 5: Edit and polish the full draft [LLM]
Step 6: Generate meta description and title [LLM]
Output: Complete blog post
Every blog post request follows exactly these 6 steps. There's no model deciding "should I do step 3 before step 2 today?"
What is an Agent?
An AI agent is a dynamic system where:
- The model decides which steps to take next
- The path through the task varies based on observations
- The model can loop back, try different approaches, or call different tools
- Stopping is a decision, not a fixed endpoint
Example agent — open-ended research:
Goal: "Research what's happening in quantum computing right now"
Turn 1: Searches for recent quantum computing news
Turn 2: Reads three articles, identifies key themes
Turn 3: Searches for more detail on one surprising finding
Turn 4: Looks up the researchers mentioned in an article
Turn 5: Decides it has enough and writes the summary
No two research sessions follow the exact same path. The model adapts based on what it finds.
The Decision Framework
Use this to choose the right architecture:
Choose a Workflow when:
- ✅ The task is well-defined and repeatable
- ✅ Steps are always the same regardless of input
- ✅ You need predictable, auditable behavior
- ✅ The cost of unexpected actions is high
- ✅ You need to run at scale with consistent performance
- ✅ Debugging and monitoring need to be straightforward
Choose an Agent when:
- ✅ The right steps can't be determined in advance
- ✅ Inputs vary enough that one fixed path won't work
- ✅ The task requires adapting to unexpected results
- ✅ Open-ended problem-solving or research is needed
- ✅ The task has an open-ended stopping condition
- ✅ Human-like judgment about "what to do next" is genuinely needed
Common Patterns in Practice
Pattern 1: Pure Workflow
Good for: content generation, document processing, structured data extraction
Input → LLM Step A → LLM Step B → LLM Step C → Output
Every step is fixed. No model makes routing decisions. Highly reliable.
Pattern 2: Workflow with LLM Router
Good for: customer support, classification-driven processes
Input → Classifier LLM → [Route A: workflow for billing]
→ [Route B: workflow for returns]
→ [Route C: workflow for general questions]
One LLM decides the route; the rest is deterministic.
Pattern 3: Workflow with Embedded Agent
Good for: most real-world automation
Workflow Step 1: Validate input [code]
Workflow Step 2: Run research agent [AGENT — flexible step]
Workflow Step 3: Format output into template [code]
Workflow Step 4: Send notification [code]
The agent handles only the genuinely open-ended part. Everything else is deterministic.
Pattern 4: Pure Agent
Good for: research assistants, coding assistants, open-ended problem solving
Goal → Agent loop → Final answer
The model decides all steps. Use this only when the task genuinely can't be structured.
Side-by-Side Comparison
| Dimension | Workflow | Agent |
|---|---|---|
| Control flow | Code decides (if/else, loops) | Model decides |
| Predictability | High — same input, same path | Low — varies with model reasoning |
| Debuggability | Easy — fixed steps to trace | Harder — need to trace thought logs |
| Cost | Lower — fewer model calls per task | Higher — more turns, more tokens |
| Reliability | High | Medium (model-dependent) |
| Flexibility | Low — only handles expected inputs | High — adapts to unexpected situations |
| Build time | Faster | Slower |
| Best for | Known, repeatable tasks | Open-ended, variable tasks |
A Real Comparison: Customer Support
Workflow approach:
1. Classify ticket type (billing/technical/general)
2. If billing: extract account number → query database → generate response
3. If technical: extract product + symptom → search knowledge base → generate response
4. If general: generate response from FAQ context
5. Format and send reply
Predictable, fast, auditable. Works great for 80% of tickets.
Agent approach:
Agent receives ticket → decides what information to look up →
searches knowledge base, queries account DB, looks up order history as needed →
determines if escalation is needed → drafts or escalates
More flexible but also more likely to over-call tools, get confused by edge cases, or make unexpected decisions.
Best practice: Use the workflow as the outer structure; allow the agent to run for the 20% of complex tickets the workflow can't handle cleanly.
Agentic Workflows: The Best of Both
The most production-ready systems often look like this:
Outer workflow (reliable, deterministic):
→ Input processing
→ [Agent node] for open-ended reasoning
→ [Agent node] for adaptive tool use
→ Output formatting
→ Delivery
The workflow provides structure and reliability. Agents handle only the steps where flexibility genuinely adds value.
This is what Anthropic calls "agentic workflows" — systems that combine orchestration with selective autonomy.
Key Takeaways
- Workflows are deterministic — fixed steps, code controls flow, highly reliable
- Agents are dynamic — model controls flow, flexible but harder to predict
- Most real-world automation is better served by a workflow or a workflow with one embedded agent
- Use an agent only when the task genuinely can't be structured into fixed steps
- "Agentic workflows" — workflows with embedded agents — combine reliability with flexibility
- Next lesson: context engineering — managing the information agents can see