Feature Area
Agent capabilities
Is your feature request related to a an existing bug? Please link it here.
N/A
Describe the solution you'd like
Problem
CrewAI agents execute tools autonomously during crew runs. In production deployments, teams need governance controls:
- Which tools each agent is authorized to use (beyond just assigning tools)
- Cost tracking per agent across a crew run
- Audit trail for compliance (who called what, when, why)
- Ability to block specific tool calls based on runtime context (e.g., data sensitivity, time of day, budget remaining)
Currently, the only way to enforce this is by wrapping each tool's _run method individually, which doesn't compose well across crews.
Proposal
Add an optional governance hook that runs before each tool execution:
from crewai import Crew
def on_tool_call(agent, tool_name, tool_input, context):
"""Called before every tool execution. Raise to block."""
if tool_name == "customer_export" and agent.role != "Admin":
raise ToolBlockedError("customer_export requires Admin role")
return True # allow
crew = Crew(
agents=[researcher, writer],
on_tool_call=on_tool_call # optional hook
)
This keeps governance decoupled from tool implementation — add/remove governance by changing the crew config, not every tool.
Working Example
I've built a working CrewAI + governance integration that demonstrates this pattern:
https://github.com/agentguard-ai/tealtiger/tree/main/examples/crewai-governance
It shows:
Policy-based tool authorization (allow/deny per tool per agent)
Per-agent cost tracking with CostTracker
A blocked customer_export tool call with clear error message
Works offline with deterministic demo mode (no API keys needed)
Uses TealTiger (open-source, Apache 2.0) for the governance engine, but the hook pattern would work with any policy engine.
Why this matters
OWASP's Agentic Top 10 identifies tool misuse (ASI-02) and access control failures (ASI-03) as top risks. A standard governance hook would let the CrewAI community build reusable authorization patterns without modifying individual tools.
Happy to submit a PR if a governance hook pattern is welcome.
### Describe alternatives you've considered
1. Wrapping each tool's _run method with governance logic — works but requires modifying every tool individually and doesn't compose across crews.
2. Subclassing Agent to override tool execution — tightly couples governance to a specific agent, breaks when switching agent types.
3. Post-hoc log analysis — only detects violations after they happen, doesn't prevent unauthorized actions.
A crew-level hook is preferred because it's non-invasive, composable, and works across all agents/tools without modification.
### Additional context
Working example with full source code: https://github.com/agentguard-ai/tealtiger/tree/main/examples/crewai-governance
This demonstrates:
- PolicyBuilder with allow/deny rules per tool
- governed_tool_call() wrapper pattern
- Per-agent cost tracking
- Blocked customer_export tool with clear error
OWASP Agentic Top 10 identifies tool misuse (ASI-02) and access control failures (ASI-03) as top risks for agentic applications.
Happy to submit a PR implementing this if the pattern is welcome.
### Willingness to Contribute
Yes, I'd be happy to submit a pull request
Feature Area
Agent capabilities
Is your feature request related to a an existing bug? Please link it here.
N/A
Describe the solution you'd like
Problem
CrewAI agents execute tools autonomously during crew runs. In production deployments, teams need governance controls:
Currently, the only way to enforce this is by wrapping each tool's
_runmethod individually, which doesn't compose well across crews.Proposal
Add an optional governance hook that runs before each tool execution: