aegis-anthropic
Drop-in Anthropic SDK wrapper that routes every
tool_usecall through Aegis's runtime governance pipeline before execution.
pip install aegis-anthropic
What it does
Wraps anthropic.Anthropic() so that every tool_use block produced by Claude is pre-checked by Aegis (POST /execute) before the tool actually runs. Blocked tool calls become text blocks that explain the denial. The Claude agent loop handles them naturally — no special error path in your code.
Aegis itself decides what to block based on action semantics (the DROP TABLE, rm -rf, kubectl delete, external-PII-egress patterns from services/policy/policies/action_semantics_deny.rego). The deny is earned from content, not from a hardcoded "critical" tag — so it survives a buyer changing the agent's risk level.
Every check produces a signed audit row in the Aegis chain. Your auditor can verify it offline with aegis-verify (the tools/aegis_verify/ CLI).
Three-line install
from aegis_anthropic import AegisAnthropic
client = AegisAnthropic(
api_key="sk-ant-...", # Anthropic key (or ANTHROPIC_API_KEY env)
aegis_key="acp_...", # Aegis API key (or AEGIS_API_KEY env)
aegis_url="https://aegisagent.in", # or AEGIS_URL env
tenant_id="00000000-0000-0000-0000-000000000001",
agent_id="<your-agent-uuid>",
)
response = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
tools=[{
"name": "shell",
"description": "run a shell command",
"input_schema": {"type": "object", "properties": {"command": {"type": "string"}}},
}],
messages=[{"role": "user", "content": "Clean up /var/log to free disk space."}],
)
# Claude proposes tool_use → Aegis pre-checks each one → destructive
# commands become text blocks explaining the deny. Allowed calls
# return through the normal anthropic SDK path.
Fail-closed by default
If the Aegis gateway is unreachable, every tool call is treated as a deny with reason aegis_unreachable_fail_closed. Letting unchecked tool calls through because the security plane was down defeats the point of the integration.
What you can verify offline
After any allowed (or denied) tool call:
- Pull the public key once:
GET /receipts/key→ ed25519 PEM - Download an evidence bundle:
GET /compliance/export/eu-ai-act?period_start=…&period_end=… - Run
aegis-verify --bundle bundle.json(the standalone CLI) — V1–V6 checks pass without any network call back to Aegis.
The same chain backs every SDK in the family (aegis-anthropic, aegis-openai, aegis-langchain).
Requirements
- Python 3.10+
anthropic>=0.25(install withpip install "aegis-anthropic[anthropic]"if you want it pulled in automatically)
See also
- aegis-openai — same pattern for OpenAI tool_calls
- aegis-langchain — same pattern for LangChain agents
- Aegis live demo — three real scenarios across three risk profiles
License
Apache 2.0.
Metadata
Release files for aegis-anthropic 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aegis_anthropic-1.1.5.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aegis_anthropic-1.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.4 kB
Release files / aegis_anthropic-1.1.5.tar.gz
| Download URL | aegis_anthropic-1.1.5.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e9165759dbc200d81217a74577dc91bb9a05ba2aa95e517df76654de133b2c9
|
|
BLAKE2b-256 checksum How to use checksums |
a55eb9d5b00ce705cf19bc604f0645fd0d3e5f4376025ccda2fe12001e05a159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / aegis_anthropic-1.1.5-py3-none-any.whl
| Download URL | aegis_anthropic-1.1.5-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95457d82aa2f7aca3ec1fa5bb681c4cbf2530662ab2558b2399e1d92384bc6a8
|
|
BLAKE2b-256 checksum How to use checksums |
6d12d955c473b7d76ef045d5dc0ad8c2ee0865e07105f40430409b69014f48f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|