Skip to content
View LortuArte's full-sized avatar

Block or report LortuArte

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. Markdown is supported. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
LortuArte/README.md

πŸ›‘οΈ AEGIS Core | Authorization Boundary for AI Agents

PyPI Version License: MIT

Local pre-execution authorization for financially consequential AI-agent tool calls.

AEGIS Core sits between an agent's reasoning/runtime layer and high-risk tools such as payments, trades, paid APIs, and other external side effects.

It enforces budget and idempotency decisions before execution is allowed, including under concurrent retries.


🚨 The 1,000-Request Contention Risk

An autonomous agent does not need to be malicious to create financial damage.

Retries, asynchronous execution, runaway loops, or multiple workers can cause several individually valid tool calls to compete for the same remaining budget or repeat the same logical action.

For financially consequential tools, the critical question is:

What happens if an agent retries the same expensive action concurrently before the previous execution has fully resolved?

AEGIS Core places a local authorization boundary before that external side effect.


⚑ Why AEGIS? (Local Pre-Execution Policy Enforcement)

AEGIS Core is a local Python policy gate designed to make authorization decisions before financially consequential tool execution.

It focuses on deterministic local state control rather than replacing the agent framework itself.

  • Budget Enforcement: Block execution when the remaining authorized budget is insufficient.
  • Idempotency Control: Prevent duplicate logical tool executions from being authorized twice.
  • Concurrency Control: Serialize competing local authorization decisions around shared economic state.
  • Framework Agnostic: Can sit in front of LangChain, AutoGen, CrewAI, MCP integrations, or raw Python tools.
  • Local Enforcement: The current implementation does not require Redis, Kafka, or a remote policy service for its local mode.
  • Fail-Closed Security: Invalid authorization/signature conditions are rejected rather than silently allowed.

Current scope: AEGIS Core's tested atomicity guarantees are local and single-process. Distributed multi-process or multi-node coordination is not claimed.


πŸ“Š Benchmark Proof (Concurrent Contention Test)

In a reproducible local stress test, 1,000 authorization requests were submitted through 100 workers while competing for a budget sufficient for only one operation:

  • βœ… 1,000 authorization requests
  • βœ… 100 workers
  • βœ… 1 request allowed
  • βœ… 999 requests denied
  • βœ… 0 overspend
  • βœ… Final balance remained consistent
  • βœ… Financial-loss regression matrix: 12/12 PASS

AEGIS also includes reproducible tests for:

  • βœ… Idempotency conflicts
  • βœ… Tool-call cryptographic binding
  • βœ… Signature failure rollback
  • βœ… Concurrent limited-budget settlement
  • βœ… Atomic rollback
  • βœ… Exact replay handling

Measured Local Latency

Current local benchmarks include:

  • Decision primitive: ~0.5 Β΅s median
  • Idempotency cache hit: ~2.4 Β΅s median
  • Full signed authorization: ~46.7 Β΅s median
  • SQLite in-memory L3 settlement: ~147.7 Β΅s median

These measurements describe the tested local execution paths only.

They do not represent HTTP/network round trips, distributed coordination, Stripe settlement, blockchain confirmation, or other external infrastructure latency.


πŸ“¦ Quickstart & Installation

pip install aegis-core-lortuarte-sdk

πŸ› οΈ Proof of Concept: Pre-Execution Authorization

Wrap high-risk tools such as payments, trades, paid API calls, or irreversible writes with the AEGIS gate.

from decimal import Decimal
from aegis import AegisLocalPolicyGate

# 1. Initialize the local authorization gate
aegis_gate = AegisLocalPolicyGate()

# Example: authorize this agent for $100
aegis_gate.ledger_data["agent-001"] = Decimal("100.00")


def execute_agent_payment(agent_id, tool_call_id, amount):
    # 2. Authorize spending BEFORE the external side effect
    decision = aegis_gate.evaluar_gasto(
        agent_did=agent_id,
        operation="stripe_charge",
        tool_call_id=tool_call_id,
        amount_usd=str(amount),
    )

    if decision["policy_decision"] == "allow":
        # Only now execute the real external action
        # stripe.PaymentIntent.create(...)
        return "Transaction Authorized"

    return "BLOCKED: Policy denied execution"

The important boundary is:

Agent decision
      ↓
AEGIS authorization
      ↓
ALLOW / DENY
      ↓
External tool execution

The financially consequential side effect happens only after authorization succeeds.


🧠 The Architecture (vs. LLM Gateways)

Feature LLM / Observability Gateways AEGIS Core
Primary Target LLM requests, prompts, tokens, tracing Financially consequential tool execution
Enforcement Point Model / API request path Immediately before tool execution
Budget State Platform dependent Local policy state
Idempotency Platform dependent Execution-level tool-call control
Concurrency Platform dependent Local atomic authorization boundary
Deployment Often remote / service based Local Python SDK
Current Atomicity Scope Platform dependent Single-process local execution

AEGIS is not intended to replace LLM gateways.

It addresses a different boundary:

The point where an AI agent is about to turn a decision into an economically consequential action.


🎯 Technical Design Partners

Running AI agents that can spend money, trigger payments, execute refunds, access paid APIs, perform trades, or create other financially consequential side effects?

AEGIS Core is currently looking for technical design partners willing to test the authorization boundary against real agent workflows.

Priority use cases:

  • πŸ’³ Agent payments and refunds
  • πŸ’° Treasury and credit workflows
  • πŸ”Œ Paid API / MCP tool execution
  • πŸ” Retry storms and concurrent execution
  • 🧾 Duplicate logical actions
  • πŸ€– Autonomous agent spending
  • πŸ” Pre-execution authorization

The objective is not to claim distributed production readiness.

The objective is to test AEGIS against real workflows, identify where the current model breaks, fix those boundaries, and retest them.

Install

pip install aegis-core-lortuarte-sdk

Project

AEGIS Core: https://aegis-api.com/

Pinned Loading

  1. aegis-sdk aegis-sdk Public

    Sub-millisecond Tool-Execution Firewall for AI Agents. Prevents asynchronous double-spending via Local IPC Locks.

    Python 1

  2. aegis-web-api aegis-web-api Public

    HTML 1