Skip to main content

Loading the visual lab…

#planning-reflectionAgentic AI

Planning, reflection and self-correction: from 60% to 90% success.

What you'll play with

  1. Welcome to #planning-reflection. The scene is still empty: no tree, confidence gauge at 0%. That is the starting point of every agent — it does not know how to break its task down. A robust agent does not just think-act-observe as in #react-loop: it plans first (breaks the goal into 5 to 7 sub-tasks), executes in order, verifies, and reflects on its failures to re-plan. This is Plan-and-Execute (Wang et al., 2023) extended by Reflexion (Shinn et al., 2023): agents with an explicit plan jump from roughly 60% to 90% success on multi-step tasks. At the top: the phase banner and the gauge. At the bottom: the current goal.
  2. Load a ready-made goal: /scenario refactor. The agent must refactor a module into 3 files — you will see the blue 'root' sphere (the goal) appear above, but no sub-plan yet.
  3. Decompose the goal: /plan. Watch the 5 grey spheres pop up one by one under the root — Analyze, Split into 3 files, Extract the types, Fix the imports, Run the tests.
  4. Execute the first node: /step. The sphere Analyze the module pulses blue (it is in-progress), then turns green with a . The confidence gauge climbs from 0 to about 20%.
  5. Keep going: /step. This time the Split into 3 files node fails (red, ). The agent stalls in the REFLECTION phase — the gauge drops, a purple halo softly appears around the failed node.
  6. Repair the plan: /reflect. The failed node turns gold (☆ replanned, the old one is still drawn but greyed and thin), and a new Split + unit tests shows up right next to it, ready to run.
  7. Let the loop finish by itself: /run. It chains the fix and then the remaining nodes, up to the ✓ DONE banner. The confidence gauge peaks and the right panel sums it up: 5 successes, 1 replanned.
  8. Your turn. Try /scenario data, /plan, /budget 5 1 then /run — the step ceiling hits before the end, banner ✕ FINAL FAILURE (a key lesson on the agent halting problem). Or /scenario research, /plan, /step a few times, /verify nok to force a failure on a successful node, /goal Migrate PostgreSQL 15 to 16 to redefine the target, /reset to start over. Next: #multi-agents (Premium) where a planner, workers and a verifier explicitly split the work — or head back to the free channel #react-loop.

Channel commands

  • /scenario <refactor|data|research>Load a ready-made goal (root only).
  • /planDecompose the goal into 5 sub-tasks (plan tree).
  • /stepRun the next pending node (deterministic success or failure).
  • /runLoop execute + reflect until done or final failure.
  • /reflectOn the last failed node: re-plan (purple halo + subtree in gold).
  • /verify <ok|nok>Force the verdict of the last executed node (useful to explore branches).
  • /budget <steps=3..20> <reflections=0..5>Set the safety net: max steps and max reflections.
  • /goal <text>Redefine the goal and reset the tree.
  • /resetReset the channel to its initial state (empty tree).

Glossary

Plan-and-Execute
Agent pattern that separates two roles: the planner breaks the goal into ordered sub-tasks, then the executor runs them one by one. Reference: Plan-and-Solve Prompting (Wang et al., 2023). Compared with the pure ReAct loop (#react-loop), the trace is verifiable before execution — you save LLM calls on bad trajectories.
Reflexion
Technique where the agent, after a failure, produces a natural-language self-critique that it appends to its context to retry with the lesson in mind. Paper: Reflexion: Language Agents with Verbal Reinforcement Learning (Shinn et al., 2023). Dramatically improves success rates on HumanEval, HotpotQA and ALFWorld.
Tree-of-Thought
Generalization of chain-of-thought: instead of a single line of reasoning, the agent explores a tree of possible reasonings, scoring each branch. Paper: Tree of Thoughts (Yao et al., 2023). Token-expensive but effective on tasks that require backtracking (planning, crosswords, Game of 24).
task decomposition
Breaking a high-level goal ('Refactor this module') into 5-10 concrete, executable sub-tasks. This is the basic brick of Plan-and-Execute: without it, a LLM gets lost midway. Good heuristic: every sub-task fits in one sentence and can be verified in 1-2 minutes.
verifier
Component (often a second LLM call, sometimes a unit test or a typecheck) that verifies a sub-task actually succeeded. Without a verifier, the agent takes its own actions at face value and stacks silent errors. Formalized in #multi-agents (Premium).
self-correction
Ability of an agent to detect its own errors and course-correct. Concretely: verifier → detects failure → reflection → new strategy. Boosts agent reliability but is not enough on its own: without external ground truth, a LLM can 'correct' toward an equally wrong answer.
agent halting problem
A LLM agent can loop forever (repeat the same action, think without acting, get lost in reflections). There is no theoretical halting guarantee: that is why every production agent ships with a hard budget (max steps, max reflections, max cost) and a kill-switch — not optional, mandatory.
iteration budget
Hard ceiling beyond which the agent stops, even without an answer. Two dimensions here: steps (number of executed nodes) and reflections (number of replans). Type /budget 5 1 with the data scenario to see the step ceiling trigger a FINAL FAILURE.
replanning
Adding (or replacing) a branch of the initial plan after a failure. Here: the old node turns gold (marked ☆), a new subtree appears. Different from a simple re-run: you change the strategy, not just the arguments.
plan tree
Hierarchical representation of a goal: root = overall goal, children = sub-tasks, grandchildren = sub-sub-tasks. Rendered here in 3D at two levels (root + leaves) to stay readable; real agents can go 3-4 levels deep with nested sub-plans.

Other channels in Agentic AI

  • #react-loopAn agent's ReAct loop: Thought → Action → Observation, live.
  • #tool-callingTool calling (function calling / MCP): the JSON that makes the LLM act.
  • #slash-commandsSlash commands, Claude Code / Cursor style: templates, arguments, chaining.
  • #context-memoryContext window and agent memory: count, truncate, summarize, index.
  • #planning-reflectionPlanning, reflection and self-correction: from 60% to 90% success.
  • #multi-agentsMulti-agents: planner, workers, verifier. A DAG that beats the monolithic agent.