skip to content

Why plan a freight-routing agent's legs upfront but run ReAct inside each leg?

level: seniorimportance: should knowfreq 40%

answer

  1. skeleton knowable, joints not
  2. plan the shape, loop inside the step
  3. uncertainty has a granularity
  4. typed result out, plan untouched
  5. verifiable postcondition per step

basics

~20 s

Because predictability is uneven across the task. The nine-leg route sequence is stable, auditable and parallelizable, so plan it. Each leg's actual execution is messy and data-dependent, so give it a short bounded reasoning loop.

solid answer

~50 s

The hybrid puts each control strategy where it earns its keep. For a nine-leg European truck route, the *shape* of the work is knowable in advance: the leg order follows from geography and delivery windows, so writing it upfront gives you a deterministic artifact you can price, review and check against permit rules before a single booking is made — and independent legs can be prepared concurrently. Inside a leg, nothing is knowable in advance. A carrier API returns partial data, customs paperwork disagrees between two providers, a toll lookup times out. That is exactly the situation ReAct is for: reason, call, observe, adapt, with each decision grounded in what just came back. The engineering discipline is the boundary. Each planned leg gets a narrow input contract and a verifiable postcondition, and the inner loop returns a typed result rather than editing the outer plan — so an inner loop that flails is contained to one leg instead of derailing the route.

go deeper

for a junior

Know that the hybrid plans the big steps upfront and runs a small reason-act-observe loop inside each one, rather than choosing one strategy for everything.

for a middle

Explain why: the sequence is predictable and worth auditing, while what happens inside a step depends on live tool results that nobody can enumerate in advance.

for a senior

Design the seam — per-step postconditions you can verify, a typed return contract instead of plan mutation, and tool scoping per step so a confused loop stays contained.

for a principal

Own the framing that uncertainty has a granularity, and that architecture should match it: coarse uncertainty means no plan, fine-grained means plan the shape, none at either level means no agent.

## Why hybrids exist at all The pure strategies each assume something uniform about the task. Plan-and-execute assumes the whole sequence is knowable before anything runs. ReAct assumes none of it is, and pays a reasoning call per step for that assumption. Real workflows are rarely uniform: their *skeleton* is predictable while their *joints* are not. The hybrid — a coarse upfront plan whose steps each contain a small bounded reasoning loop — matches the control strategy to the local level of uncertainty rather than picking one for the whole task. ## The freight case, concretely A multi-leg European road-freight route is a good example because the two layers are so visibly different. The **outer layer** is stable. Given an origin, a destination, a delivery window and the cargo type, the sequence of legs — which corridors, which crossings, which rest stops satisfy driving-hours rules — is derivable upfront. Writing it as a plan gives you four things at once: a price estimate before committing, a document a dispatcher or a compliance rule can inspect (does this route need a hazardous-goods permit?), the ability to prepare independent legs concurrently, and a stable identity for the route across the run. The **inner layer** is not stable at all. Booking a leg means talking to carrier systems that return stale capacity, customs endpoints that time out, document services that disagree. You cannot enumerate those calls in advance because which call you make second depends entirely on what the first returned. A ReAct loop handles this natively — and typically resolves a leg in two to five turns, which is a cheap loop, not a twelve-turn epic. ## Designing the boundary The hybrid only pays if the seam between layers is disciplined. Three rules do most of the work. **Every planned step needs a verifiable postcondition.** "Leg 4 booked" is not a postcondition; "a confirmation reference exists for leg 4 with the agreed price and pickup window" is. Without one, the outer layer cannot tell whether the inner loop actually succeeded or merely stopped, and an agent claiming success it did not achieve is a well-known failure mode. **The inner loop returns a typed result; it does not edit the plan.** If an inner ReAct loop can rewrite the outer step list, you have thrown away the determinism you bought by planning. Let it return success with data, or failure with a reason, and let the outer layer own what happens next. **The inner loop gets only the tools and context its step needs.** Scoping the toolset per step raises tool-selection accuracy and shrinks the blast radius of a confused loop. It also keeps the inner prompt small, which is where the cost saving over a single flat ReAct run comes from. ## What it costs Hybrids are not free. You now have two prompt layers, two failure modes and two places to look when something goes wrong; traces are nested rather than flat, and your evaluation harness has to score both the plan quality and the per-step execution. There is also a real risk of over-engineering: if the inner loops reliably resolve in one call, the loop is ceremony and the step should just be a direct tool call. Conversely, if the outer plan is wrong more often than it is right, you are paying for structure that keeps being discarded, and a flat adaptive loop is more honest. ## The judgement to articulate The question to ask of any workflow is: *at what granularity does my uncertainty live?* If uncertainty is coarse — you do not know the overall approach — plan nothing and run ReAct. If uncertainty is fine-grained — you know the approach but not how each piece will behave — plan the approach and loop inside the pieces. If there is no uncertainty at either level, you should not be running an agent at all. That framing is what separates a senior answer from a pattern-matching one. The hybrid is not a smarter architecture that dominates the others; it is the right answer specifically when predictability is layered, which in operational domains like logistics, claims processing and deployment automation it very often is.

  • What makes a good boundary between a planned step and its inner loop?
    A step should have one clear objective, a narrow tool scope, and a postcondition you can verify without asking the model — a confirmation reference exists, a file parses, a total matches. That lets the outer layer trust the inner loop's report instead of taking its word for it, and keeps a confused loop contained to one step's blast radius.
  • How do you stop an inner loop from quietly rewriting the outer plan?
    Give it a return contract instead of write access. The inner loop reports success with data or failure with a reason; only the outer layer touches the plan. If inner loops can mutate shared plan state, you lose the determinism and auditability that motivated planning in the first place, and concurrent steps start racing each other.
  • When is the hybrid over-engineering?
    When the inner loops reliably finish in a single call — then the loop is ceremony and the step should be a plain tool call — or when the outer plan is wrong more often than it holds, in which case you are paying for structure that keeps getting discarded and a flat adaptive loop is more honest. Two layers cost you two failure modes and nested traces.

saying these in an interview costs you the question

  • Treats the hybrid as strictly better rather than right for layered uncertainty
  • Lets the inner loop mutate the outer plan, discarding its determinism
  • Defines step success as the loop stopping rather than a checkable postcondition
  • Gives every inner loop the full tool catalogue instead of its step's scope
  • Wraps single-call steps in a reasoning loop that never changes the outcome

context