Metadata-Version: 2.5
Name: maigp-crewai
Version: 1.0.1
Summary: AIGP governance adapter for CrewAI multi-agent orchestration
Requires-Python: >=3.11
Requires-Dist: maigp-agent-core>=1.0.0
Description-Content-Type: text/markdown

# maigp-crewai

AIGP governance for CrewAI multi-agent orchestration.

Part of **MAIGP** — the Mediated AI Governance Protocol: a runtime consent / scope / evidence layer for AI systems. Every governed call is **CHECK**ed before it runs (policy, scope, jurisdiction, circuit-breaker) and **RECORD**ed + **TRACE**d as tamper-evident evidence after.

## What it governs

Governs CrewAI crews, tasks, and agents.

## Governance model

This adapter maps the framework's lifecycle onto the AIGP agent-governance loop provided by [`maigp-agent-core`](https://pypi.org/project/maigp-agent-core/):

| Framework event | AIGP action |
|---|---|
| run / invocation start | **CHECK** (`pre_invoke`) — allowed? under what authority? |
| each model reply | token accounting (`on_model_call`) |
| each tool / function call | tool governance (`on_tool_call`) |
| run complete | **RECORD** + **TRACE** (`post_invoke`) |
| failure | `on_error` (recorded, then re-raised) |


## Install

```bash
pip install maigp-crewai
```

Pulls in [`maigp-agent-core`](https://pypi.org/project/maigp-agent-core/) (shared lifecycle) and, transitively, [`maigp-client`](https://pypi.org/project/maigp-client/).

## Quick start

```python
from crewai import Crew
from aigp_crewai import AigpCrewCallbacks

callbacks = AigpCrewCallbacks(gov_url="https://gov.example.com",
                              app_id="my-crew", hmac_secret="secret")

# Attach to your Crew so each task runs as a governed child session
crew = Crew(agents=[...], tasks=[...], step_callback=callbacks.on_step)
```

## Multi-agent model

Crew start opens a parent session (CHECK); each task runs as a **child session with a delegation token**; each agent model call accumulates tokens; crew end emits an aggregate RECORD with linked TRACEs.

## Links

- Protocol, specs & full adapter catalog: https://github.com/owner-spec/aigp-protocol
- Issues: https://github.com/owner-spec/aigp-protocol/issues

---

License: Proprietary. © Kanjani AI Research & Causum.
