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.
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.
Plan Steps
Decomposes the goal into an ordered sequence of tool calls and checks policies.
Which choices are autonomous versus requiring explicit human confirmation?
Read the diagram from the user's request on the left:
- Perceive the goal. The system interprets what the user wants and the context that constrains the request.
- Plan steps. It selects an approach and decides which actions or tools may be needed.
- Act through tools. It searches, retrieves, writes, calculates, calls an API, or delegates work.
- Observe results. It evaluates tool output and checks whether the goal has been met.
- 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 moment | Product question | Evidence to capture |
|---|---|---|
| Goal intake | What does the agent need to know before it starts? | Missing inputs, assumptions, clarification requests |
| Planning | Which choices can it make on its own? | Plan summary, selected tools, policy checks |
| Action | Which operations need confirmation? | Tool request, affected object, permission result |
| Observation | How does it judge whether an action worked? | Tool response, validation result, retrieved evidence |
| Stop or replan | What 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.