"Should we use an agent?" is the wrong question. In late 2025 and through 2026, almost every team building with LLMs converged on the same wrong answer to that question, which is "yes, obviously." The agentic frameworks shipped, the demos went viral, and a year later most of those production deployments are sitting in a closet labeled "we'll get back to this when it's cheaper and faster."
The right question is: is this task adaptive enough to require dynamic decision-making, or can it be solved by a fixed pipeline of LLM calls? If the answer is "fixed pipeline," you don't need an agent. You need a workflow. And the distinction matters because agents cost 5-20x more per task than the equivalent workflow, with comparable or worse reliability for problems that are actually predefined.
This piece is the working version of the distinction Anthropic's "Building Effective Agents" post drew at the end of 2024, applied to the state of the art in mid-2026, with the patterns that work in production and the failure modes that keep biting teams that don't think about this carefully.
The Definition That Actually Matters
The cleanest distinction comes from Anthropic's engineering team, and it's worth memorizing because most other definitions floating around the internet are wrong or fuzzy:
- A workflow is a system where LLMs and tools are orchestrated through predefined code paths. The developer wrote down the steps. The LLM does its part of each step, but the control flow lives in your application code.
- An agent is a system where the LLM itself dynamically directs its own process, choosing which tools to use and in what order. The developer provides the tools and the goal. The LLM decides how to get there, usually by running in a loop until it concludes the task is done.
Read those again. The line between them is not "uses tools" or "calls multiple LLMs" — both can do that. The line is who owns the control flow. In a workflow, you do. In an agent, the model does.
Once you internalize this, a lot of the marketing fog clears. A prompt-chained pipeline that calls an LLM three times in sequence is a workflow, not an agent. A "RAG agent" that does retrieval and then generates a response is a workflow with a tool call. A real agent is closer to what you see when Claude or GPT use computer-use tools to navigate a UI: the model decides what to click, sees what happened, and decides what to click next.
The most useful single sentence on this topic: If you can draw the data flow as a directed graph and the edges don't change at runtime, it's a workflow. If the edges are chosen by the LLM at each step, it's an agent. The rest is implementation detail.
Workflows: The Five Patterns That Cover 90% of Production Use Cases
Most production AI applications shipped in 2026 are workflows, not agents — they just don't always call themselves that. The five most common patterns:
1. Prompt chaining
Decompose a task into a fixed sequence of LLM calls, where each output feeds the next. Classic example: outline first, then draft each section, then revise. Used everywhere — documentation generation, structured data extraction, multi-step reasoning that benefits from intermediate work. Predictable, debuggable, and the cheapest pattern to operate.
2. Routing
A classifier (usually a small, fast LLM) decides which downstream specialist handles the request. Customer service systems use this constantly: route "billing question" to the billing prompt, "technical issue" to the troubleshooting prompt. The router is small and cheap; the specialists are deep and expensive. You only pay for depth when depth is needed.
3. Parallelization
Split a task across multiple LLM calls that run concurrently, then aggregate the results. Two flavors: sectioning (split distinct sub-tasks across calls) and voting (multiple LLMs answer the same question and you take the majority answer or aggregate). Useful for safety checks (run a primary call plus several guardrails in parallel) and for tasks where multiple perspectives improve quality.
4. Orchestrator-workers
A central LLM (the orchestrator) decomposes the task into sub-tasks, delegates each to a worker LLM call, and synthesizes the results. This sits closer to agent territory than the others — the orchestrator dynamically decides the breakdown — but the worker calls themselves are stateless and bounded. Used heavily for complex content generation and multi-document analysis.
5. Evaluator-optimizer
One LLM produces a candidate output. A second LLM evaluates it against criteria. If the evaluation fails, the producer revises with the critique as input. Loop until the evaluator approves. Used for tasks where quality is hard to hit on the first try: long-form writing, code generation with style requirements, translations with subtle tone constraints.
These five patterns — sometimes combined — cover almost every production LLM application shipped in the last 18 months. They're predictable, observable, and bounded in cost. They are what your team almost certainly needs.
Agents: When the Trade-Off Actually Makes Sense
Real agents are the right call when several conditions hold simultaneously. None of them in isolation justifies the cost and complexity. All of them together do:
- The steps can't be enumerated in advance. Different inputs require fundamentally different paths through the system. A debugging session for a Python error follows a different shape than one for a Kubernetes issue, and trying to encode all possible paths as a workflow would create an unmaintainable mess.
- The path depends on intermediate results. What the agent does next depends on what it just learned. The model needs to read a file before knowing which other files matter. A workflow that pre-specifies "read file A, then file B" can't handle this.
- The action space is large but constrained. The agent has access to many tools, but each call is bounded and recoverable. Computer-use, code execution, search-and-summarize, structured database queries — these all fit. Open-ended internet browsing without guardrails does not.
- The task tolerates 15-90 seconds of latency. Agents are slow. If your users need sub-second response, an agent is the wrong architecture. Background tasks, async workflows, and "kicked off and check back later" use cases tolerate this naturally.
- The cost-per-task is acceptable. A workflow might cost $0.01-$0.05 per invocation. An agent solving the same task can cost $0.50-$2 per invocation. If you're doing a million of these a day, that's a $500K vs $2M annual run rate. Make sure the business value justifies the spend before committing to the architecture.
The use cases where agents legitimately win in 2026 are surprisingly narrow but high-value: software engineering assistants (Claude Code, Cursor's agent mode), customer service triage for ambiguous or open-ended cases, research and analysis tasks that involve reading many documents, and computer-use agents that interact with UIs no one bothered to build APIs for. Outside that envelope, a workflow is almost always the better answer.
Side-by-Side Comparison
| Dimension | Workflow | Agent |
|---|---|---|
| Control flow | Defined in application code | Decided by the LLM at each step |
| Predictability | High — same input shape produces same execution graph | Low — the LLM may take different paths on identical inputs |
| Typical cost per task | $0.01 – $0.10 | $0.30 – $2.00 |
| Typical latency per task | 1 – 10 seconds | 15 – 90 seconds (sometimes much longer) |
| Debugging | Standard observability tooling works | Requires LLM-call traces; reasoning is hard to inspect |
| Failure modes | Predictable; usually a single failed LLM call or tool error | Infinite loops, context-window exhaustion, tool misuse, runaway costs |
| Right fit | Tasks with known structure and bounded variation | Tasks with open-ended exploration or adaptive paths |
| Engineering effort | Moderate — lots of prompt tuning, but standard code | High — tool design, error handling, eval harness, cost controls all required |
The Failure Modes That Bite
Agents fail in characteristic ways. Most demos don't expose these because the demo space is narrow and the inputs are friendly. Production exposes all of them.
Infinite loops on edge cases
The agent reaches a state where it keeps trying the same approach, getting the same failure, and trying again. Without an explicit iteration cap, this can burn through tokens fast. Always set a hard upper bound on tool-call loops — 15-30 iterations is typical — and decide what to do when you hit it (escalate to a human, return a partial result, restart with a different prompt).
Tool descriptions that aren't precise enough
The agent invokes tools incorrectly because the description left ambiguity. "Searches the database" doesn't tell the model what the result format looks like, how to construct queries, or what the failure modes are. Treat tool descriptions like an API spec: input schemas with examples, output schemas with examples, error semantics, performance characteristics. The quality of the tool descriptions is the single biggest predictor of agent reliability.
Context-window exhaustion
Agents accumulate context as they run — tool calls, tool results, intermediate reasoning, original system prompt. At some point, the context window fills and either the agent fails or reasoning quality collapses. Mitigations: aggressive summarization of intermediate state, file-system-backed memory for long-running tasks, sub-agents that handle bounded sub-tasks with fresh context.
Cost explosions on rare inputs
Median cost-per-task is fine. P99 cost-per-task is catastrophic. An agent that usually finishes in 8 tool calls might occasionally take 80 on a pathological input. Add cost circuit breakers: per-invocation token budgets, per-user rate limits, alerts when an individual task exceeds the budget by 3x.
Unrecoverable tool errors
When a tool fails, the agent often doesn't know how to recover. It either retries the same call (futile), abandons the task (frustrating), or hallucinates a successful result (dangerous). Build error semantics into every tool: clear error messages the model can reason about, distinguishable transient vs permanent failures, suggested recovery actions in the error text.
The Production Checklist
Before promoting any agentic system from a working demo to production, verify all of these:
- You have an evaluation harness. Not "we tried it on a few examples." A real eval set with diverse inputs, ground-truth answers or rubrics, and a way to measure regressions when you change the prompt, the model, or the tools.
- You have observability into every loop iteration. Every tool call, every model output, every decision. Without this, debugging is impossible. Anthropic's tool-use API and OpenAI's traces both give you this; use whatever your provider offers.
- You have cost circuit breakers. Per-task token budgets. Per-user rate limits. Daily spend caps. Alerts at 2x the median cost-per-task.
- You have a max-iteration cap. No agent should loop forever. Decide the upper bound (often 15-30 iterations) and what to do when you hit it.
- You have a fallback for when the agent fails. Sometimes the agent can't complete the task. A human-in-the-loop escalation, a simpler workflow fallback, or a graceful "I couldn't handle this" message — pick one.
- You have a path to roll back to a workflow if the agent underperforms. Production-grade agentic systems usually still have a workflow version of the same task that the team kept around. If the agent breaks in production, you have something to fall back to immediately.
- You have decided what the agent is allowed to do and not do. A constrained action space is a feature, not a limitation. Fewer, well-designed tools usually outperform more, less-designed tools.
The Framework Question
LangChain, LangGraph, CrewAI, AutoGen, OpenAI Swarm, Vercel AI SDK, Anthropic SDK with tool-use — the framework landscape is crowded. The honest answer in 2026: most production systems use direct API calls plus a thin custom orchestration layer. Anthropic's own published guidance on building agents explicitly recommends starting without a framework so you can see what the LLM is actually doing.
Frameworks add value when:
- You're building multi-agent systems where one agent calls another and the orchestration logic is genuinely complex.
- You need pre-built integrations with many tools (vector stores, databases, APIs) and writing them yourself is a meaningful cost.
- Your team prefers a higher-level abstraction even at the cost of some opacity, and they're disciplined enough to drop down to direct calls when debugging.
Frameworks subtract value when:
- You're using them to avoid learning how the underlying API works. This always backfires when you hit production issues.
- The abstraction hides costs — you don't see the actual tokens going to the model, so cost surprises hit harder.
- You're building something simple enough that the framework is more complex than what it replaces.
Start with direct API calls. Add a framework only when the abstraction it provides is clearly worth the complexity. This is the same advice we give for any infrastructure choice.
How to Decide for Your Use Case
A pragmatic decision tree:
- Can a single well-prompted LLM solve this? If yes, do that. This is still the right answer for a surprising number of tasks people assume need agents.
- If not, can you draw the data flow as a directed graph with fixed edges? If yes, you have a workflow. Pick the pattern from the five above that matches your shape.
- If not, does the task actually require the model to choose its own path? Be honest. Many tasks feel like they need agents but actually need a slightly cleverer workflow. The orchestrator-workers pattern in particular eats a lot of "we need an agent" use cases.
- If you've confirmed you need agentic flexibility, can the task tolerate 15-90 seconds of latency and $0.30-$2 per invocation? If not, your architecture is wrong; either change the use case (move it to async) or change the architecture (build a workflow even if it loses some flexibility).
- If all of those are yes, start with the smallest possible action space. Pick 3-5 tools, not 30. Build the eval harness before you build the agent. Set hard iteration caps. Ship the V1 to a small audience with a workflow fallback.
The one-line summary: Use a workflow until you can't. Agents are a powerful but expensive tool reserved for tasks that genuinely need adaptive control flow. Most production AI value in 2026 is shipped in workflows, not agents — even at companies whose marketing copy uses the word "agent" everywhere.
Frequently Asked Questions
Browse AI Engineering Roles
See open AI/ML engineering roles at companies that ship agentic systems in production — with culture context so you can find the right team.
Browse AI Engineering Roles → AI Skills Hub →