Skip to main content

xShieldAI / AEGIS DAN gate + budget guard for CrewAI agents — pre-execution governance via @xshieldai/aegis

Project description

xshieldai-crewai

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 xshieldai-crewai

Quick start

from crewai import Agent, Crew, Task
from xshieldai_crewai 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 xshieldai-langchain — 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 xshieldai-langchain — 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

xshieldai_crewai-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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: xshieldai_crewai-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 xshieldai_crewai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fe31bace76c82fc637872ec48e9995ecee7cf4b2c402784c2068905e102bb904
MD5 72c76de3e3d0c1926675fc5e7942bb13
BLAKE2b-256 654c5a46ccb9d313735357da5299107e5dfa0f6dc0d3222a3ecc127aa668b48b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xshieldai_crewai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d93576c2d1b28498fef9fbd042df5b8b12fe8d727f7e970f2abbe2e53daa3f4
MD5 fbd891349d77486287d4a227a54f2cb0
BLAKE2b-256 5b3d3748a37b64bbfd0bd4f01764b0df787dcbf31ef4906ad06181c400c298d6

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