DEV Community

Jason Shotwell
Jason Shotwell

Posted on

Scanning Your AI Agents for EU AI Act + GDPR Compliance in 10 Seconds

90% of companies use AI daily. 18% have governance frameworks. The EU AI Act deadline for high-risk systems is August 2, 2026. Penalties: up to 35M EUR or 7% of global turnover.

If you ship Python AI agents, your codebase needs to prove compliance with specific technical requirements. I built an open-source tool that checks.

The Problem

The EU AI Act is not vague. It maps to concrete technical requirements across 6 articles. Your AI system needs error handling and fallback logic (Article 9). It needs PII detection and data governance (Article 10). It needs documentation, audit trails, human oversight mechanisms, and injection defense (Articles 11-15).

Most teams know the deadline exists. Very few know what it means for their actual code.

And if you handle EU personal data, GDPR still applies on top of the AI Act. Consent management, right to erasure, data minimization, cross-border transfer controls. These are not optional.

The Tool

pip install air-blackbox
air-blackbox comply --scan .
Enter fullscreen mode Exit fullscreen mode

That is the entire setup. No cloud account. No API keys. No data leaves your machine.

AIR Blackbox reads your Python source files, walks the AST and regex patterns, and reports pass/warn/fail on each requirement. It checks real code patterns, not just config files.

What It Checks

EU AI Act (6 articles):

Article 9 (Risk Management): Does your code have try/except around LLM calls? Fallback logic? Retry patterns?

Article 10 (Data Governance): Is there PII detection before sending data to LLMs? Input validation with Pydantic or dataclasses?

Article 11 (Technical Documentation): Docstring coverage on public functions? Type hints? A README and model card?

Article 12 (Record-Keeping): Logging framework imported? Tracing integration (OpenTelemetry, LangSmith)? Action-level audit trails?

Article 14 (Human Oversight): Approval gates for high-risk actions? Budget controls? Kill switches? Token scope validation?

Article 15 (Robustness): Prompt injection defense? Output validation? Retry with backoff?

GDPR (8 checks, new in v1.5):

Consent management (Art. 6/7), data minimization (Art. 5), right to erasure (Art. 17), data retention policies (Art. 5), cross-border transfer safeguards (Art. 44-49), DPIA references (Art. 35), processing records (Art. 30), and breach notification patterns (Art. 33/34).

Prompt Injection Detection (New)

v1.5 ships a standalone injection detector you can drop into any agent. 20 patterns across 5 categories (role override, delimiter injection, privilege escalation, data exfiltration, jailbreak), each with weighted scoring:

from air_blackbox.injection import InjectionDetector

detector = InjectionDetector(
    sensitivity="medium",  # low/medium/high
    block_threshold=0.7    # 0-1 score to trigger blocking
)

result = detector.scan(user_input)
if result.blocked:
    print(f"Blocked: score={result.score}")
    print(f"Patterns: {result.patterns}")
    print(f"Categories: {result.categories}")
Enter fullscreen mode Exit fullscreen mode

It also handles OpenAI-format message arrays:

result = detector.scan_messages([
    {"role": "user", "content": "Ignore previous instructions..."}
])
Enter fullscreen mode Exit fullscreen mode

Trust Layers for 7 Frameworks

The scanner tells you what is missing. The trust layers fix it. One import adds HMAC-SHA256 tamper-evident audit chains to your agent:

from air_blackbox import AirTrust

trust = AirTrust()
trust.attach(your_agent)  # Auto-detects: LangChain, CrewAI, AutoGen,
                           # OpenAI SDK, Haystack, Google ADK,
                           # Anthropic Agent SDK
Enter fullscreen mode Exit fullscreen mode

Each trust layer hooks into the framework's callback/middleware system and logs every LLM call, tool execution, and data flow to a tamper-evident chain. Each record's hash depends on the previous record's hash. Modify any record and every subsequent hash breaks.

Install the framework you need:

pip install air-blackbox[langchain]
pip install air-blackbox[crewai]
pip install air-blackbox[openai]
pip install air-blackbox[all]  # everything
Enter fullscreen mode Exit fullscreen mode

Why Local-First Matters

Every enterprise competitor in this space (Credo AI, Holistic AI, Vanta, OneTrust) requires sending your code to their cloud. For defense, healthcare, finance, and legal, that is a non-starter. Code is classified. Patient data is protected. Attorney-client privilege extends to AI systems.

AIR Blackbox runs 100% on your machine. Zero telemetry. Not "opt-out" telemetry. Not there at all.

What Is Next

I am fine-tuning a 1B parameter Llama model on 2,000+ compliance training examples. The goal: catch subtle violations that regex cannot (like logging that exists but is not tamper-evident, or human oversight that can be programmatically bypassed). The model runs locally via ollama. Your code still never leaves your machine.

Try It

pip install air-blackbox
air-blackbox comply --scan .
Enter fullscreen mode Exit fullscreen mode

GitHub: github.com/airblackbox/gateway
Demo: airblackbox.ai/demo
PyPI: pypi.org/project/air-blackbox

Apache 2.0. Stars and PRs welcome.

This does not make you legally compliant. It is a linter for AI governance, not a lawyer. But it gets your codebase audit-ready for the technical requirements before the deadline hits.

Top comments (0)