C.W.K.
Stream
Lesson 02 of 05 · published

Advanced Planning: Branches, Review, Replan

~36 min · planning, tree-of-thought, review

Level 0Observer
0 XP0/40 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Planning is search under constraints

A plan is not a pretty numbered list. It is a search strategy with constraints: tools available, budget, risk, acceptance criteria, and known unknowns. Good agents use planning to change execution, not to decorate the transcript.

Use branches when the first route is not obviously best

Tree-of-thought style planning is useful when several plausible routes exist and the cost of a bad route is high. Generate alternatives, score them against explicit criteria, then execute the selected route. Do not branch for trivial tasks. That is just latency cosplay.

Reflection must be tied to requirements

Reflection without criteria becomes wordy self-praise. A reviewer pass should check named requirements, evidence, tests, safety boundaries, and stop reasons. If the review fails, the next run must change something.

Code

Branch and choose·python
def choose_plan(task, constraints, n=3):
    candidates = [
        planner.call({
            "task": task,
            "constraints": constraints,
            "instruction": f"Propose route {i+1} with tools, risks, and stop condition.",
        })
        for i in range(n)
    ]
    scored = reviewer.call({
        "task": task,
        "plans": candidates,
        "rubric": ["fits constraints", "low blast radius", "verifiable", "cheap enough"],
    })
    return scored["best_plan"]
Replan only when inputs change·text
Failure: web_search timed out
Retry? yes, with smaller query or alternate provider

Failure: permission denied for deploy
Retry? no, ask for approval or change goal

Failure: tests failed
Retry? yes, after reading failure output and editing a cause

Failure: schema validation error
Retry? yes, after changing schema or arguments

External links

Exercise

Take one complex agent task and write three possible plans. Score each on cost, risk, verifiability, and recovery path before choosing one.
Hint
The point is not to make three random lists. The alternatives should expose a real tradeoff.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.