Gains:
- Applying the increasing scale of complexity from the simplest solution to the agent
- Distinguishing between chaining, routing and parallel workflow patterns
- Breaking a multi-step task into a planning-executing-verifying cycle
We established the single-vehicle simple cycle in the previous unit. Real work often requires multiple steps, multiple tools, and sometimes branching decisions: “Find orders that are late this month, draft an apology email to customers, summarize for a manager.” In this unit, we cover patterns for organizing multi-step tasks, when you need a real agent, and the planning-execution-verification cycle. The main principle: complexity as much as need.
Scale from Simplest Solution to Agent
Not every task deserves the most complex solution. Climb step by step on the complexity scale and stop at the simplest adequate solution:
- Single call: If the task is solved by a single model call (summarize, classify) stop here.
- Single call with RAG: If information is required, add retrieval and again single call.
- Fixed workflow: If the steps are known in advance, sequence them manually (code flow). The model does a sub-job at each step, but you determine the order.
- Model-driven agent: If the steps cannot be known in advance, the model decides which agent to call and when. The most powerful but most expensive and risky option.
The difference between Workflow and agent is critical: In Workflow, you write the flow of control (predictable, testable, cheap). You give control of the agenda to the model (flexible but unpredictable). Most corporate work is actually a workflow; real agents are relatively few.
Tip: "Can I write out the steps for this task in advance?" ask. If you can write it, build a workflow — cheaper, safer, more testable. However, if the steps vary depending on the input and cannot be predicted, an agent is required.
Three Basic Workflow Patterns
Prompt chaining: The output of one step is the input of the next. “Generate draft → edit → format.” Every step is simple and focused; easy to debug.
Routing: You first classify the incoming request and send it to the appropriate expert. “Is this question technical, billing, or refund?” → redirect to correct sub-stream. Each path is optimized with its own prompt and tools.
Parallelization: Running independent jobs simultaneously and combining the results. "Summarize 5 documents separately, then combine." Not only is it fast, but every piece gets full attention.
pattern
when
example
chained
Steps are sequential and dependent
Draft → edit → format
redirect
Different processing depending on input type
Support request classification
parallel
Independent sub-works
Summarize multiple documents separately
Agent (loop)
Steps cannot be predicted in advance
Open-ended research/repair
# Routing pattern (conceptual)type = pattern.classify(request) # "return" | "technique" | "invoice"if tour == "return": answer = return_flow(request)elif tur == "technical": answer = technical_flow(request)else: answer = invoice_flow(request)
Planning-Execution-Verification Cycle
A powerful pattern in real agents: have the model plan, then execute, then verify. The model breaks the complex task into sub-steps, performs each step with tools, and finally asks "did I achieve the goal?" he checks. The verification step catches errors with a separate, fresh look (“does this output meet the task?”).
# Plan-execute-verify (conceptual)plan = model.uret("Break this task into steps: " + task)for step in plan: result = agent_loop(step) # execute with toolscheck = model.uret("Does this output meet the task? Tell me if there is anything missing: " + task + results)if check.missing: # correction round ...
Two good practices for long tasks: impose a stopping condition (maximum number of steps — prevents infinite loop) and progress tracking (have the agent write down what he's doing so he doesn't get distracted). The agent, who has no step limit, can spin forever if he gets stuck and the cost will explode.
Weak/Strong Design
Weak (putting everything on one giant agent):
Say "get that complex thing done" and release it with unlimited tools.# Result: unpredictable behavior, risk of infinite loops, high cost,# impossible to debug.
Powerful (flow first, agent only where needed, limited):
First divide the job into fixed steps (routing + chaining). Use agent only in subtask where steps are unknown; Add step limit, progress tracking and verification round.
Three Mini Cases
Case 1 — Workflow instead of agent. One team set up the "process support request" task with a free agent; Sometimes the agent would turn 15 steps and go down the wrong path. The steps were essentially fixed (classify → fetch relevant information → write draft → submit for approval). When we switched to the routing + chaining workflow, consistency increased from 58% to 96% and the cost was halved.
Case 2 — Parallel gain. A legal team was summarizing 20 contracts one by one; It took 4 minutes in total. When we switched to a parallel pattern (all at the same time, then combine), the time was reduced to 25 seconds and the quality increased as each summary received full attention.
Case 3 — There was no stopping condition. An investigative agent kept calling the same two tools endlessly, searching for information he couldn't find; accumulated significant costs overnight. When the maximum 8-step limit and the "If you can't find it in 3 tries, say I don't know" rule were added, the cost was kept under control and honest "I couldn't find it" answers came.
Common mistakes
- Delegating everything to the agent: The workflow is cheaper, safer and testable if the steps are known.
- Mixing workflow with agent: Do you or the model take control? Don't design without making this clear.
- Not setting a stopping condition: The agent enters an infinite loop and accumulates costs.
- No progress tracking: During a long mission, the agent gets distracted, doing the same job again.
- Skipping the verification round: Incorrect but plausible-looking output is delivered unchecked.
Attention: The freer the agent, the larger the blast radius becomes. Flexibility is not free; every additional freedom adds unpredictability and risk. Choose the narrowest adequate solution.
In summary
- In complexity, the "as needed" principle applies: single call → RAG → workflow → agent only if really necessary.
- In Workflow, you write the flow of control (predictable); You leave the agenda to the model (flexible but risky).
- Three basic patterns: chaining (sequentially dependent), routing (distribute by type), parallel (independent jobs).
- Real agents use the plan-execute-verify cycle, stopping condition, and progress tracking.
- As flexibility increases, unpredictability and cost increase; Choose the narrowest adequate solution.
Application task
Choose a multi-step task from your own business (e.g. "prepare and distribute monthly report"). (1) Can you write the steps of this task in advance? If you can write it, design it as a workflow (what pattern: chaining/routing/parallel?); If you cannot write, explain why an agent is needed. (2) Draw your chosen design with a box-arrow diagram. (3) If agency: write how you will set up the stopping condition, progress tracking, and verification round. (4) List 3 risks of doing the same task with a “single dev agent”.
checklist
- [ ] I can choose the right level on the "complexity as needed" scale.
- [ ] I can distinguish the difference in control between Workflow and agent.
- [ ] I can map chaining, routing and parallel patterns to appropriate tasks.
- [ ] I can set up the plan-execute-verify cycle, stopping condition and progress tracking in agents.
- [ ] I keep in mind that too much flexibility brings unpredictability and costs.