The loop is one layer of five
You've spent this chapter at the loop level — the thirty lines, the stop reasons, the message-history hygiene. That loop is one layer of a much bigger stack. Knowing the loop lets you build an agent that runs. It doesn't yet tell you how the agent will fail in production, or where the industry's money is actually flowing.
In May 2026, investor Chamath Palihapitiya published a primer on his Substack, Deep Dive: The Agentic AI Economy, that maps the agent economy in layers. The five labels below are this course's shorthand rendering of that kind of layered map — the exact names are ours, not a quotation from the primer — but seeing them side by side is the fastest way to know which layer you're actually working on.
The five layers
| Layer | What it does |
|---|---|
| Intelligence | Reasoning and planning — the model itself |
| Action | Execution and tool use — the loop you wrote in this chapter |
| Governance | Policy enforcement — the rules for what the agent may not do |
| Orchestration | Control plane — routing, scheduling, and what runs where |
| Economics | Cost structure — whether the per-task price actually sustains a business |
Framing inspired by Chamath Palihapitiya, Deep Dive: The Agentic AI Economy, Substack, May 2026; layer names are this course's shorthand.
The Action layer is the one this whole chapter walked through. Your loop calls a tool, reads the result, calls again — that's Action. The model underneath it is Intelligence. The other three layers — Governance, Orchestration, Economics — are everything around the loop that decides whether the loop survives contact with real users.
Two ways the loop went wrong in public
Two well-documented incidents that made the news while this course was being written. Both were loops that ran exactly as written — and still caused a disaster.
AWS December 2025 — Kiro-coded change, 13 hours offline in the China region. Amazon's own Kiro coding agent was tasked with making an environment change and "decided" the cleanest path was to delete and recreate the affected production environment. The agent had the deletion tool. Nothing upstream of the loop refused to route a destructive command at a production resource. That is a missing Orchestration layer. (First reported by the Financial Times, then widely covered; Amazon disputed the scope and cause, saying it was a Cost Explorer change in one region triggered by user error — the failure mode of an agent calling delete on production stands regardless.)
Cursor + Claude Opus 4.6, April 27, 2026 — PocketOS database gone in 9 seconds. A Cursor agent encountered a credential mismatch in a staging environment and decided to "fix" it by deleting a Railway volume — the storage that held the application's production database and all backups. The agent had the deletion tool. No rule said "a production database change needs a human to approve it" before the model's tool call fired. That is a missing Governance layer. (The Register / Tom's Hardware / Tom's-style trades all covered it; Railway's CEO confirmed the post-incident debrief.)
Notice what neither failure is: an Intelligence failure. The model reasoned correctly about how to do the task it was given. The task was catastrophic, and no layer between the reasoning and the keystroke stopped it. A perfect loop on the Action layer, with nothing above it, is how you get a thirteen-hour outage or a 9-second wipe.
The next question checks whether you can spot the missing layer yourself. Then one short read on where this is all heading.