Chapter 22: Regulated Industries, Compliance & IP
Compliance Is Architecture, Not a Checkbox
In HIPAA, SOC 2, PCI, ISO 27001, FERPA, and HL7/FHIR environments, you cannot deploy an agent you cannot defend after the fact. The good news is that the governance discipline from Chapter 21 maps almost directly onto regulatory requirements - if you build it in from day one rather than retrofitting it under audit pressure. Regulated industries are not a reason to avoid agentic AI; they are a reason to do it with discipline.
Audit Trails as a First-Class Output
Every meaningful agent action is logged with full context: what task ran, which tools were called, what data was accessed, what decision was made, and why. That trail is what satisfies SOC 2, HIPAA, and PCI for AI-assisted workflows - and it is the artifact the incident review and the auditor both open first. Build the audit log as a primary output of the system, not a debug afterthought.
Data Residency, PHI, and the Data Boundary
The first question in a regulated workflow is where the data goes. Options, in order of control: a vendor API with a signed data processing agreement, a no-training guarantee, and zero-data-retention enabled; a model hosted in your own cloud tenant; or a self-hosted open-weight model that keeps regulated data entirely behind your security boundary (Chapter 9). For PHI, PCI, and similar data, the self-hosted boundary is often the difference between a workable design and a non-starter.
Human-in-the-Loop for High-Stakes Decisions
Clinical, financial, and customer-facing decisions require an approval gate, full stop. AI augments quality; it does not own it. A virtual-triage or symptom-analysis agent in telehealth proposes; a clinician decides. A payments agent flags; a human authorizes. The escalation triggers and approval gates from the intent spec are how you encode this so it is enforced, not assumed.
IP and Ownership of AI-Generated Code
Who owns the code an agent writes, and what is its provenance? Set policy before it bites you: understand each vendor's training-data and indemnification terms, watch for copyleft-licensed code surfacing in suggestions, and define clearly what may be pasted into which tool. In a regulated or acquisition-bound company, unclear IP provenance on a core platform is a diligence problem waiting to happen.
Governance That Satisfies the Auditor
Map your agent controls directly to the framework: audit trails to evidence requirements, approval gates to segregation-of-duties, reversibility to change management, and agent SLOs to operational controls. Done well, the same governance layer that makes agents trustworthy also makes them defensible - and turns compliance from a blocker into a competitive advantage in regulated markets.
What to Ask an AI Tool Vendor For
Before an AI coding tool touches regulated code or data, get these in writing:
- A signed business associate agreement (BAA) if the tool will touch protected health information. HHS treats a cloud provider that handles electronic PHI as a business associate, even when it stores only encrypted data and holds no key.
- The most recent SOC 2 Type 2 report: the auditor's opinion, the period it covers, any exceptions, and the controls you are expected to run yourself.
- The retention schedule for prompts, outputs and logs, plus a written zero-data-retention option and a way to confirm it is on for your account.
- A written statement of whether your inputs, outputs or telemetry train or improve any model, and how to opt out.
- The regions where data is stored and processed, and whether you can pin them.
- The current subprocessor list, how you will hear about changes, and confirmation that the same terms flow down to each subprocessor.
- Audit logs you can export on demand - who used the tool, what was sent, what it did - in a form your own retention rules can keep.
- Incident notification terms: how fast and to whom the vendor reports a breach, in writing. HIPAA allows up to 60 calendar days from discovery; the HHS model agreement uses 30, and shorter is better.
Asking is not the same as getting: record each answer in your vendor file, and have counsel read the contract.
Sources
- Guidance on HIPAA and cloud computing - U.S. Department of Health and Human Services
- Sample business associate agreement provisions - U.S. Department of Health and Human Services
- Illustrative SOC 2 report - AICPA