Skip to main content

air-crewai-trust

CI License Python 3.10+

EU AI Act compliance infrastructure for CrewAI agents. Drop-in trust layer that adds tamper-evident audit logging, PII tokenization, consent-based tool gating, and prompt injection detection - making your CrewAI agent stack compliant with Articles 9, 10, 11, 12, 14, and 15 of the EU AI Act.

Part of the AIR Blackbox ecosystem - the compliance layer for autonomous AI agents.

EU AI Act high-risk obligations take effect December 2, 2027 (deferred from August 2026 by the EU's 2026 omnibus agreement). Regulators expect preparation to be underway now. See the full compliance mapping for article-by-article coverage.

View Interactive Demo: Walk through every feature with animated examples.

Quick Start

pip install air-crewai-trust
from crewai import Agent, Task, Crew
from air_crewai_trust import activate_trust

# One line activates all trust hooks
plugin = activate_trust()

# Your CrewAI code runs as normal - trust layer works transparently
agent = Agent(role="Researcher", goal="Find information", backstory="...")
task = Task(description="Research AI safety", agent=agent)
crew = Crew(agents=[agent], tasks=[task])
crew.kickoff()

# Check what happened
print(plugin.get_audit_stats())
print(plugin.verify_chain())

What It Does

Tamper-Proof Audit Trail

Every tool call and LLM interaction is logged to an HMAC-SHA256 signed chain. Each entry references the previous entry's hash - modify any record and the chain breaks. Like a blockchain, but for your AI agent's actions.

Sensitive Data Tokenization

API keys, credentials, PII (emails, SSNs, phone numbers, credit cards) are automatically detected and replaced with opaque tokens before they reach the LLM. Original values are stored locally in the vault and can be restored when the tool actually needs them.

14 built-in patterns covering:

  • API keys (OpenAI, Anthropic, AWS, GitHub, Stripe)
  • Credentials (Bearer tokens, private keys, connection strings, passwords)
  • PII (emails, phone numbers, SSNs, credit cards)

Consent Gate

Destructive tools (exec, shell, deploy, file_delete) are blocked until the user explicitly approves them. Risk classification:

Risk Level Tools Action
Critical exec, spawn, shell Always requires consent
High fs_write, deploy, git_push Requires consent (default threshold)
Medium send_email, http_request Configurable
Low fs_read, search, query Auto-approved

Prompt Injection Detection

15+ weighted patterns detect prompt injection attempts including role overrides, jailbreaks, delimiter injection, privilege escalation, and data exfiltration. Configurable sensitivity (low/medium/high) and block threshold.

Configuration

from air_crewai_trust import activate_trust, AirTrustConfig

config = AirTrustConfig(
    consent_gate={
        "enabled": True,
        "always_require": ["exec", "spawn", "shell", "deploy"],
        "risk_threshold": "high",
    },
    vault={
        "enabled": True,
        "categories": ["api_key", "credential", "pii"],
    },
    injection_detection={
        "enabled": True,
        "sensitivity": "medium",
        "block_threshold": 0.8,
    },
    audit_ledger={
        "enabled": True,
        "max_entries": 10000,
    },
    # Optional: forward audit records to AIR Blackbox gateway
    gateway_url="https://your-gateway.example.com",
    gateway_key="your-api-key",
)

plugin = activate_trust(config)

CrewAI Hook Mapping

CrewAI Hook Trust Components
before_tool_call ConsentGate → DataVault → AuditLedger
after_tool_call AuditLedger
before_llm_call InjectionDetector → DataVault → AuditLedger
after_llm_call AuditLedger

API Reference

from air_crewai_trust import activate_trust, deactivate_trust, get_plugin

# Activate / deactivate
plugin = activate_trust(config=None)  # Returns AirTrustPlugin
deactivate_trust()                     # Unregisters all hooks

# Plugin methods
plugin.get_audit_stats()   # → {"total_entries": 42, "chain_valid": True, ...}
plugin.verify_chain()      # → {"valid": True, "total_entries": 42}
plugin.export_audit()      # → [{"id": "...", "action": "tool_call", ...}, ...]
plugin.get_vault_stats()   # → {"total_tokens": 5, "by_category": {"api_key": 3, "pii": 2}}

EU AI Act Compliance

EU AI Act Article Requirement AIR Feature
Art. 9 Risk management ConsentGate risk classification
Art. 10 Data governance DataVault PII tokenization
Art. 11 Technical documentation Full call graph audit logging
Art. 12 Record-keeping HMAC-SHA256 tamper-evident chain
Art. 14 Human oversight Consent-based tool blocking
Art. 15 Robustness & security InjectionDetector + multi-layer defense

See docs/eu-ai-act-compliance.md for the full article-by-article mapping.

AIR Blackbox Ecosystem

Package Framework Install
air-langchain-trust LangChain / LangGraph pip install air-langchain-trust
air-crewai-trust CrewAI pip install air-crewai-trust
openclaw-air-trust TypeScript / Node.js npm install openclaw-air-trust
Gateway Any HTTP agent docker pull ghcr.io/airblackbox/gateway:main

Development

git clone https://github.com/airblackbox/trust-crewai.git
cd trust-crewai
pip install -e ".[dev]"
pytest tests/ -v

License

Apache-2.0

Metadata

Release files for air-crewai-trust 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for air-crewai-trust 0.1.1
File Size Uploaded Provenance
air_crewai_trust-0.1.1.tar.gz 28.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for air-crewai-trust 0.1.1
File Interpreter ABI Platform
air_crewai_trust-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / air_crewai_trust-0.1.1.tar.gz

Download URL air_crewai_trust-0.1.1.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fc23e79e7f76e3f8304432727d72032a7e6a6869dcab93d7d1d0ecde17607b2c
BLAKE2b-256 checksum
How to use checksums
7e06fce3abfffbeeb31f02395e471e54b43f21ab988b2af1e0a311f7a8d17d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / air_crewai_trust-0.1.1-py3-none-any.whl

Download URL air_crewai_trust-0.1.1-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
492af898e98799d9c9ac8b2c729e7855e869c5ec6fa9bcdfa7e633ee91019ea9
BLAKE2b-256 checksum
How to use checksums
0dd4e045410a366bd0b957ed0d193b429b8fd884388b1787c5f111dab01217ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for air-crewai-trust 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page