
The Outer Loop Problem: Agentic AI for Regulated Software
In regulated software, compliance risk sits in the outer loop. AI-DLC v2 uses guardrails, review agents and human gates to make AI-assisted work checkable.
Introduction
Software teams in regulated industries adopted AI coding assistants quickly and the gains in the inner loop are real. The inner loop is writing the code itself: generating, testing and debugging it, whether a developer or an agent does the work. It runs without anyone needing to decide anything. The outer loop is the work around it that depends on what only people know: turning business requests into requirements, making security calls on code and writing runbooks that say who must be notified when something breaks. AI already helps with each of these, when someone chooses to use it. On most teams, nothing requires it, checks it or records that it happened. In a regulated environment, that is the gap: a check that runs only when someone remembers is not a control.
This post shows what changes when that help becomes a structured, verified workflow. AI-DLC (AI-Driven Development Lifecycle) v2, an open-source methodology, puts an inner loop under each piece of outer-loop work and keeps a person's decision at the end of it. We use legal technology as the lens and follow one example from kickoff to runbook; the patterns apply wherever compliance shapes how software ships.
From Optional to Enforced
AI-DLC v2 turns optional checks into required ones by running the work as a fixed sequence of stages. Each stage has defined inputs and outputs, and conditions the output must meet before work moves on. Those conditions are guardrails written into the workflow's code, not left to the model, so they apply the same way every run. Separate review agents then return a verdict before any person sees the output. By default, each stage ends at a gate, a checkpoint where a person approves or asks for changes.
Before each gate, the system lists what it learned during the stage, and the person chooses which lessons to keep. Those lessons become rules the next run checks unasked: enforcement shifts from individual memory to knowledge the system keeps.
The Blueprint: Two Loops, Three Phases
A run starts the way most AI work does: someone describes a goal in plain words. Consider a need we've seen with customers: a firm's engineering team wants every pull request checked against its standards, with critical findings blocking the merge and the rest posted as comments, run as one central service rather than set up on each developer's machine. One requirement is non-negotiable: client code must never be sent to an outside service, and when the service cannot tell whether code is a client's, it must assume it is. That sentence is the thread to follow through every stage below. From that description, v2 builds a plan of the stages the project needs. Its product agent, which plays the product manager, then interviews the person who started the run and drafts a scope, which they confirm before work begins.
Every stage runs the same way, which shows who does what. People supply the goal and the requirements and set the rules in plain-language steering files. Agents build them into every stage and carry them forward, running the inner loop at machine speed: they draft, check and review. A person approves each stage's output at the gate.

The AI-DLC v2 outer loop blueprint, showing the three phases that carry the outer-loop work. Steering files apply at every stage; context flows forward from Inception through Operation, and a person approves each stage's output at a gate.
AI-DLC v2 has five phases, each made of stages. Three map to the three kinds of outer-loop work: requirements, security review and runbooks. Inception turns legal context into requirements, Construction builds and reviews the code and Operation writes the runbooks. Each phase inherits everything the one before it produced.

Inside any stage. The inner loop generates, checks and reviews at machine speed, looping back on failure. A pass reaches the outer loop's human gate, where each lesson the person keeps becomes a rule the next run checks.
Inception: From Legal Context to Structured Requirements
Inception's key mechanism is compliance steering files: plain-language documents, versioned alongside the code, that state legal and regulatory constraints in a form agents can read: data residency, privilege handling (for example, protecting attorney-client communications) and client isolation, written as testable rules rather than narrative. A practical start is to have an agent draft them from documents the firm already has, such as its data handling policy, protective orders and client guidelines, with legal and compliance approving the result.
The product agent reads the confirmed scope alongside the steering files, so its requirements are compliance-aware from the start. In the example, its interview asked what the service must record for each review and each human decision, and the answer became a requirement: every decision is recorded. The client-code rule shows what makes a rule checkable. "Never send client code outside the firm" cannot be tested when nobody knows who owns a file, so the rule carries its own answer: when ownership is unclear, treat the code as a client's code. The architecture reviewer checks that fallback at every later stage.
Construction: Review That Happens Before a Person Looks
After each stage completes, two review agents run in parallel. They can read the stage's output and the steering files, but they cannot change anything. Their job is adversarial: find what is wrong before the work reaches a person.
The product reviewer checks the work against the pass/fail criteria Inception wrote; the architecture reviewer checks it against the design decisions and requirements. Both must return READY, their pass verdict, before the work reaches the person at the gate, and the agent that built the work never approves it. People still make the judgment calls, such as new kinds of protected material and any change to how the service decides whether code belongs to a client.
When we ran the example through AI-DLC v2, this caught a real defect. The client-code rule had become a safety check, and a generating agent built an alarm to page the team if that check ever broke. On its own, the alarm looked right. But it was listening for a message another component never promised to send. The architecture reviewer checked what that component promises to send, and that message was not included. The alarm would never go off: a smoke detector wired to a sensor nobody installed. The reviewer blocked the gate, and the fix moved the alarm to a message its own component controlled. Each piece looked correct alone, which makes this easy to miss.
The learning step showed up in the same run. A risk a person had already accepted and documented kept resurfacing in later checks, so at a gate someone added a rule: a risk accepted that way passes with a note, while an undocumented gap still blocks.
Operation: Runbooks That Know What Happened
A standard runbook answers a technical question: how do I restore the service? In legal technology, that is not enough. A failure raises legal questions that a generic runbook cannot answer: which client matters were affected, whether protected data was exposed, what must be preserved, who has to be notified. The Operations agent reads everything Inception and Construction produced before writing a line, so its runbooks map to specific compliance requirements.
In our run, the recording requirement from Inception carried through. One Construction decision made the audit trail tamper-evident: each record is chained to the one before it by a hash, so any edit to a past record is detectable. That design produced an alarm: chain break detected. The runbook the Operations agent wrote for that alarm treated a chain break as a compliance incident, not an outage: preserve the audit records, do not modify them, notify legal counsel and escalate to security and compliance. No instruction in the Operation phase asked the agent to be compliance-aware; the design decision carried forward through accumulated context. A person then approved the runbook at the gate.
The client-code alarm from Construction got its own runbook. If it fires, the service has failed to tell whether code belongs to a client: a safety failure, not a false alarm. New reviews stop immediately, and work already in flight is confirmed to have fallen back to the path that sends nothing outside the firm. Capacity returns only after the cause is found and a new test guards against it.
Scaling Across Teams: The Distribution Problem
The value is consistency across every team and repository, because in a regulated environment inconsistency is a compliance exposure, not just a quality issue. Setting the rules is the part of the human role that has to scale.
Keep the compliance baseline in one shared, versioned place that every repository loads, owned by legal and compliance and updated centrally when policy changes. The client-code rule from our example belongs there, so every team's run checks it.
AGENTS.md is a convention several AI tools honor: a file at a repository root that an assistant loads as context, like a README for the AI. It scopes compliance context to that codebase, so a privilege review repository can carry its own rules without imposing them on a client portal. A repository's rules add to the baseline; they do not replace it.
Steering sets what the agents are told; the reviewers and gates check the result.
Conclusion: Better Models Still Need a Workflow
Each model release makes the inner loop faster and more accurate. A better model writes a better draft, but it cannot make a review step happen, or record that it did. Only the workflow does that. In our example, the client-code rule traveled that way, from one sentence at kickoff to a runbook that stops the service.
Three takeaways for teams building regulated software:
- The gap is not AI capability. It is that outer loop AI is usually optional and unchecked. Make it a required, verified step.
- People supply the goal, the requirements and the rules, approve each stage and choose which lessons to keep, so each run starts better than the last. Agents build all of it into every stage.
- Write the rules once and distribute them. Steering files drafted from existing policy, kept in one shared baseline that each repository can add to, give every team the same starting point.
Pick one piece of outer-loop work your team does by hand today, whether that is turning a request into requirements, making a security call on code or writing runbooks. Run it through AI-DLC v2 and see what changes when the step is required, checked and recorded. The methodology is open source on GitHub: https://github.com/awslabs/aidlc-workflows
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article