The Machine Inside Us
I am noticing a growing trend. It used to be that when a friend or family member had a problem or challenge, they would go to someone they trusted and...
- Sep 09, 2025
- .
- by Chris Jenkin
There’s a moment with agents that feels like time bends, when you stop reacting, and start planning.
In agentic AI, that shift from “think‑as‑you‑go” to “plan then execute” isn’t just stylistic. It’s foundational. For systems that scale, need reliability, transparency, and guardrails, Plan‑then‑Execute (P‑t‑E) patterns are fast becoming the gold standard.
Let’s dive into how we can build resilient AI agents using FastAPI & LangGraph (or LangChain with LangGraph‑style orchestrators), separating strategy from action, and embedding robustness at every layer.
At its core, P‑t‑E means:
This differs from reactive or ReAct‑style agents, which interleave “thought / reason” + “act” in a loop, often without a global roadmap. The benefit of P‑t‑E: more structure, better predictability, easier to enforce safety & guardrails.
To build a solid Plan-then-Execute system, there are a few key building blocks to keep in mind.
The Planner Module is where everything begins. It takes a high-level goal and breaks it down into steps, using an LLM (sometimes combined with heuristics) to decide what tools to use and in what order.
Once the plan is set, the Executor Modules carry out the work. Each step could involve calling an API, running a microservice, executing code, or retrieving information. These modules often rely on smaller models or domain-specific logic tailored to the task at hand.
To keep everything safe and reliable, a Guardrails or Validator component checks that each step is valid, authorized, and safe. If something fails, whether it’s a tool error or a safety concern, the system can fall back to defaults or trigger replanning.
Agents also need State and Memory so they can keep track of progress, inputs, and failures. LangGraph is particularly strong here, maintaining workflow state, but you can also integrate external memory layers or databases for additional context.
Of course, things don’t always go smoothly. That’s why Error Handling and Monitoring is essential. By tracing failures, logging outcomes, and even triggering human-in-the-loop alerts, you build resilience into the system.
Finally, you need an API Layer and Interface to make the whole thing usable. FastAPI endpoints, real-time streaming, webhooks, dashboards, or interactive prompts give users a way to input goals, follow progress, and even intervene when necessary.
Here are patterns you should adopt, and trade‑offs to watch out for:
Here’s a sketch of what a system might look like if built at Gotcha! (in the near future, or we could already prototype):
Because being technical without reflection is like building a body without a soul.
Building AI agents that separate planning from execution isn’t future thinking, it’s present engineering. It’s resilience. It’s clarity. It’s safety. And for those who want their agentic AI to matter, not just run, P‑t‑E is your path.
At gotcha!, I plan to explore prototyping this in gSuite tools, maybe some version of a strategy agent powered by FastAPI + LangGraph + RAG + guardrails. Because the next leap is not more reactive agents, it’s agents that can think ahead.
I am noticing a growing trend. It used to be that when a friend or family member had a problem or challenge, they would go to someone they trusted and...
In today’s business world, customers don’t just buy products or services; they buy trust. The way people perceive your brand online directly influences whether they give you a chance, return...
Google is still the most powerful channel for small and mid-sized businesses. But showing up on page one is tougher than ever. Between shifting algorithms, AI-driven results, and more competition...