aegis-langchain
⚠️ Sprint 25 freeze (2026-06-26):
aegis-langchainis now maintenance-only. The Aegis team has narrowed focus to a single hero SDK,aegis-anthropic, while we drive design-partner revenue.aegis-langchaincontinues to receive security patches but no new features until further notice. The drop-in LangChain contract below remains fully supported against the canonical/executeAPI; you can keep using it in production.
Drop-in LangChain middleware that routes every tool invocation through Aegis's runtime governance pipeline before execution.
pip install aegis-langchain
What it does
Wraps a LangChain agent (AgentExecutor / Runnable) so every tool the agent decides to call is pre-checked by Aegis (POST /execute) before the tool actually runs. Blocked calls return a descriptive message back to the agent loop; allowed calls pass through unchanged.
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 the content of the action, not from a hardcoded "critical" tag on the agent. So a buyer flipping the agent's risk level can't accidentally bypass it.
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_langchain import AegisMiddleware
agent = AegisMiddleware(
my_langchain_agent,
api_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>",
)
result = agent.invoke({"input": "analyze the customer table and clean up old rows"})
# Each tool invocation is pre-checked. Blocked tools return a message
# explaining the deny; the agent reasons over it like any other tool
# observation.
Works with any LangChain agent that uses tools (AgentExecutor, structured-chat agents, custom runnables that invoke tools via tool_call).
Fail-closed by default
If the Aegis gateway is unreachable, tool invocations return deny with reason aegis_unreachable_fail_closed. Letting unchecked calls through because the security plane was down defeats the integration's purpose.
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+
langchain-core>=0.1(auto-pulled withpip install "aegis-langchain[langchain]")
See also
- aegis-anthropic — same pattern for Anthropic tool_use
- aegis-openai — same pattern for OpenAI tool_calls
- Aegis live demo — three real scenarios across three risk profiles
License
Apache 2.0.
Metadata
Release files for aegis-langchain 1.1.7
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_langchain-1.1.7.tar.gz | 11.7 kB | Without provenance | Details for aegis_langchain-1.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aegis_langchain-1.1.7-py3-none-any.whl | Python 3 | none | any | Details for aegis_langchain-1.1.7-py3-none-any.whl |
Total release size: 24.0 kB
Release files / aegis_langchain-1.1.7.tar.gz
| Download URL | aegis_langchain-1.1.7.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b769d673320e69b371f5d79c357990db41ab14b4d90d9dea97aefa070906b962
|
|
BLAKE2b-256 checksum How to use checksums |
bd31b8442cd882d847151b2ba81b6f25be7f93cfee7c274eca61b88b09a5839f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / aegis_langchain-1.1.7-py3-none-any.whl
| Download URL | aegis_langchain-1.1.7-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a12d6906976934b20b50e445b434d43023601045d3a28fb4b82a821ecb19b807
|
|
BLAKE2b-256 checksum How to use checksums |
9718c0b33a0ebe3a4671d5d39dee2fa89ee67386e2a4219587b8e2bffa904109
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for aegis-langchain 1.1.7
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.