Workflows or agents: chaining, routing and parallel steps
Agents & Tool Calling · 10 questions
Short notes
Key idea
Not every LLM app should be an agent. A workflow runs fixed steps that you design; an agent lets the model choose steps. Use workflows when the path is known, and agents only when it truly varies.
Syntax
Common workflow patterns:
- Prompt chaining: step 1's output feeds step 2 (draft → check → polish).
- Routing: classify the input, send it to a specialised prompt or model.
- Parallel: run independent calls at once and combine them (sections, or votes).
- Orchestrator–workers: one call plans subtasks, others do them.
- Evaluator–optimiser: one call writes, another critiques, repeat.
Example
Support emails: route to "refund", "delivery" or "other" with a small model, then use a fixed prompt per route. Cheaper, faster and easier to test than an agent deciding everything.
Traps
- Starting with an agent because it sounds advanced; it's harder to test and costs more.
- Long chains compound errors; check output between steps.
- Routing with no "other" path forces wrong choices.
- Measure before adding complexity: a single good prompt may be enough.
Want the full lesson with step-by-step examples, a project and a certificate? Agents & Tool Calling course, ₹180 →
- Question 1easy
In a workflow, who decides which step comes next?
- Question 2medium
The router returns an unexpected label. What does this print?
HANDLERS = {"refund": lambda t: "refunds", "account": lambda t: "account"} label = "Refund." print(HANDLERS.get(label.strip().lower().rstrip("."), lambda t: "general")("...")) - Question 3medium
Three independent checks on a reply each take 1 second. How long do they take with asyncio.gather (within rate limits)?
- Question 4medium
Every ticket goes through the same steps: classify, look up the order if there is one, find the policy, draft a reply. Which design fits?
- Question 5hard
When is an agent the better choice than a workflow?
Workflows or agents: chaining, routing and parallel steps
Workflows or agents: chaining, routing and parallel steps
Workflows or agents: chaining, routing and parallel steps
Workflows or agents: chaining, routing and parallel steps
Workflows or agents: chaining, routing and parallel steps
5 more questions on this topic, with hints, and tests
Sign up free for 21 days of every question and test.