Module 1 · Lesson 3

AI Agent vs Workflow: When Should You Use Each?

Use a workflow when you know the steps. Use an agent when the right sequence of steps must be discovered at runtime.

Updated August 2026 · Agent architecture

This is one of the most important design decisions in agentic software. LangGraph defines workflows as systems with predetermined code paths, while agents dynamically define their own process and tool usage. Anthropic's guidance similarly emphasizes matching architectural complexity to the problem rather than defaulting to autonomy.

What is a workflow?

A workflow is controlled by your application code. The model may be used inside individual steps, but the overall sequence is known.

classify_request()
if category == "billing":
    lookup_invoice()
    draft_billing_reply()
else:
    retrieve_help_article()
    draft_support_reply()

This design can still use LLMs heavily. What makes it a workflow is that the control flow belongs to your code.

What is an agent?

In an agent, the model can decide which tool to call, whether another step is needed, and sometimes which specialist should handle the task.

while not done:
    decision = model(context, tools)
    if decision.tool_call:
        result = execute(decision.tool_call)
        context.append(result)
    else:
        done = True

Decision table

QuestionWorkflowAgent
Are the steps known in advance?Strong fitUsually unnecessary
Does the task vary significantly each time?Can become branch-heavyOften useful
Are side effects risky?Easier to constrainNeeds approvals/guardrails
Is deterministic testing important?EasierMore complex
Does the system need open-ended tool selection?AwkwardNatural fit
Is latency tightly constrained?Usually betterMay add multiple turns

Start deterministic, add autonomy where it earns its cost

A strong production pattern is a hybrid architecture. Keep the outer business process deterministic and insert an agent only where flexible judgment adds value.

For example, a support system might use deterministic authentication and account lookup, then use an agent to investigate the customer's issue across several read-only tools, and finally require an explicit deterministic approval path for refunds or account changes.

Hybrid pattern: deterministic shell → agentic investigation → deterministic authorization → side effect.

Common workflow patterns

Anthropic highlights several useful workflow patterns including prompt chaining, routing, parallelization, orchestrator-worker designs and evaluator-optimizer loops. These patterns can solve surprisingly complex problems without giving a model unrestricted control of the whole application.

Routing

A classifier selects one of several known branches. This is useful when request categories are stable and each category has a clear handler.

Parallelization

Independent tasks run at the same time and their results are combined. This reduces latency when subtasks do not depend on one another.

Evaluator-optimizer

One model produces an answer and another pass evaluates or improves it. This is still a workflow if your code determines when the evaluation runs and what happens next.

Signs you really need an agent

Signs you should stay with a workflow

Do not equate “agent” with “better”

Agents trade predictability for flexibility. That can be valuable, but it is not free. Every autonomous decision increases the surface area you must observe, test and constrain.

A production-minded developer asks: which decisions genuinely benefit from model autonomy? Then only those decisions become agentic.

Official references