← Back to library
AANative5 min readARTICLE

Episode 2 — Inside the Agent Planner: How Enterprise AI Agents Actually Think

14 July 2026

Building Enterprise Agentic AI Systems — Episode 2

In the last episode, I covered the AI Gateway — the front door of the enterprise AI platform. Every request gets authenticated, authorized, checked against policy, and logged before it touches a model.

The gateway answers one question: should this request run?

Episode 2 is about the harder question: how does it run?

That's the Agent Planner. And it works nothing like most people expect.

The mental model most people have

When someone says "AI agent," most people picture something like this:

Prompt → LLM → Answer

Send a message, get a response. The model figures it out. Simple.

That mental model is fine for a chatbot. It falls apart the moment the agent needs to answer a question that requires information from three different systems, multi-step reasoning, and a traceable audit trail.

Here's the thing nobody tells you: in a real enterprise agent, the model is actually the last thing that runs. Before it generates a single word, something else has to happen.

What the Agent Planner actually does

The planner runs a loop called ReAct — Reason and Act. It looks like this:

Agentic Planner architecture
Agentic Planner architecture — click to view full size

Every step is a decision. The planner decides which tools to use, in what order, and whether the result from each tool is good enough to proceed — or needs a re-query.

This is the part most enterprise AI implementations get wrong. They skip the planning loop entirely and go straight from prompt to model. The result is an agent that guesses when it should retrieve, hallucinates when it should query, and has no audit trail of how it reached its answer.

Seeing it in action: the Agent Planner Lab in NexusIQ

I built the Agent Planner as the second layer in NexusIQ, picking up directly where the Gateway left off.

The request — Summarize regional sales performance for Q2 across all territories — came through the Gateway in Episode 1. It was approved: Manager role, Sales domain, SQL Layer and Summary tools permitted, General model selected. The Planner receives all of that context. It doesn't re-check permissions. It works within what the Gateway decided.

Here's what the loop looks like in practice.

Step 1 — Understand goal

The planner classifies the intent as performance summarization. Complexity medium — dual source retrieval. It confirms the General model is the right choice: fast, low cost, appropriate for this type of query. Not every request needs a reasoning model.

Step 2 — Decompose into sub-tasks

This is the step that matters most. The planner breaks the goal into two independent sub-tasks:

  • Regional revenue data → SQL Layer
  • Synthesis context → Summary layer
  • Two different problems. Two different tools. Each chosen deliberately because it's the right tool for that specific piece of the answer.

    This is goal decomposition — and it's what separates an agent from a chatbot. A chatbot sends your question to one model and hopes. An agent breaks the problem apart first.

    Step 3 — Act and Observe

    The SQL Layer fires first. Here's the actual query the planner constructed:

    SELECT region, SUM(revenue) AS total_revenue,

    COUNT(deals) AS deal_count,

    AVG(deal_size) AS avg_deal

    FROM sales

    WHERE quarter = 'Q2'

    GROUP BY region

    ORDER BY total_revenue DESC

    Real SQL. Not a description of a query — the actual query, constructed from the natural language request and executed against the data layer.

    Five regional records returned. EMEA leading, Americas underperforming.

    After every tool call, the planner observes. Was the result sufficient? Does it need to re-query with different parameters? In this case — quality high, result sufficient, moving on.

    That observe step is what makes this a loop, not just a sequence.

    Step 4 — Synthesize

    Sources merged. No conflicts detected. Coherence high. Ready to generate.

    Step 5 — Generate

    Structured response. Four sections: regional breakdown, top performers, underperforming regions, quarter-on-quarter delta. Not a wall of text — a structured output that downstream systems or humans can actually act on.

    The connection to the AI Gateway

    One detail worth highlighting. When the AI Gateway approved the request, the approved tools, the selected model, and the original query all carried forward to the Planner automatically. Nothing was re-entered.

    That continuity is intentional. The AI Gateway and the Agent Planner are not separate applications that happen to run in sequence. They are layers of one system sharing context. The Gateway's decisions constrain what the Planner can do — which tools it can call, which model it can use, what data it can access.

    The Planner doesn't re-check permissions. It trusts the Gateway. That separation of concerns is what makes the architecture governable at scale.

    The AI Gateway decided whether. The Agent Planner decided how.

    What comes next

    Episode 3 is the Enterprise Knowledge Layer.

    You saw the Summary layer retrieve context in this episode. Episode 3 goes deeper — semantic search, document chunking, reranking, citation, and the genuinely hard problem of combining structured SQL results with unstructured document retrieval in a single coherent response.

    The gateway decided whether. The planner decided how. Episode 3 shows where the knowledge actually comes from.

    Refer Episode 1 here

    Continue exploring

    More articles, videos, and architecture diagrams in the library.

    Back to library →