Docs · SDK reference
One init(), 9 frameworks.
The AEGIS SDKs are auto-instrumentation libraries. Add one line at process start and every supported framework's tool calls flow through the gateway — no per-call rewriting, no decorator goo, no LangChain handler glue.
Supported frameworks
- Anthropic SDK (Python + JS)
- OpenAI SDK (Python + JS)
- LangChain + LangGraph (Python + JS)
- CrewAI
- LlamaIndex
- Mistral AI
- Google Gemini / Vertex AI
- AWS Bedrock (boto3)
- smolagents
If your framework isn't on this list, the LLM egress proxy
mode works for anything that respects OPENAI_BASE_URL /
ANTHROPIC_BASE_URL / equivalent.
Python SDK
pip install agentguard
# in your agent entrypoint:
import agentguard
agentguard.init(
api_key="aeg_xxx",
gateway_url="https://gateway.aegis.dev", # or your self-hosted URL
agent_id="my-agent", # optional but recommended
) After init():
- Anthropic / OpenAI / Mistral / Gemini / Cohere clients are monkey-patched at import time. Every call goes through the gateway.
- LangChain
BaseTool.runis patched — tool calls land as audit rows. - CrewAI agent handoffs are intercepted for the cross-agent / collusion detector.
- Exceptions on blocked calls are
AgentGuardBlockedError, with the policy id + reason.
JavaScript / TypeScript SDK
npm install @agentguard/sdk
// in your entrypoint:
import { init } from '@agentguard/sdk';
init({
apiKey: process.env.AEGIS_API_KEY,
gatewayUrl: 'https://gateway.aegis.dev',
agentId: 'my-agent',
verbose: false, // set true (or AGENTGUARD_VERBOSE=1) for cold-start logs
}); Same auto-instrumentation surface as Python.
Configuration reference
| Option | Required | Default | Notes |
|---|---|---|---|
apiKey | yes | — | Org-scoped key from /signup or the cockpit Settings page. |
gatewayUrl | yes | — | Hosted: https://gateway.aegis.dev. Self-host: http://localhost:8080. |
agentId | no | auto | If unset, derived from the host + process. Set explicitly for multi-agent apps. |
blocking | no | true | false = observe-only (no enforcement, just audit). |
timeoutMs | no | 5000 | Gateway call deadline. |
verbose | no | false | Cold-start "auto-patched: [...]" log line. |
Manual mode (skip auto-instrumentation)
If you want explicit checkpoints instead of monkey-patching:
from agentguard import AgentGuard
guard = AgentGuard(api_key="aeg_xxx", gateway_url="...", agent_id="my-agent")
verdict = guard.check_tool_call(tool="db_query", arguments={"sql": "SELECT 1"})
if verdict.decision == "block":
raise RuntimeError(verdict.reason) Zero-code-change mode (no SDK)
If you'd rather not install anything, point your existing SDK's base URL at the AEGIS proxy:
# Anthropic / OpenAI / Mistral / Gemini all support a base URL env var.
export OPENAI_BASE_URL=https://gateway.aegis.dev/openai/v1
export AEGIS_API_KEY=aeg_xxx
# your code is unchanged
AEGIS proxies the call to upstream, runs detectors on the
response (tool calls, embedded prompts, anomalies), writes
audit, returns. Every framework that respects *_BASE_URL
works zero-code.