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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crewai_governance-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crewai_governance-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for crewai_governance-0.1.0.tar.gz
Algorithm Hash digest
SHA256 442b7e6f03cd7d410b3e456eaa2f1b80741b9e7f622befca3d84bdf419e3991d
MD5 f947969a9c21a782e60bf43bd4c1f7a7
BLAKE2b-256 14263d6f10e4d943f31c598c1902044057eef42114bc29fbf861c721e89dd029

See more details on using hashes here.

Provenance

The following attestation bundles were made for crewai_governance-0.1.0.tar.gz:

Publisher: publish.yml on asalsali/crewai-governance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crewai_governance-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for crewai_governance-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e246319134d669035623e27e0cc82fb9a28cc6ea04d9f3ac4c8851de720c6999
MD5 226846d1eb4366912711068eb986d9cd
BLAKE2b-256 490ebc3b36d6c819ae4a2a336c79ca2e983e4a49d315a1aa6f58e1caae6c743f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crewai_governance-0.1.0-py3-none-any.whl:

Publisher: publish.yml on asalsali/crewai-governance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page