Ep6 · Planning Agents From Scratch — Plan-and-Execute vs ReAct (Python)
Every agent we've built has been a REACTOR: it decides one step at a time, looking at the last result before choosing the next move. That's ReAct, and it's flexible — but it never steps back to see the whole job. This episode we build the other pattern: PLAN-AND-EXECUTE. The agent reads the task, writes the whole numbered route up front — before any tool runs — then walks it, step by step. The pattern is three moves: • plan — one model call turns the task into a numbered list of steps, each doable with one tool. You can READ the plan before anything executes. • execute — walk the list, run the right tool for each step, and carry the results forward, so a later step can use the numbers an earlier step found. • answer — one last call folds every result into a final reply. ReAct vs plan-and-execute isn't "which is better" — it's a trade. Planning gives you a visible, auditable route and shines when the steps are mostly knowable; ReAct adapts better when each step depends on what the last one turned up. Real agents often do both. NEW this episode: a tiny TRACER. An agent is a multi-step loop that's invisible from the outside — you only see the final answer. We wrap the run in a ~40-line tracer that records every model call and tool call — tokens, cost, latency — prints the whole run as a tree, and saves it to a SQLite file. It's the per-RUN analog of Season 1's per-CALL cost meter, and every agent from here on runs under it. You can't improve what you can't see. ⏱️ Chapters 0:00 Every agent so far just reacts 0:30 ReAct vs plan-and-execute 1:09 The pattern: plan, execute, answer 1:41 New this episode: a tracer 2:14 The code: adding a planner 2:49 The tracer in code 3:32 Planner, executor, answer 4:43 Run it: the plan, then the run tree 7:07 Recap + Ep7 tease (markdown memory) 🧠 What you'll learn • Plan-and-execute vs ReAct — and when each one wins • Writing the whole route up front, then executing with results carried forward • Why the calculator step can use numbers the look-up steps just found • A tiny from-scratch agent tracer: run tree + tokens + cost, persisted to SQLite Same OpenAI SDK, free Gemini key (no cloud bill) as the whole series. 💻 Code (clone & run, free Gemini key): https://github.com/vahid8/ai-agents-f... ▶ Season 1 — AI Engineering from Scratch (the gateway + cost meter this tracer echoes): https://github.com/vahid8/ai-engineer... 🔗 Free Gemini key: https://aistudio.google.com/apikey #AIagents #Planning #ReAct #Agents #Python #LLM #Gemini #Tracing #Observability

5,000,000 Rows. 3 Steps. Here's What's Actually Inside a Database Index.

Ep5 · Give Your AI Agent a Memory — Short-Term + Long-Term From Scratch (Python)

Agents and themes in QSEM

Brian Cox- The Fermi Paradox Will Change How You See The Universe

Stanislav Krapivnik: Russlands Wut kocht über – Steht ein EU-Russland-Krieg bevor?

Charts from Scratch on Compose Canvas — One Library, Every Platform

Blue gradient background - screensaver, mood lighting, ambiance, TV art, focus, study

L’Iran ANÉANTIT les troupes US, le Yémen BLOQUE la mer Rouge | Alexander Mercouris

Android 17 sucks. So I put Linux on a phone.

How AI agents & Claude skills work (Clearly Explained)

Don't Hang Up On AI Scammers. Do THIS Instead.

The Best Local Agentic Coding Workflow (Complete Guide)

China Is About To Pop The AI Bubble

CANBUS – Networking so simple, even YOU can understand it!

Every Free App You Actually Need Explained in 20 Minutes

This Chinese Tech Giant Is Quietly Killing Windows

Alex Hormozi’s Warning: Stop Chasing AI, Build This Instead!

Chosen One!! The Assignment Over Your Life is Not for the Weak 💯 You've Done the Impossible!!

AI Agents from Scratch — Series Trailer · Build Agents in Python (No Framework)

