Skip to main content

🛡️ Aegis Runtime (aegis-runtime)

Zero-trust deterministic flight controller for AI agents.
Circuit breakers, deterministic state locks, Policy-as-Code, atomic state rollbacks, and SHA-256 tamper-proof audit logs—with zero external dependencies.

pip install aegis-runtime

Why Aegis?

Prompt-level guardrails are probabilistic—sooner or later, an indirect prompt injection or runaway loop slips past the LLM. Aegis enforces hard deterministic rules in Python before any sensitive tool executes.


🚀 Quickstart: Policy-as-Code & Hash-Chained Audit Logs (v0.4.0)

Define security rules in a standalone aegis_policy.json file without touching agent code:

{
  "max_calls": 5,
  "rules": {
    "verify_customer": {
      "sets_state": { "customer_verified": true }
    },
    "issue_refund": {
      "requires_state": { "customer_verified": true },
      "max_args": { "amount": 10000 }
    }
  }
}

Load the policy, guard your tools, and export a tamper-evident SHA-256 hash chain:

from aegis_runtime import AegisRuntime

aegis = AegisRuntime.from_policy("aegis_policy.json")

@aegis.guard
def verify_customer(email: str) -> str:
    return f"Verified {email}"

@aegis.guard
def issue_refund(amount: float, email: str) -> str:
    return f"Refunded ${amount} to {email}"

verify_customer("user@example.com")
issue_refund(500, "user@example.com")

# Export hash-chained compliance log
aegis.export_audit_log("audit.json")

Verify cryptographic integrity from any terminal:

aegis verify audit.json

🔌 Universal Agent Adapters (OpenAI, Anthropic, Groq, LangGraph & n8n)

from aegis_runtime import AegisRuntime, AegisAgentAdapter

aegis = AegisRuntime()

@aegis.guard(sets_state={"customer_verified": True})
def verify_customer(email: str) -> str:
    """Verify customer identity before sensitive actions."""
    return f"Verified {email}"

@aegis.guard(requires_state={"customer_verified": True})
def issue_refund(amount: float, email: str) -> str:
    """Issue a refund to a verified customer."""
    return f"Refunded ${amount} to {email}"

adapter = AegisAgentAdapter(aegis)

# 1. Export schemas for OpenAI / Groq / LangGraph or Anthropic
openai_tools = adapter.to_openai_tools()
anthropic_tools = adapter.to_anthropic_tools()

# 2. Safely execute incoming LLM tool calls or n8n webhook payloads
response = adapter.execute_tool_call("issue_refund", '{"amount": 500, "email": "user@example.com"}')

⏪ Atomic Time-Travel Rollbacks (@aegis.transaction)

Wrap multi-step workflows so that if step 3 fails, steps 1 and 2 automatically rewind to zero:

@aegis.transaction("onboarding_flow")
def run_workflow():
    step_1_provision_db()
    step_2_allocate_credits()
    step_3_failing_call()  # Automatically rewinds state_store to pre-transaction snapshot

License

MIT License

Metadata

Release files for aegis-runtime 0.4.0

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-runtime 0.4.0
File Size Uploaded Provenance Actions
aegis_runtime-0.4.0.tar.gz 9.9 kB Without provenance Details for aegis_runtime-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aegis-runtime 0.4.0
File Interpreter ABI Platform Actions
aegis_runtime-0.4.0-py3-none-any.whl Python 3 none any Details for aegis_runtime-0.4.0-py3-none-any.whl

Total release size: 18.6 kB

Release files / aegis_runtime-0.4.0.tar.gz

Download URL aegis_runtime-0.4.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b5533e4aa634d6e90bcc8b07fcf7e962dd622f3b112eb5ea92af33d4bd5ab595
BLAKE2b-256 checksum
How to use checksums
2c63e6650d233366ad8aa91d4edd95b0ab2c397bd6780e0b20745eaceb85bafa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / aegis_runtime-0.4.0-py3-none-any.whl

Download URL aegis_runtime-0.4.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9f93872196cb0d6832389c083eca569fa2bb7d9b80b50b841655095f0ff48ad
BLAKE2b-256 checksum
How to use checksums
561bb84551900bbd5990593354b1ef56688892e33e00e04c25dc6eab77e56aa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for aegis-runtime 0.4.0

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.

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