Workflows vs Agents: When Not to Build an AI Agent
Agents are exciting, but they cost more, are slower and are harder to test than fixed code. Many features are better built as workflows: LLM calls arranged in a flow that your code controls.
Start with the simplest thing
- One LLM call - classification, summarisation, extraction, Q&A.
- A workflow - several calls in a known sequence.
- An agent - the model decides the steps.
Workflow patterns
Prompt chaining: each step feeds the next, with checks in between.
outline = llm(f"Write an outline for a blog post about {topic}")
if not looks_complete(outline):
outline = llm(f"Improve this outline: {outline}")
draft = llm(f"Write the post from this outline:\n{outline}")
final = llm(f"Edit for clarity and fix any factual errors:\n{draft}")
Routing: classify the request, then send it to a specialised prompt or model.
route = classify(ticket) # "billing" | "technical" | "sales"
answer = HANDLERS[route](ticket)
Parallelisation: run independent calls at once (review code for security, performance and style separately), then combine.
Evaluator-optimiser: one call produces, another critiques, repeat until it passes.
When an agent is the right tool
- The steps can't be predicted (debugging, open-ended research, coding tasks).
- The value of the result justifies extra cost and latency.
- Mistakes can be caught and undone: tests, reviews, approvals, version control.
A good sign you need an agent: your workflow code is turning into a giant if/else trying to anticipate every path.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.