crewai-governance
Runtime governance middleware for CrewAI. Three features, one pip install, zero config.
What it does
| Feature | Problem it solves | How |
|---|---|---|
| Exit reports | Agents finish and their work disappears. Next run starts from scratch. | Auto-writes structured JSON after every crew run: what each agent did, what worked, token usage. |
| Overlap detection | Two crews doing the same work without knowing it. Wasted tokens, conflicting outputs. | Before kickoff, scans active crews for mandate overlap. Warns if detected. |
| Knowledge inheritance | New crew runs can't learn from past runs. Same mistakes, same dead ends. | Injects prior exit report summaries into crew context automatically. |
Install
pip install crewai-governance
Usage
from crewai import Agent, Task, Crew, Process
from crewai.project import CrewBase, before_kickoff, after_kickoff
from crewai_governance import governance_before_kickoff, governance_after_kickoff
@CrewBase
class ResearchCrew:
@before_kickoff
def before(self, inputs):
return governance_before_kickoff(
crew_name="research_crew",
mandate="research AI governance papers"
)(inputs)
@after_kickoff
def after(self, result):
return governance_after_kickoff("research_crew")(result)
# ... your agents, tasks, crew as normal
That's it. Two lines added to your existing crew class.
What happens
First run: Overlap detection finds nothing. No prior reports to inherit. Your crew runs normally. After completion, an exit report is written to .crewai-governance/exit_reports/.
Second run: Before kickoff, the middleware injects a summary of the first run's findings into the crew's context. Your agents now know what was already tried. After completion, another exit report is written.
Parallel runs: If two crews are running with overlapping mandates, overlap detection warns you before the second one starts.
Exit report structure
{
"reportId": "research_crew-1724012345678",
"crewName": "research_crew",
"completedAt": "2026-08-20T15:00:00Z",
"rawOutput": "Found 3 papers on multi-agent governance...",
"tasksOutput": [
{
"description": "Search for recent papers",
"raw": "Found papers by Smith (2026), Lee (2025)...",
"agent": "researcher"
},
{
"description": "Summarize findings",
"raw": "Key themes: coordination failures, trust...",
"agent": "writer"
}
],
"tokenUsage": {"total_tokens": 2500},
"mandateCompleted": true
}
Configuration
from crewai_governance import GovernanceConfig
config = GovernanceConfig(
storage_dir=".crewai-governance", # where data lives
max_inheritance_reports=5, # how many prior reports to inject
enable_overlap_detection=True, # turn overlap checking on/off
enable_inheritance=True, # turn inheritance on/off
)
# Pass config to hooks
governance_before_kickoff("my_crew", "my mandate", config)(inputs)
governance_after_kickoff("my_crew", config)(result)
Why this exists
Multi-agent coordination failures account for 37% of all multi-agent system failures (MAST Failure Taxonomy). The top failure modes -- infinite handoff loops, context loss, false consensus -- happen because agents have no memory of what came before and no awareness of what's running alongside them.
This package is the smallest possible intervention: give agents a record of past runs, warn when work overlaps, and let new runs learn from old ones.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crewai_governance-0.1.0.tar.gz.
File metadata
- Download URL: crewai_governance-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
442b7e6f03cd7d410b3e456eaa2f1b80741b9e7f622befca3d84bdf419e3991d
|
|
| MD5 |
f947969a9c21a782e60bf43bd4c1f7a7
|
|
| BLAKE2b-256 |
14263d6f10e4d943f31c598c1902044057eef42114bc29fbf861c721e89dd029
|
Provenance
The following attestation bundles were made for crewai_governance-0.1.0.tar.gz:
Publisher:
publish.yml on asalsali/crewai-governance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crewai_governance-0.1.0.tar.gz -
Subject digest:
442b7e6f03cd7d410b3e456eaa2f1b80741b9e7f622befca3d84bdf419e3991d - Sigstore transparency entry: 2533720584
- Sigstore integration time:
-
Permalink:
asalsali/crewai-governance@9deeeb6bd140eab734e0955d507713d101c58fc2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asalsali
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9deeeb6bd140eab734e0955d507713d101c58fc2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file crewai_governance-0.1.0-py3-none-any.whl.
File metadata
- Download URL: crewai_governance-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e246319134d669035623e27e0cc82fb9a28cc6ea04d9f3ac4c8851de720c6999
|
|
| MD5 |
226846d1eb4366912711068eb986d9cd
|
|
| BLAKE2b-256 |
490ebc3b36d6c819ae4a2a336c79ca2e983e4a49d315a1aa6f58e1caae6c743f
|
Provenance
The following attestation bundles were made for crewai_governance-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on asalsali/crewai-governance
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crewai_governance-0.1.0-py3-none-any.whl -
Subject digest:
e246319134d669035623e27e0cc82fb9a28cc6ea04d9f3ac4c8851de720c6999 - Sigstore transparency entry: 2533720972
- Sigstore integration time:
-
Permalink:
asalsali/crewai-governance@9deeeb6bd140eab734e0955d507713d101c58fc2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/asalsali
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9deeeb6bd140eab734e0955d507713d101c58fc2 -
Trigger Event:
push
-
Statement type: