Phase 5: Agent Orchestration Patterns · 40 min · Claude Code · Python
Workflows vs. Agents: When to Use Which
Own the control flow when the path is predictable. Own only the goal and guardrails when it isn't.
Hiring signal: Choosing a rigid workflow for a predictable task and a flexible agent for an open-ended one — and being able to justify the choice — is exactly the system-design judgment interviewers probe for on AI-native architecture questions.
What you will learn
- Define workflows (predefined control flow, the engineer owns the path) versus agents (the model chooses the next step from environment feedback)
- Decide which architecture fits a task based on whether its step sequence is knowable in advance
- Identify the cost of choosing the wrong architecture in both directions: over-engineering a predictable task, or over-constraining an open-ended one
- Build a classifier that recommends workflow or agent architecture from a task's actual attributes
Introduction
Workflows vs. Agents: When to Use Which
A team builds their support-ticket triage feature as a fully autonomous agent: at every step, the model decides what to do next based on whatever it sees in the ticket, choosing freely among a dozen tools. For a task that's actually the same five steps every time — read the ticket, classify its category, check the customer's account tier, route to the right queue, log the decision — this is expensive, slower than it needs to be, and occasionally unpredictable in exactly the way a predictable process shouldn't be: the same ticket type sometimes takes a different path through the tools for no discernible reason. A different team, building a debugging assistant for investigating flaky test failures, builds a rigid five-step workflow: check logs, check recent commits, check test history, propose a fix, done. Real flaky-test investigation doesn't fit five fixed steps — sometimes the actual cause requires six rounds of digging in directions nobody could have predicted in advance, and the rigid workflow simply can't follow the investigation where it needs to go. Both teams picked the wrong architecture for their task, in opposite directions.
Two different control-flow philosophies
Workflows orchestrate LLM calls and tool calls through code the engineer writes in advance — the control flow (which step happens when, in what order, under what conditions) is fixed, and the model's job is filling in specific decisions within that fixed structure. Agents, in Anthropic's framing, are different: the model itself chooses what to do next, step by step, based on feedback from its environment, and the engineer's job shifts from defining the path to defining the goal and the guardrails the model operates within. Neither is universally better — they trade off predictability against flexibility, and that tradeoff should be decided by the shape of the task, not by which pattern happens to be trendier this year.
The one question that decides which one fits
Can you write down, right now, the actual sequence of steps this task requires, for the range of inputs it'll see? If yes — even if some individual steps need model judgment — a workflow gives you that predictability with tool calls only where judgment is genuinely needed. If the right sequence depends on what's discovered along the way, in ways you can't enumerate in advance, that's what agents are for.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Predictability versus flexibility, concretely, When flexibility is the actual requirement, This isn't a one-time choice per product, Build It — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy