DEV Community

João André Gomes Marques
João André Gomes Marques

Posted on

How to add tamper-evident audit trails to CrewAI agents

CrewAI is great for multi-agent workflows but has no built-in audit trail. If you need to prove what your agents did - for compliance, debugging, or just accountability - here is how to add it.

Setup

pip install asqav[crewai]
Enter fullscreen mode Exit fullscreen mode

Integration

from crewai import Agent, Task, Crew
from asqav.extras.crewai import AsqavCrewHook

hook = AsqavCrewHook(api_key=\"sk_...\")

researcher = Agent(
    role=\"Researcher\",
    goal=\"Find competitor pricing\",
    backstory=\"Senior market analyst\",
    verbose=True
)

task = Task(
    description=\"Research competitor pricing for Q2\",
    agent=researcher,
    callbacks=[hook.task_callback]
)

crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
Enter fullscreen mode Exit fullscreen mode

Every task execution now gets an ML-DSA-65 signature. The audit trail is hash-chained so you cannot omit entries without breaking the chain.

What you get

After the crew runs, each task has a signed record containing:

  • Which agent ran it
  • What the task description was
  • Input/output hashes
  • Timestamp
  • Cryptographic signature linking to the previous action

Export

import asqav
audit = asqav.export_audit(\"json\")
Enter fullscreen mode Exit fullscreen mode

The JSON export is what you hand to auditors. Each entry is independently verifiable.

Why bother

EU AI Act Article 12 requires tamper-evident logging for high-risk AI systems by August 2026. Even without regulations, knowing exactly what a multi-agent crew did across 10 tasks is useful when something goes wrong.

GitHub: https://github.com/jagmarques/asqav-sdk
CrewAI example: https://github.com/jagmarques/asqav-crewai-example

Top comments (0)