Loop Engineering, Continued: From One Governed Loop to an Operable Fleet

Built for Speed: ~10ms Latency, Even Under Load
Blazingly fast way to build, track and deploy your models!
- Handles 350+ RPS on just 1 vCPU â no tuning needed
- Production-ready with full enterprise support
Six months after Noorâs loops moved off her laptop, Northwind has eleven registered triage and maintenance loops, and the problems have changed shape. Nothing is on fire the way the weekend token bill was on fire. Instead: two loops both âownâ the release-notes draft and overwrite each other every Friday; the Tuesday dependency-bump loop quietly stopped doing anything useful three weeks ago because a model it depended on was deprecated and it kept passing its own checker anyway; a security reviewer noticed that the loop reading inbound bug reports will cheerfully follow instructions written in a bug report; and the cheapest, most-used loop now spends more than the next four combined, and nobody can say whether itâs worth it. None of these are the failures the first post fixed. Theyâre the failures that only appear once the pattern works well enough to multiply. Thatâs the subject here.
The first post did the vertical translation â laptop primitive to governed primitive, one loop at a time. This post does the horizontal one: what an organization has to make true across loops and over their lifetime. The vocabulary still follows Addy Osmaniâs June 2026 essay and the surrounding discussion (Steinberger, Cherny, Willison), paraphrased with credit; the enterprise half follows TrueFoundryâs Agent Harness and Gateway documentation.
The first post vs. this one
1 Loops Are a Fleet, Not a Singleton
Osmaniâs anatomy describes a loop in the singular â one heartbeat, one set of skills, one maker and one checker. That is the right way to learn the pattern and the wrong way to run it, because loops do not stay solitary. They are useful, so they reproduce, and the moment there are several they start interacting in four ways the single-loop picture never has to account for.
Four ways loops interact once there is more than one
The fan-out case is already first-class on the harness. TrueFoundryâs Agent Harness sub-agents let the root agent delegate focused subtasks to parallel sub-agents, each with its own isolated context, returning only concise results â a context-hygiene win and a fleet-management win, since each delegated run is a unit you can trace independently. Delegation is deliberately one level deep and sub-agents canât message the user â guardrails against a fleet that spawns a fleet that spawns a fleet. (Worth being precise: sub-agents share the root agentâs tools and sandbox, so the isolation here is about context, not a separate set of tool grants â privilege boundaries belong at the agent and MCP level, which is the next section.)
The operating pattern that answers all four interactions is to treat each loop as a registered agent definition rather than a script, so the fleet has an inventory. On the harness, each loop is an agent definition â a model, MCP servers, skills, instructions â that lives in a catalog, runs in the same gateway plane as all other model and tool traffic, and carries its own identity. That last word is what makes the fleet tractable: per-agent identity is what lets contention, cost, and access be reasoned about per loop instead of per laptop. Northwindâs release-notes collision gets fixed not with cleverness but with ownership â one loop owns the artifact, the registry says so, and âwhich loops touch this?â is a lookup, not a hunt.

2 The Unreliable World: Keeping a Loop Alive Mid-Run
The defining fact about a loop is that nobody is watching it, and the corollary the single-loop discussion underplays is that nobody is watching it when the world breaks. A human at the keyboard absorbs a provider 503 without noticing â they just hit enter again. An unattended loop at 3 a.m. meets the same 503 and either dies, or worse, retries forever against a broken dependency and reprises Noorâs weekend bill. Reliability mid-run is not a nice-to-have for loops; it is the difference between a loop and a liability.
The AI Gateway is where a loop borrows the reliability it canât build for itself.
Reliability a loop borrows from the gateway

One thing the gateway can route around but cannot fix for you: idempotency. If a loopâs âopen a PRâ or âpost to the channelâ tool call gets retried after a network blip, you want one PR, not three. Thatâs a property of how the loopâs tools are designed (idempotency keys, create-or-update semantics), and itâs worth stating plainly because reliable retries make non-idempotent side effects more likely to double-fire, not less. The gateway gives you bounded retries; you still owe the fleet idempotent actions.
3 The Hostile World: the Unattended Attack Surface
Here is the topic the single-loop framing has the least to say about, and it deserves the most care. A loopâs whole value is that it reads the world â overnight CI output, open issues, error feeds, inbound emails, sometimes the open web â and acts on what it finds. Every one of those inputs is untrusted content that the loop will treat as instructions if you let it, and the thing that makes this acutely dangerous in a loop is the missing human turn. In an interactive session a prompt injection has to get past a person watching the output. In an unattended loop the injected instruction is read, believed, and acted on before anyone is awake. Northwindâs bug-report-reading loop following instructions embedded in a bug report is not an exotic attack; it is the default behavior of a system designed to do what its inputs tell it.
Least privilege at the agent and tool-grant boundary â not in a prompt. The maker/checker split is also a blast-radius split: a checker that can write is just a second maker with a security hole. The mistake to avoid is treating a verifier prompt like an authorization system. Enforce the boundary where it actually holds: the MCP Gateway cleanly separates inbound auth (which loop is calling) from outbound auth (whose credentials reach the downstream system), with per-tool RBAC and per-user OAuth delegation in between. If a workflow needs hard read-only vs. write separation, model it explicitly â separate agents with separate MCP grants, or separate tool policies â rather than relying on the checker to behave. An injection that reaches an agent without the relevant write grant hits a wall prompting alone never builds: the grant simply isnât there. (TrueFoundry sub-agents today give each delegated task isolated context and parallel execution while sharing the root agentâs tools, so the privilege boundary belongs at the agent and grant level, not inside the delegation.)
Guardrails on every call â including tool calls. The part teams miss is that injection and exfiltration donât only ride the modelâs text channel; they ride tool inputs and outputs too. TrueFoundryâs guardrails run on four hooks â LLM input, LLM output, MCP pre-tool, and MCP post-tool â so prompt-injection and secrets-detection checks screen not just what the model says but what the loop fetches and what itâs about to send. Because these are configured at the gateway, every loop inherits the policy automatically â no depending on five engineers to each remember it.

Human gates on the irreversible. A perfect checker still doesnât earn an unattended merge. Human-in-the-loop approvals pause the run before a destructive or non-read-only tool call, hold the runâs state durably, and resume only on an explicit decision â and the âwhich tools are destructiveâ judgment is made once at the MCP Gateway, org-wide, so it covers loops that donât exist yet. Sub-agents can trigger the same gate. This is the structural completion of the maker/checker idea: the checker grades the work; the gate guards the action; injection has to defeat both, and the second one isnât a model it can talk its way past.
4 The World Over Time: a Loop Is Software That Changes While It Runs
The single-loop story is told in the present tense â you build the loop, it runs. But a loop that earns its place runs for months, and over months it is edited: its instructions get tweaked, its skills get new versions, the models under it get deprecated and replaced, the systems it integrates with change their APIs. A loop is long-lived software that mutates while unattended â and that has a lifecycle, which is the thing a fleet cannot survive without.
Day-2 failure modes and the runtimeâs answer
The runtime answers each as version control plus measurement, not heroics. Skills are versioned artifacts in the Skills Registry â you pin a version to a production loop, test a new version on a staging loop, and roll back instantly if it regresses, with an audit trail of what changed and who changed it; prompts get the same treatment in the Prompt Registry. That turns âsomeone edited the skillâ from a Friday incident into a Tuesday promotion: staging loop on v7, prod loop on v6, promote only when v7 has earned it â and an eval gate should stand between an unattended edit and an unattended mistake.

And the dead-weight question becomes a line item. Because every run is a per-step trace with cost, tokens, and latency, and each run can carry loop or agent metadata, gateway cost analytics can roll spend up by loop, team, and model over time â so âis this loop worth it?â stops being a debate and becomes a comparison: the checkerâs cost visible separately from the makerâs, the popular loopâs economics legible enough to justify it or retire it. The lever is tagging the traffic correctly; the rollup follows from the metadata.
5 The Fleet as One Definition
Everything above is configuration, and configuration is the point: the fleetâs behavior should be declared, reviewable, and diffable â GitOps for loops â rather than living in scattered scripts and remembered conventions. An illustrative shape (simplified, not literal product schema):
# Fleet-level policy (set once, at the gateway â inherited by every loop)
gateway:
routing:
virtual_model: triage-default # weight/latency/priority targets + fallback
retries: { attempts: 2, on_status_codes: ["429","500","502","503"] }
caching: { type: semantic, similarity_threshold: 0.9, namespace_per: agent }
guardrails: # all four hooks, every loop
llm_input: [prompt-injection]
llm_output: [pii, secrets-detection]
mcp_pre_tool: [prompt-injection]
mcp_post_tool: [secrets-detection, pii]
budgets:
- { applies_per: agent, limit: 50/day, alert_at: [75,90,100] } # no more weekend bills
destructive_tools: [merge_pr, delete_*, deploy_*] # org-wide approval gate
---
# One loop in the fleet (references the above by name â no keys, ever)
agent:
name: bug-report-triage
owner: platform-team # the registry knows who owns it
model: triage-default # the virtual model, not a raw endpoint
instructions: ./triage.md@v6 # versioned; staging runs @v7
skills: [triage-runbook@v3] # pinned; rollback is one click
mcp_servers: [github, linear] # scoped, rotatable, RBAC'd at MCP Gateway
subagents: [explorer] # isolated context, parallel â share the root's tools
# hard read-only vs write separation â model as separate agents / MCP grants, not a prompt
harness: { max_steps: 60, max_tokens_per_run: 1_500_000 }
trigger: { schedule: "0 6 * * 1-5" } # the heartbeat â no laptop requiredThe exact field names above are illustrative â the real product primitives are routing and fallback, caching, guardrails, budgets and rate limits, MCP auth, skills, prompt versions, and approvals; the fleet-level policy shape is an operating convention you implement with them. The shape is the argument. Fleet-wide safety (routing, guardrails, budgets, the org-wide destructive-tool list) is declared once and inherited; per-loop specifics (owner, pinned versions, sub-agents) are declared per loop; and no long-lived provider or tool credentials need to appear in the loop definition â models resolve at the AI Gateway, tools authenticate at the MCP Gateway, skills come from the registry. Adding the twelfth loop is a reviewed pull request, not an archaeology project for the eleven that came before.
6 What the Fleet Doesnât Do: Someone Still Owns It
Osmaniâs closing warning â the loop changes the work, it doesnât delete you from it â survives the jump to a fleet, and gets a second clause. At single-loop scale, the danger is comprehension debt: the gap between what the loop ships and what you understand, growing with every unread PR. At fleet scale thereâs a parallel risk â operational debt: the dashboards exist, the traces exist, the budgets exist, and no one is appointed to read them. A runtime makes the fleet legible; it does not make it governed. Legibility is the precondition for governance, not a substitute for the person who owns the review.
So the role the fleet creates is not âthe person who built the loopsâ but âthe person who operates themâ â who watches review rates and approval patterns, reads the per-loop economics, and decides which loop to pin, promote, or retire. That role is cheaper and more possible on a managed harness than on a pile of personal rigs, because the operator inherits one pane of glass across model, tool, and agent traffic. But it is still a role, and the organizations that do loop engineering well will be the ones that staff it. Steinbergerâs line was that you should be designing loops that prompt your agents; the fleet-scale corollary is that someone should be operating the loops that prompt your agents â and Chernyâs âmy job is to write loopsâ has a managerâs mirror image: somebodyâs job is to run them.
7 Frequently Asked Questions
We only have a handful of loops. Is âfleetâ thinking premature?
The transition is quieter than youâd expect â itâs not a decision, itâs a Tuesday. Loops reproduce because they work, and the first time two of them touch the same system, or both spike the same provider, or one follows a poisoned input, youâre operating a fleet whether or not youâve named it. The cost of fleet thinking early is a registry and some policy; the cost of it late is the four incidents in this postâs opening paragraph.
How is a loop reading external content different from any agent reading external content?
By the missing human. Both face prompt injection; only the loop faces it with nobody in the turn to catch the obviously-wrong action before it executes. Thatâs why the loop case leans harder on defenses that donât require a human â least-privilege agents and MCP grants, isolated-context sub-agents, gateway guardrails on tool inputs and outputs, and hard approval gates on irreversible actions â rather than on a reviewer who, by definition, isnât there.
Doesnât routing and fallback just hide failures the loop should surface?
They hide transient failures, which is the goal â a 503 that resolves on the next target is noise, not signal. What they must not hide is persistent failure, which is why fallbacks pair with traces and budgets: the reroute keeps the run alive, and the trace records that it happened, so a loop thatâs constantly failing over is visible as a pattern even though no single run died. Reliability you canât see is just a slower way to be surprised.
How do we change a loop thatâs been running unattended for months without breaking it?
The same way you change any long-lived production software: pin the current version, run the candidate on a staging loop against recorded cases, gate promotion on not regressing, promote, and keep rollback one click away. The failure mode to design out is the well-meaning edit shipped straight to a 6 a.m. loop â versioning and an eval gate turn that into a reviewed promotion instead of a silent regression.
The first postâs thesis was that a loop is a production system the instant it runs without you. The Day 2 thesis is the plural and the long form of the same idea: a collection of loops, running for a year, is a production system-of-systems â with a system-of-systemsâ needs: an inventory, isolation, reliability under failure, defense against hostile input, a release process, and an owner. Design the loop, as Osmani says, like someone who intends to stay the engineer. Operate the fleet, weâd add, like someone who intends to stay the operator â on a runtime built to be operated, not just run.
References
- Addy Osmani â âLoop Engineeringâ (June 2026) â the anatomy this series builds on; paraphrased with credit, with his âstay the engineerâ caution carried forward to the fleet.
- Peter Steinberger and Boris Chernyâs June 2026 remarks on designing and writing loops rather than prompting agents â short quoted phrases attributed, via Osmaniâs essay, which quotes and links both.
- Simon Willison â âDesigning agentic loopsâ (September 30, 2025) â the earlier articulation of loop design as the critical skill, paraphrased.
- Loop Engineering at Enterprise Grade â the first post in this series; this one is its horizontal (fleet) and temporal (lifecycle) continuation.
- TrueFoundry Agent Harness â managed runtime: sub-agents, sandbox, human-in-the-loop, skills.
- AI Gateway routing & fallback, caching, budgets, and rate limits â the reliability and economics layer under the fleet.
- MCP Gateway auth & security, Guardrails overview, prompt-injection and secrets-detection â the least-privilege and inspection layer.
- Adjacent posts: online evaluation at the gateway, AI FinOps, and prompt injection against coding agents.
Northwind and Noor are an illustrative composite continued from the first post, not a specific organization or incident. The loop-engineering framing follows Addy Osmaniâs June 2026 essay and surrounding community discussion (Steinberger, Cherny, Willison), paraphrased with credit; quoted phrases are under fifteen words and attributed. Configuration snippets are simplified for readability and are not literal product schema. TrueFoundry capabilities reflect public documentation at the time of writing; verify against current docs.
â
TrueFoundry AI Gateway delivers ~3â4 ms latency, handles 350+ RPS on 1 vCPU, scales horizontally with ease, and is production-ready, while LiteLLM suffers from high latency, struggles beyond moderate RPS, lacks built-in scaling, and is best for light or prototype workloads.



















.png)


.png)



.webp)
.webp)






