crewai-kavachos
KavachOS DAN gate + budget guard for CrewAI agents.
Governance via AEGIS — pre-execution DAN gate on every tool call, plus a pre-flight budget check before the crew kicks off. Zero mandatory dependency on the ANKR platform — AEGIS communicates over HTTP.
Part of the KavachOS agentic governance suite.
Install
pip install crewai-kavachos
Quick start
from crewai import Agent, Crew, Task
from crewai_kavachos import KavachCrewAICallback, governed_kickoff
AEGIS = "http://localhost:4850" # or your AEGIS server
# 1. Add callback to agents — gates every tool call before execution
callback = KavachCrewAICallback(base_url=AEGIS, on_block="raise")
agent = Agent(
role="Researcher",
goal="...",
backstory="...",
callbacks=[callback],
)
crew = Crew(agents=[agent], tasks=[...])
# 2. governed_kickoff = budget pre-check + crew.kickoff()
result = governed_kickoff(crew, aegis_url=AEGIS, inputs={})
What it provides
| Class | What it does |
|---|---|
KavachCrewAICallback |
LangChain callback — intercepts every CrewAI tool call via on_tool_start, calls KAVACH DAN gate before execution |
CrewAIBudgetGuard |
Wraps crew.kickoff() — raises KavachBudgetError if daily budget is exhausted before the crew starts |
governed_kickoff() |
One-liner combining both: budget check + kickoff |
AegisClient |
Re-exported from langchain-kavachos — query gate, state, audit directly |
KavachGateError |
Raised when a tool call is blocked (DAN-1/2/3/4) |
KavachBudgetError |
Raised when daily budget is exhausted at crew start |
How it works
CrewAI is built on LangChain. The KavachCrewAICallback subclasses KavachGateCallback
from langchain-kavachos — it fires LangChain's on_tool_start hook, which runs inside
CrewAI's tool dispatch loop before any tool executes. Policy lives in AEGIS — the callback
is a relay, not a policy engine.
If AEGIS is unreachable, both the callback and the budget guard fail open (warn, continue) so a KavachOS outage does not block the crew entirely.
AEGIS server
Start AEGIS (part of the KavachOS distribution):
ankr-ctl start ankr-aegis # ANKR ecosystem
# or
PORT=4850 bun run src/dashboard/server.ts # standalone
Health check: GET http://localhost:4850/api/v1/kavach/health
License
AGPL-3.0 — the same license as the KAVACH kernel enforcement layer. The code governing agents in production is auditable.
Metadata
Release files for crewai-kavachos 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crewai_kavachos-1.0.0.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crewai_kavachos-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / crewai_kavachos-1.0.0.tar.gz
| Download URL | crewai_kavachos-1.0.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
583dc29fab971a5a633133acc2801174416cb4dec5e858a4fd500afe06c5aecb
|
|
BLAKE2b-256 checksum How to use checksums |
7682e7a92f588591f77df971e9fdc37f49f33ba2c9ac2151192a620614923649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / crewai_kavachos-1.0.0-py3-none-any.whl
| Download URL | crewai_kavachos-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70d594bf9cedcf7e63a61aca52eac008750dbb3036db4c0f21c18389ff92005f
|
|
BLAKE2b-256 checksum How to use checksums |
6f1428d1db3c55b2d03995c62902e9792df0c15909b3fe4b54fdc7bf181f4a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|