Careeroza
Workflows vs Agents
Two Ways to Build
A workflow is a fixed path written in your code: step 1, step 2, step 3, with LLM calls inside. An agent lets the model choose the path at run time. Most production systems are workflows with a few agent-like parts.
| Pattern | What it does | ShopEase use |
|---|---|---|
| Prompt chaining | output of call 1 is the input of call 2 | draft product description → check tone → translate to Hindi |
| Routing | classify the request, send it to a specialised handler | refund question → refund prompt; product question → search |
| Parallelisation | run several calls at once and combine | summarise 50 reviews in 5 batches |
| Orchestrator-workers | one call plans, others do the parts | plan a festive sale catalogue, workers write each section |
| Evaluator-optimizer | one call writes, another grades and asks for fixes | write ad copy until it passes the brand rules |
| Agent | model loops with tools until done | support assistant that looks up orders and creates returns |
When to Use Which
- Use a workflow when the steps are known in advance. It is cheaper, faster and easier to test.
- Use an agent when the number and order of steps depend on the request (open-ended support, research, coding).
- Start with one well-prompted call. Add a workflow, then an agent, only when evals show you need it.
Example
Example
A routing workflow. The classifier here is a keyword stand-in for a cheap model call (for example Claude Haiku). The path is fixed in code, so it is easy to test.
def classify(message): # stand-in for a small, cheap model call
m = message.lower()
if any(w in m for w in ("refund", "money back", "return")):
return "refunds"
if any(w in m for w in ("where", "track", "delivery")):
return "tracking"
return "general"
HANDLERS = {
"refunds": lambda m: "[refund prompt + refund policy docs]",
"tracking": lambda m: "[order lookup tool + tracking prompt]",
"general": lambda m: "[general FAQ prompt]",
}
for msg in ["I want my money back for order SE1042",
"Where is my parcel?",
"Do you sell Prestige pressure cookers?"]:
route = classify(msg)
print(f"{route:9} <- {msg!r}")
print(" uses", HANDLERS[route](msg))Output
refunds <- 'I want my money back for order SE1042'
uses [refund prompt + refund policy docs]
tracking <- 'Where is my parcel?'
uses [order lookup tool + tracking prompt]
general <- 'Do you sell Prestige pressure cookers?'
uses [general FAQ prompt]Tip
Tip: Anthropic's own guidance is "find the simplest solution possible". Many "agents" in job descriptions are really routing + RAG workflows. Know both and explain the trade-off in interviews.