Commit 7dab9c1
feat(crewai): add native GovernanceHooks using CrewAI execution hooks (microsoft#1588)
Replace fragile proxy-based monkey-patching with CrewAI's native
execution hooks (@before_tool_call, @after_tool_call, @before_llm_call,
@after_llm_call) introduced in CrewAI 0.80+.
Changes:
- Add GovernanceHooks class that registers four global governance hooks
for tool allowlist, blocked-pattern scanning, Cedar/OPA pre_execute
gates, and output content filtering
- Add CrewAIKernel.as_hooks() factory method as the recommended
integration path
- Deprecate CrewAIKernel.wrap() with DeprecationWarning pointing to
as_hooks()
- Export CrewAIGovernanceHooks from integrations package
- Add 43 new tests covering all four hook types, deprecation warnings,
Cedar evaluator integration, and backward compatibility
- All 12 existing CrewAI regression tests pass unchanged
Resolves microsoft#1576
Co-authored-by: Nishar <you@example.com>1 parent f4d7b68 commit 7dab9c1
3 files changed
Lines changed: 1153 additions & 28 deletions
File tree
- agent-governance-python/agent-os
- src/agent_os/integrations
- tests
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
0 commit comments