Skip to main content

KavachOS DAN gate + budget guard for CrewAI agents — pre-execution governance via AEGIS

Project description

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.

Project details


Download files

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

Source Distribution

crewai_kavachos-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

crewai_kavachos-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file crewai_kavachos-1.0.0.tar.gz.

File metadata

  • Download URL: crewai_kavachos-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for crewai_kavachos-1.0.0.tar.gz
Algorithm Hash digest
SHA256 583dc29fab971a5a633133acc2801174416cb4dec5e858a4fd500afe06c5aecb
MD5 4ca04570bb7c11f64af0401495c4722f
BLAKE2b-256 7682e7a92f588591f77df971e9fdc37f49f33ba2c9ac2151192a620614923649

See more details on using hashes here.

File details

Details for the file crewai_kavachos-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for crewai_kavachos-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70d594bf9cedcf7e63a61aca52eac008750dbb3036db4c0f21c18389ff92005f
MD5 4bceff4572d0e52a79de72a0eb7b389f
BLAKE2b-256 6f1428d1db3c55b2d03995c62902e9792df0c15909b3fe4b54fdc7bf181f4a92

See more details on using hashes here.

Supported by

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