Skip to main content

aegis-langchain

⚠️ Sprint 25 freeze (2026-06-26): aegis-langchain is now maintenance-only. The Aegis team has narrowed focus to a single hero SDK, aegis-anthropic, while we drive design-partner revenue. aegis-langchain continues to receive security patches but no new features until further notice. The drop-in LangChain contract below remains fully supported against the canonical /execute API; you can keep using it in production.

Drop-in LangChain middleware that routes every tool invocation through Aegis's runtime governance pipeline before execution.

PyPI Python License

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:

  1. GET /receipts/key — ed25519 PEM
  2. GET /compliance/export/eu-ai-act?period_start=…&period_end=… — signed bundle
  3. aegis-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 with pip install "aegis-langchain[langchain]")

See also

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)

Source distribution for aegis-langchain 1.1.7
File Size Uploaded
aegis_langchain-1.1.7.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aegis-langchain 1.1.7
File Interpreter ABI Platform
aegis_langchain-1.1.7-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.1.7 This release

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page