aegis-openai
⚠️ Sprint 25 freeze (2026-06-26):
aegis-openaiis now maintenance-only. The Aegis team has narrowed focus to a single hero SDK,aegis-anthropic, while we drive design-partner revenue.aegis-openaicontinues to receive security patches but no new features until further notice. The drop-in OpenAI contract below remains fully supported against the canonical/executeAPI; you can keep using it in production.
Drop-in OpenAI SDK wrapper that routes every
tool_callsinvocation through Aegis's runtime governance pipeline before execution.
pip install aegis-openai
What it does
Wraps openai.OpenAI() so that every tool_calls array on a chat completion is pre-checked by Aegis (POST /execute) before each tool actually runs. Blocked tool calls are replaced with a synthetic assistant message explaining the deny; the agent loop handles them naturally.
Aegis decides what to block based on action semantics (the DROP TABLE, rm -rf, kubectl delete, external-PII-egress patterns in services/policy/policies/action_semantics_deny.rego). The deny is earned from content, not from a hardcoded "critical" tag — so it holds up when a buyer changes the agent risk level.
Every check produces a signed audit row in the Aegis chain. Verify any of them offline with aegis-verify (the tools/aegis_verify/ CLI).
Three-line install
from aegis_openai import AegisOpenAI
client = AegisOpenAI(
openai_api_key="sk-...",
aegis_key="acp_...", # or AEGIS_API_KEY env var
aegis_url="https://aegisagent.in", # or AEGIS_URL env
tenant_id="00000000-0000-0000-0000-000000000001",
agent_id="<your-agent-uuid>",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Free up disk space — delete old logs."}],
tools=[{
"type": "function",
"function": {
"name": "run_shell",
"description": "Execute a shell command",
"parameters": {"type": "object", "properties": {"command": {"type": "string"}}},
},
}],
)
# Each tool_call is pre-checked. Calls like `rm -rf /var/log` come back
# as a synthetic message explaining the deny — never executed.
Fail-closed by default
If the Aegis gateway is unreachable, every tool call returns deny with reason aegis_unreachable_fail_closed. Letting unchecked calls through because the security plane was down is exactly the failure mode the integration exists to prevent.
What you can verify offline
After any allowed (or denied) tool call:
GET /receipts/key— ed25519 PEMGET /compliance/export/eu-ai-act?period_start=…&period_end=…— signed bundleaegis-verify --bundle bundle.json— V1–V6 checks pass without any network call back to Aegis
Requirements
- Python 3.10+
openai>=1.0(auto-pulled if you install withpip install "aegis-openai[openai]")
See also
- aegis-anthropic — same pattern for Anthropic tool_use
- 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-openai 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aegis_openai-1.1.6.tar.gz | 16.0 kB | Without provenance | Details for aegis_openai-1.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aegis_openai-1.1.6-py3-none-any.whl | Python 3 | none | any | Details for aegis_openai-1.1.6-py3-none-any.whl |
Total release size: 30.6 kB
Release files / aegis_openai-1.1.6.tar.gz
| Download URL | aegis_openai-1.1.6.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c47df041c3a23a0f98b55df35b621fd0e3fe6c9b3938a96074cf4a8e91a96eac
|
|
BLAKE2b-256 checksum How to use checksums |
fe91d4e0bb314d9b0f17cbc0d0296c061c58e6c606b3a8c1a7893c99ddf506c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / aegis_openai-1.1.6-py3-none-any.whl
| Download URL | aegis_openai-1.1.6-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f9293a7f246f98bc8c475fc923ad49e9720dad688a5770bf9f70a57d12a0fc2
|
|
BLAKE2b-256 checksum How to use checksums |
48ec97b001f437a6f2e10c9ff49fba2b2e0a8a34746aa31600abc008744f42de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for aegis-openai 1.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.