Planner–Executor and DAG Agents
Asha wants a full holiday: Pune → Jaipur → Udaipur → Pune, trains for all three legs, weather for both cities, and a total under ₹8,000. Run step by step with ReAct, Tripmate wanders — it checks Udaipur weather before it has even picked dates. Big tasks go better when someone draws up the plan first, and when steps that do not depend on each other run side by side.
The rule
Plan the whole job first, then run each step as soon as its inputs are ready.
Planner–executor splits the work into two roles:
- The planner (a model call) turns the goal into a list of concrete steps.
- The executor carries out each step — with tools, simple code, or a smaller, cheaper model — and reports results.
- If a step fails or reveals a surprise, control goes back to the planner to replan the remaining steps.
A DAG agent goes one step further. It writes the plan as a directed acyclic graph: each step is a node, and an arrow means "this step needs that step's result". Acyclic means no step can depend, even indirectly, on itself, so the graph always has a valid order. Steps with no arrow between them can run in parallel.
search leg 1 ─┐
search leg 2 ─┼─→ compare & total ─→ ask Asha ─→ book all three
search leg 3 ─┘
weather Jaipur ─────────────────────↗ (shown with the options)
weather Udaipur ────────────────────↗The same idea scales to multi-agent systems, where each node is handled by a specialist agent — one for trains, one for hotels — coordinated by the planner.
The shortcut
For each step ask: "What must be finished before this can start?" Draw an arrow from each of those. Everything with no incoming arrows starts right away; the slowest chain of arrows sets the total time.
List the steps and times
Three train searches at 4 s each, two weather checks at 2 s each, compare 3 s, confirm with Asha, book 5 s.
The trap is over-planning simple tasks. A planner call costs tokens and time; for "will it rain on Friday?", ReAct's two steps are faster than drawing a graph.
Drills
Answer fast — trust the rule.
In planner–executor, what happens when a step fails unexpectedly?
In a DAG plan, which steps may run in parallel?
Why must the graph be acyclic?
Searches take 4 s, 6 s and 5 s in parallel, then comparing takes 3 s. How long until the comparison finishes?
Remember
- Planner–executor: plan first, execute steps, replan on surprises.
- Shortcut: draw an arrow for each "must finish first"; unconnected steps run in parallel, the slowest chain sets the time.
- Trap: planning heavily for tasks a two-step loop could finish.
