D1 · Agentic Architecture › Cluster 1 · Foundations

1.1 · Agent vs. Workflow vs. Single LLM Call

When to build an agent — the tier decision

CONCEPT The three tiers

Before you design how an agent works, decide whether you need one. There are three tiers of increasing power, cost, and unpredictability. The architect's job is to pick the lowest tier that solves the problem — the exam consistently rewards this restraint.

TierWhat it isWho controls the flowUse when
Single LLM callOne request → one responseN/A — no loop Classification, summarization, extraction, Q&A
WorkflowMultiple steps wired together in your code, LLM calls at fixed pointsYou (deterministic code) Multi-step but the steps are known in advance
AgentA loop where the model decides the next action (which tool, when to stop)The model (dynamic) Open-ended, hard-to-pre-script tasks needing tools
🔑 The dividing line between a workflow and an agent is who decides the control flow. If your code decides the order of steps, it's a workflow. If the model decides its own next step in a loop, it's an agent.

DIAGRAM Choosing the tier

flowchart TD A([Task]) --> Q1{"Single request→response
enough? (classify, summarize, extract)"} Q1 -->|Yes| T1["🟢 Single LLM call
cheapest · most predictable"] Q1 -->|No| Q2{"Are the steps
known in advance?"} Q2 -->|Yes| T2["🔵 Workflow
you orchestrate in code"] Q2 -->|No| Q3{"Does it need tools &
model-driven decisions?"} Q3 -->|Yes| T3["🟣 Agent
model drives the loop"] Q3 -->|No| T2 classDef a fill:#d4edda,stroke:#28a745,color:#155724; classDef b fill:#d1ecf1,stroke:#17a2b8,color:#0c5460; classDef c fill:#e2d4f0,stroke:#764ba2,color:#3d1a5b; class T1 a; class T2 b; class T3 c;

CONCEPT The 4-question agent gate

Anthropic's guidance: only reach for the agent tier when all four hold. Any "no" → drop to a workflow or a single call.

CheckQuestionIf "no"…
ComplexityIs the task multi-step and hard to fully specify up front?A workflow or single call is simpler and cheaper.
ValueDoes the outcome justify higher cost & latency?Not worth an agent's overhead.
ViabilityIs Claude actually capable at this task type?No amount of looping fixes a capability gap.
Cost of errorCan mistakes be caught & recovered (tests, review, rollback)?Too risky to let a model drive autonomously.

CODE The same task at each tier

"Extract the invoice total from this text" — as a single call, then "answer a support question that may need a lookup" as a workflow vs. an agent.

Tier 1 — single call (no loop)

# One request, one response. No tools, no loop. Cheapest & most predictable.
resp = client.messages.create(
    model="claude-opus-4-8", max_tokens=256,
    messages=[{"role": "user",
               "content": f"Extract the invoice total as JSON: {text}"}],
)

Tier 2 — workflow (your code decides the steps)

# YOU control the order. The LLM is called at fixed points you chose.
docs   = retrieve(query)                 # step 1: your code
ranked = rerank(docs, query)             # step 2: your code
answer = client.messages.create(         # step 3: one LLM call with context
    model="claude-opus-4-8", max_tokens=1024,
    messages=[{"role":"user","content": prompt(query, ranked)}],
)

Tier 3 — agent (the model decides the next action)

# The MODEL drives: it decides whether to look something up, then answers.
messages = [{"role":"user","content": question}]
while True:
    resp = client.messages.create(model="claude-opus-4-8", max_tokens=4096,
                                  tools=TOOLS, messages=messages)
    if resp.stop_reason == "end_turn": break          # model decided it's done
    messages.append({"role":"assistant","content": resp.content})
    # ...run the tool the MODEL chose, append tool_result, loop (see 1.3)

TRADE-OFFS Why not always use an agent?

✅ Agent gains

  • Handles open-ended tasks you can't fully script
  • Adapts step-by-step to what it finds
  • Composes tools dynamically

⚠️ Agent costs

  • More tokens & latency (multiple round-trips)
  • Less predictable — harder to test & guarantee
  • Bigger blast radius on error; needs guardrails
Rule of thumb: single call → workflow → agent, and stop at the first tier that works. Escalate a tier only when the task genuinely can't be pre-scripted.

EXAM TRAPS

Trap: "Design an agent for <simple, single-step task>." → The right answer is often not an agent. If one request answers it, that's the design. Watch for "cost-effective" / "least latency" keywords steering you down a tier.
Trap: Calling any multi-step LLM pipeline an "agent." → If your code fixes the step order, it's a workflow, not an agent. Agents let the model choose the next action.
Trap: Jumping to multi-agent. → That's a further escalation within the agent tier (see 4.1); most agent problems are one agent + tools.

PRACTICE

Q1 · A client needs to classify 100k support emails/day into 5 categories, cheaply. Which tier?

Single LLM call (batch it, likely on Haiku). It's one-step and high-volume — an agent would add cost and latency for zero benefit. Reserve agents for tasks that can't be pre-scripted.

Q2 · "Turn a design doc into a working PR" — agent or workflow, and why?

Agent. The steps (which files to read, what to edit, how to fix test failures) can't be fully specified in advance and require tool use + model-driven decisions — it passes all four gate checks (complex, valuable, viable, recoverable via tests/review).

Q3 · Your "agent" always runs retrieve → rerank → answer in that fixed order. Is it an agent?

No — that's a workflow. Your code fixes the control flow. It only becomes an agent if the model itself decides whether/when to retrieve. Naming it "agent" doesn't change the architecture.