How to Add Compliance Monitoring to CrewAI Agents (EU AI Act & HIPAA)
CrewAI provides excellent primitives for multi-agent coordination — agents, tasks, crews, and flows. What it does not provide is a compliance layer: no tamper-evident records, no cryptographic signing, no context snapshots for post-hoc reconstruction, and no compliance PDF export for auditors. This guide shows how to add compliance monitoring to CrewAI agents using the Tenet AI SDK, with working Python code for both single-agent and multi-agent crew patterns.
The Compliance Gap in CrewAI
CrewAI handles orchestration, role assignment, tool use, and task delegation. It does not capture tamper-evident audit records, does not apply cryptographic signing to agent outputs, does not store context snapshots in a replayable format, and does not generate compliance reports for EU AI Act, HIPAA, or SOC 2 auditors. Adding compliance monitoring requires instrumenting the task execution layer — which is precisely where Tenet AI integrates.
Three Integration Patterns
Three patterns for adding compliance to CrewAI: (1) Wrap the task execution function — recommended for most use cases, one Tenet record per agent task, captures intent/context/decision/outcome at the task level. (2) Crew-level wrapper — wrap the entire crew.kickoff() call, appropriate when the crew has a single primary output and individual agent steps are implementation details. (3) Tool-level capture with tenet.trace() — wrap individual tool executions for high-stakes tool use (e.g., credit bureau API calls, patient record lookups) that need individual compliance records.
Single Agent Implementation
Install pip install crewai tenet-ai-sdk. Initialize TenetClient once at startup. In your task execution function, wrap the CrewAI Crew.kickoff() call with tenet.intent(). Call intent.snapshot_context() to capture the application context, create and run the CrewAI task, parse the output, then call intent.decide() with the options and chosen action, and intent.execute() to close the record. The record_id returned by intent.execute() is your tamper-evident reference for auditors.
Multi-Agent Crew: Correlated Records
For multi-agent crews, use a shared session_id across all agent decisions in a single crew run. Each agent uses tenet.intent() with a distinct agent_id but the same session_id. Tenet automatically correlates decisions by session_id in the compliance report — auditors can trace the full decision chain across agents. Example: a claims adjudication crew with document analyst, fraud detector, and final adjudicator agents, each producing a linked record in the same audit session.
Human Oversight (EU AI Act Art. 14)
EU AI Act Article 14 requires high-risk AI systems to enable human oversight and capture when humans override AI decisions. In CrewAI workflows, implement a human review step that calls tenet.record_override() when a reviewer modifies a crew output. This creates a linked override record in the audit trail with actor ID, timestamp, original decision, override decision, and reason — satisfying Article 14 documentation requirements.