"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:

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 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

DimensionWorkflowAgent
Control flowDefined in application codeDecided by the LLM at each step
PredictabilityHigh — same input shape produces same execution graphLow — the LLM may take different paths on identical inputs
Typical cost per task$0.01 – $0.10$0.30 – $2.00
Typical latency per task1 – 10 seconds15 – 90 seconds (sometimes much longer)
DebuggingStandard observability tooling worksRequires LLM-call traces; reasoning is hard to inspect
Failure modesPredictable; usually a single failed LLM call or tool errorInfinite loops, context-window exhaustion, tool misuse, runaway costs
Right fitTasks with known structure and bounded variationTasks with open-ended exploration or adaptive paths
Engineering effortModerate — lots of prompt tuning, but standard codeHigh — 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:

  1. 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.
  2. 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.
  3. You have cost circuit breakers. Per-task token budgets. Per-user rate limits. Daily spend caps. Alerts at 2x the median cost-per-task.
  4. 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.
  5. 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.
  6. 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.
  7. 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:

Frameworks subtract value when:

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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).
  5. 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

What is the difference between an LLM workflow and an LLM agent?+
A workflow orchestrates LLM calls and tools through predefined code paths that the developer controls. An agent is a system where the LLM itself dynamically decides which tools to call and in what order, typically running in a loop until the task is done. Workflows trade flexibility for predictability and cost; agents trade predictability for adaptability — and they cost meaningfully more to run.
When should I use an LLM agent instead of a workflow?+
Use an agent only when the task genuinely requires dynamic decision-making — for example, when the steps can't be enumerated in advance, when the path depends on intermediate results, or when the task has open-ended exploration. For everything else, use a workflow. Anthropic's guidance: if a task can be solved with prompt chaining or a single well-prompted LLM, do that. Agents trade latency and cost for performance on complex problems — only make that trade when the task requires it.
What are the main types of LLM workflows?+
The most common patterns are prompt chaining (sequential LLM calls where each output feeds the next), routing (a classifier sends the request to a specialized handler), parallelization (split a task across multiple LLM calls and combine results), orchestrator-workers (a central LLM coordinates sub-tasks), and evaluator-optimizer (one LLM produces, another critiques and refines). Most production AI applications today are workflows, not agents.
What does it actually cost to run an LLM agent in production?+
Agents typically cost 5-20x more per task than the equivalent workflow because they consume tokens at every loop iteration: thinking tokens, tool call descriptions, tool results, and the next decision. A workflow that uses 2-3 LLM calls might run for a few cents; an agent solving the same task with 10-15 tool-call loops can run $0.50-$2 per invocation at frontier-model prices. Always benchmark cost-per-task before committing an agentic architecture to production.
Why do agentic AI demos fail in production?+
Common failure modes: (1) the agent loops indefinitely on edge cases the demo didn't hit, (2) tool descriptions weren't precise enough, so the agent misuses tools, (3) error handling wasn't designed in — when a tool fails, the agent doesn't know how to recover, (4) the agent's context window fills up, degrading reasoning quality, (5) latency is unacceptable to users (15-60 seconds per task vs 1-2 seconds for a workflow). The fix is usually to constrain the agent: smaller action space, fewer iterations, better evaluation harness.
Is LangChain or LangGraph required to build LLM agents?+
No. Anthropic's published guidance explicitly recommends starting with direct API calls and a simple loop rather than reaching for a framework. Frameworks like LangChain, LangGraph, CrewAI, and AutoGen add useful abstractions but also obscure what the LLM is actually doing — making debugging harder. Most production agentic systems built in 2026 use direct API calls (Anthropic, OpenAI, or Google) with a thin custom orchestration layer. Reach for a framework only when the abstraction it provides is clearly worth the complexity.

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 →