Back to Blog
Integrations

CrewAI Safety Guardrails

Per-agent permission contracts for multi-agent CrewAI deployments

Without per-agent permission contracts, every agent in a CrewAI crew can invoke every tool available to the crew. Here's how to fix that.

July 1, 202611 min read
CrewAIMulti-AgentPermission ScopingAudit TrailPython
AgentTrust OS

CrewAI Safety Guardrails

Per-agent permission contracts and audit trails for multi-agent CrewAI deployments

TL;DR
  • CrewAI makes it easy to coordinate multiple specialized agents in a shared task. It does not provide per-agent permission scoping or cross-agent audit trails.
  • In multi-agent crews, each agent should have its own permission contract — a researcher agent should not be able to execute actions only a writer or a manager should perform.
  • AgentTrust OS adds per-agent governance to CrewAI deployments: separate policies per agent role, runtime enforcement at the tool level, and unified audit trails across the entire crew.
  • A misconfigured crew member can execute actions with the permissions of the most-privileged agent in the crew if tool access is not scoped per-agent.
  • Integration adds under 20 lines of configuration to an existing crew definition.
Read the full guide →

CrewAI's role-based design is one of its most powerful features. Assigning specialized roles to individual agents — researcher, analyst, writer, reviewer — produces better outputs than a single general-purpose agent and makes complex tasks decomposable into manageable pieces.

That same role-based design creates a governance challenge: without per-agent permission enforcement, every agent in the crew implicitly has access to every tool available to the crew. A researcher agent that gets confused about its task, or a writer agent operating on malicious input, can invoke tools it was never supposed to reach.

This post shows how to add per-agent permission contracts and unified audit trails to an existing CrewAI deployment using AgentTrust OS.

THE MULTI-AGENT PERMISSION PROBLEM

Why crew-level tool access is a governance risk

01

Privilege escalation through task delegation

When a manager agent delegates a task to a researcher, the researcher executes with its own tool set. If the researcher's tool set is not properly scoped, it may reach systems the manager itself is authorized to access but the researcher should not be. Privilege does not automatically scope downward through delegation chains.

02

Cross-agent context contamination

Agents share task context in a crew. A malicious or hallucinated output from one agent can influence the next agent's tool calls — in ways that neither the framework nor the developer anticipated. Without per-agent policy enforcement, there is no boundary to stop a contaminated context from triggering an authorized-looking but unintended action.

03

Audit attribution in multi-agent execution

When something goes wrong in a crew run, determining which agent made which decision — and under what context — is difficult without structured per-agent tracing. A single audit log that records tool calls without agent attribution cannot answer "which role authorized this action?" — which is the first question any compliance review will ask.

IMPLEMENTATION

Per-agent governance for CrewAI

01
Define a policy per agent role
Python — per-agent policies
from agenttrust import define_policy

researcher_policy = define_policy(
    name="researcher",
    tools={
        "web_search":    {"trust_level": "standard",  "threshold": 0.75},
        "read_database": {"trust_level": "standard",  "threshold": 0.80},
        # researcher cannot write, send, or delete
    },
    defaults={"threshold": 0.80, "blocked_if_unlisted": True},
)

writer_policy = define_policy(
    name="writer",
    tools={
        "read_file":  {"trust_level": "standard",   "threshold": 0.75},
        "write_file": {"trust_level": "sensitive",  "threshold": 0.90},
        # writer cannot access database or external APIs
    },
    defaults={"threshold": 0.85, "blocked_if_unlisted": True},
)

manager_policy = define_policy(
    name="manager",
    tools={
        "send_email":      {"trust_level": "high-risk", "threshold": 0.95,
                            "require_approval": True},
        "publish_content": {"trust_level": "sensitive", "threshold": 0.90},
    },
    defaults={"threshold": 0.90, "blocked_if_unlisted": True},
)
02
Attach governed tool sets to each agent
Python — CrewAI agent with governance
from crewai import Agent, Crew, Task
from agenttrust import AgentTrustRuntime

# Wrap tools with per-agent policy before passing to CrewAI
researcher_runtime = AgentTrustRuntime(policy=researcher_policy)
writer_runtime     = AgentTrustRuntime(policy=writer_policy)
manager_runtime    = AgentTrustRuntime(policy=manager_policy)

researcher = Agent(
    role="Research Specialist",
    goal="Find accurate information from approved sources",
    tools=researcher_runtime.wrap_tools([web_search, read_database]),
    backstory="...",
)

writer = Agent(
    role="Content Writer",
    goal="Transform research into structured documents",
    tools=writer_runtime.wrap_tools([read_file, write_file]),
    backstory="...",
)

manager = Agent(
    role="Publishing Manager",
    goal="Review and distribute finalized content",
    tools=manager_runtime.wrap_tools([send_email, publish_content]),
    backstory="...",
)

crew = Crew(
    agents=[researcher, writer, manager],
    tasks=[research_task, writing_task, publishing_task],
    verbose=True,
)
03
Query unified audit trails per agent
Python — per-agent audit query
from agenttrust import TrustAudit

audit = TrustAudit()

# All tool calls attributed to the researcher in this run
researcher_records = audit.query(
    agent_role="researcher",
    run_id=crew_run_id,
)

# All blocked actions across the entire crew
blocked_actions = audit.query(
    run_id=crew_run_id,
    route="blocked",
)

# Export for compliance review
audit.export_json(run_id=crew_run_id, path="./audit-export.json")
FREQUENTLY ASKED QUESTIONS

Your questions, answered directly

Trust Runtime blocks the call and raises a GovernanceBlockedError at the tool invocation site. The block is recorded in Trust Audit with the agent role, the attempted tool, the reason (unlisted tool), and the full request context. CrewAI surfaces this as a tool error, which your task error handling can catch.
Yes — governance is enforced at the tool execution level, not at the task delegation level. When a manager delegates to a subordinate agent, the subordinate's tool calls are evaluated against the subordinate's policy, not the manager's. Delegation does not escalate permissions.
Yes — policies are reusable objects. Define role policies once in a shared module and import them wherever the same role appears. This ensures consistent permission contracts across crews rather than per-crew configuration drift.
Each `AgentTrustRuntime` instance is initialized with an agent identifier (inferred from the policy name or set explicitly). Every tool call record includes this identifier — so audit queries can filter by agent role, trace the action chain through a multi-agent workflow, and answer attribution questions precisely.
GOVERN YOUR CREWAI DEPLOYMENTS

Per-agent permissions, unified audit trails

Add Trust Runtime to your CrewAI crews. Each agent gets its own policy — no agent exceeds its scope.

View CrewAI Integration →

More from the blog

AI ComplianceJuly 22, 2026AI ComplianceJuly 22, 2026AI GovernanceJuly 22, 2026AI GovernanceJuly 22, 2026AI ArchitectureJuly 22, 2026AI SecurityJuly 16, 2026MLOpsJuly 10, 2026AI ImplementationJuly 8, 2026AI Agent ArchitectureJuly 5, 2026AI Agent ArchitectureJune 30, 2026EngineeringJune 23, 2026AI Agent ArchitectureJuly 2, 2026AI Agent ArchitectureJuly 1, 2026IntegrationsJuly 1, 2026IntegrationsJuly 2, 2026AI SecurityJuly 3, 2026AI SecurityJuly 1, 2026AI ComplianceJuly 2, 2026AI ComplianceJuly 3, 2026AI StrategyJuly 2, 2026AI StrategyJuly 3, 2026AI StrategyJuly 3, 2026AI StrategyJuly 3, 2026AI GovernanceJuly 28, 2026Healthcare AIJuly 28, 2026ArchitectureJuly 29, 2026ArchitectureJuly 29, 2026AI StrategyJuly 29, 2026AI StrategyJuly 30, 2026AI SecurityJuly 30, 2026AI ComplianceJuly 30, 2026EngineeringJuly 30, 2026AI GovernanceAugust 4, 2026EngineeringAugust 4, 2026EngineeringAugust 4, 2026