Module 1 • Lesson 245 mins

The Agent Loop & Five Architectural Layers

The 5-step agent execution loop (Goal → Plan → Act → Observe → Iterate), deconstructing the 5 architectural layers, and incident triage workflows.

Master the 5 steps of the core agent loop
Deconstruct the 5 system layers: Model, Tools, Memory, Orchestration, Deployment
Diagnose root causes of agent incidents across system layers

Understand the loop before defining the feature

An agent differs from a one-shot assistant because it runs a loop. The loop converts a goal into a sequence of decisions and actions. Every turn through that loop is both an opportunity to make progress and a possible failure point.

The Agent Loop

The iterative execution cycle: Perceive goal, plan steps, act through tools, observe results, and self-correct.

1. User prompt / task specificationExit: Termination condition met
Self-CorrectingResult unsatisfactory→ re-plannPerceive GoalPlan StepsAct (Tools)Observe

Plan Steps

Agent Action

Decomposes the goal into an ordered sequence of tool calls and checks policies.

PM Contract & Question

Which choices are autonomous versus requiring explicit human confirmation?

Read the diagram from the user's request on the left:

  1. Perceive the goal. The system interprets what the user wants and the context that constrains the request.
  2. Plan steps. It selects an approach and decides which actions or tools may be needed.
  3. Act through tools. It searches, retrieves, writes, calculates, calls an API, or delegates work.
  4. Observe results. It evaluates tool output and checks whether the goal has been met.
  5. Iterate or stop. It replans when the result is unsatisfactory, ends when the stopping condition is met, or escalates when it cannot proceed safely.

In the feedback example, the first pass is concrete. The agent receives “find the top onboarding problems from last month,” checks whether the date range and source set are available, retrieves only approved records, proposes themes, and verifies that every claim has supporting excerpts. If evidence conflicts, it lowers confidence or asks the PM; if fewer than the required sources are available, it stops with a partial result. The loop ends only when coverage and citation rules pass, not when the prose merely sounds convincing.

This loop gives a PM a practical way to specify the product. Do not write only the happy-path user story. Define the contract at each transition:

Loop momentProduct questionEvidence to capture
Goal intakeWhat does the agent need to know before it starts?Missing inputs, assumptions, clarification requests
PlanningWhich choices can it make on its own?Plan summary, selected tools, policy checks
ActionWhich operations need confirmation?Tool request, affected object, permission result
ObservationHow does it judge whether an action worked?Tool response, validation result, retrieved evidence
Stop or replanWhat ends the loop and what triggers recovery?Success criterion, retry count, fallback reason

If the team cannot describe these transitions, the concept is still a demo prompt rather than a product behavior.