Skip to main content

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

Metadata

Release files for crewai-governance 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crewai-governance 0.1.0
File Size Uploaded Provenance
crewai_governance-0.1.0.tar.gz 9.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for crewai-governance 0.1.0
File Interpreter ABI Platform
crewai_governance-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / crewai_governance-0.1.0.tar.gz

Download URL crewai_governance-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
442b7e6f03cd7d410b3e456eaa2f1b80741b9e7f622befca3d84bdf419e3991d
BLAKE2b-256 checksum
How to use checksums
14263d6f10e4d943f31c598c1902044057eef42114bc29fbf861c721e89dd029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / crewai_governance-0.1.0-py3-none-any.whl

Download URL crewai_governance-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e246319134d669035623e27e0cc82fb9a28cc6ea04d9f3ac4c8851de720c6999
BLAKE2b-256 checksum
How to use checksums
490ebc3b36d6c819ae4a2a336c79ca2e983e4a49d315a1aa6f58e1caae6c743f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Security for crewai-governance 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for crewai_governance-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page