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.