DEV Community

Cover image for How to Add Governance to Your CrewAI Agents
João André Gomes Marques
João André Gomes Marques

Posted on Edited on Originally published at dev.to

How to Add Governance to Your CrewAI Agents

CrewAI makes it easy to build multi-agent teams. But when those agents run in production, you need to know what they did and control what they can do.

The Problem

A CrewAI crew with 5 agents can make dozens of tool calls per run. Without governance:

  • No record of which agent did what
  • Any agent can call any tool
  • No way to prove compliance to auditors

Adding Asqav

pip install asqav
Enter fullscreen mode Exit fullscreen mode
import asqav

asqav.init(api_key="sk_...")

# Create identities for each agent in your crew
researcher = asqav.Agent.create("researcher")
writer = asqav.Agent.create("writer")
reviewer = asqav.Agent.create("reviewer")
Enter fullscreen mode Exit fullscreen mode

Signing crew actions

@asqav.secure
def search_web(query: str):
    return search_tool.run(query)

@asqav.secure
def write_report(data: dict):
    return writer_tool.run(data)
Enter fullscreen mode Exit fullscreen mode

Every tool call now gets a quantum-safe signature.

Policies for crews

# Only the researcher can search the web
asqav.create_policy(
    name="researcher-only-search",
    action_pattern="tool:search_web",
    action="block_and_alert",
    severity="medium"
)
Enter fullscreen mode Exit fullscreen mode

Links

Top comments (0)