Runnable Agents Lab
rag_service/agents_lab/ Python package — watch a thought become a tool call, a tool result re-enter the loop, and the loop finally stop. For the theory behind them, read agent architectures and the code-first ReAct agents lab.How to read a trace
When to use which
ReAct — one trip through the reason-act-observe loop
services/llamaindex/rag_service/agents_lab/react.pycurl -sX POST https://ai-engineer-roadmap.xyz/api/agents-lab/run -H 'content-type: application/json' -d '{"pattern": "react", "task": "What is 17 * 23, minus 100?"}'Reason
I need to compute 17 × 23 and then subtract 100. That is exact arithmetic — I should not do it in my head, I should call the calculator so the result is ground truth rather than a guess.
What to notice: This is the 'reason' half of ReAct. The thought is where tool selection happens — the model decides *which* tool and *why* before it acts. The paper's key ablation showed that acting without this thought makes the model pick tools poorly and flail when a result surprises it.
Reflexion — fail, self-critique in words, retry
services/llamaindex/rag_service/agents_lab/reflexion.pycurl -sX POST https://ai-engineer-roadmap.xyz/api/agents-lab/run -H 'content-type: application/json' -d '{"pattern": "reflexion", "task": "Write an example sentence that is exactly seven words long."}'Attempt 1
"The waves crashed loudly against the rocky shore." — that reads like about seven words to me.
What to notice: The actor runs with an empty lessons list — a plain first try, no memory yet. Reflexion adds nothing to a single attempt; its whole value appears only across trials.
Plan-and-Execute — decompose first, then run the steps
services/llamaindex/rag_service/agents_lab/plan_execute.pycurl -sX POST https://ai-engineer-roadmap.xyz/api/agents-lab/run -H 'content-type: application/json' -d '{"pattern": "plan-execute", "task": "A team of 3 reads 40 pages/day each. How many days to finish a 1,320-page book, and what weekday do they finish if they start on a Monday?"}'Plan
1. Compute the team's combined pages-per-day rate.
2. Divide the total pages by that rate to get the number of days.
3. Count that many days forward from Monday to find the finish weekday.
What to notice: The planner emits the entire decomposition BEFORE any step runs — this is the defining difference from ReAct, which decides one action at a time. A stated plan is what cuts per-step drift on long tasks and makes the whole trajectory auditable up front.