OpenClaw Academy

OpenClaw Academy

Agentic Design Patterns in Running Code

OpenClaw Academy · Part 2, Issue 16

AI Engineering's avatar
AI Engineering
Jul 09, 2026
∙ Paid

The agentic engineering community has a vocabulary of design patterns — ReAct, Plan-and-Execute, Reflexion, Human-in-the-loop. You find these names in Google’s agents whitepaper, in academic papers, in framework documentation. What you almost never find: what they look like as working code in a real, running agent.

OpenClaw is that implementation. Every pattern in this issue is a working OpenClaw configuration you can clone and run.



ReAct: the default you’re already using

ReAct (Reason + Act) is the pattern every OpenClaw session implements by default. The agent reasons about what to do, takes an action (tool call), observes the result, reasons again, takes another action. The loop continues until the task is complete or an error halts it.

Naming this explicitly — calling it ReAct — makes debugging tractable. When a tool call produces an unexpected result and the agent proceeds as if it were correct, the failure is in the Observe step: the agent’s observation of the result was wrong. When the agent takes the wrong action despite correct reasoning, the failure is in the Act step: the wrong tool was called or called with wrong parameters.

ReAct debugging is about identifying which step in the Reason-Act-Observe loop failed. Not “the AI got confused.”

Plan-and-Execute adds a planning phase. Before executing anything, the agent generates a complete, structured plan — a numbered list of steps, each with a specific tool call and expected output. Only after the plan exists does execution begin.

When to use it: the task has 5+ steps, and discovering an infeasible step at step 4 is expensive. A plan makes the infeasibility visible before any irreversible actions have been taken. In OpenClaw: implement as two skills — planner.md (generates the JSON plan) and executor.md (processes it step by step).

Reflexion adds a self-evaluation step between task completion and response delivery. The agent evaluates its own output against a rubric: does it satisfy each requirement? Where does it fall short? If the evaluation score is below a threshold, the agent regenerates with the identified improvements.

When to use it: output quality is measurable (code correctness, format compliance, factual accuracy) and the cost of a wrong output is higher than the cost of the extra API call.

Human-in-the-loop is TaskFlow with wait_for_response: true. Covered in Issue 14. Use for every workflow with irreversible consequences.

Subscribe to Access Github

Github Link:

https://github.com/sysdr/openclaw-academy/tree/main/part-2/issue-16/vault-files


User's avatar

Continue reading this post for free, courtesy of AI Engineering.

Or purchase a paid subscription.
© 2026 AI Engineering · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture