Skip to main content

An open-source Python framework leveraging efficient trie structures

Project description

SuperAgentX Policy Engine

Enterprise-grade AI Agent Governance Framework for Autonomous AI Systems

Python License Async

SuperAgentX Policy Engine is an AI Agent Governance Framework designed to secure, control, and govern autonomous AI systems.

Unlike traditional authorization frameworks, SuperAgentX Policy Engine understands:

  • Agents
  • Workflows
  • LLMs
  • Tools
  • Memory
  • Multi-Agent Systems
  • Human Approvals
  • AI Threats

Why This Exists

Modern AI Agents can:

  • Execute shell commands
  • Access databases
  • Call APIs
  • Modify memory
  • Spawn new agents
  • Communicate with other agents
  • Spend money through LLM usage
  • Access enterprise systems

Traditional authorization systems were built for users and applications.

They were not built for:

Agent -> Agent
Agent -> Tool
Agent -> LLM
Agent -> Memory
Agent -> Workflow
Agent -> Enterprise Systems

SuperAgentX Policy Engine introduces a governance layer between AI agents and execution.


Architecture

Agent
   │
   ▼

Governance Layer

   ├── Threat Detection
   ├── Rate Limiting
   ├── Quota Management
   ├── Policy Evaluation
   ├── Human Approval (HITL)
   ├── Cost Governance
   └── Audit Logging

   │
   ▼

Tool / LLM / Database / API

Features

Policy-Based Governance

IAM-style policies.

Human-in-the-Loop (HITL)

Require approvals before risky actions.

Threat Detection

Detect:

  • Prompt Injection
  • Jailbreak Attempts
  • Data Exfiltration
  • Credential Theft
  • Agent Abuse
  • Recursive Agent Attacks

Cost Governance

Control AI spending.

Tool Governance

Control access to tools.

Memory Governance

Protect sensitive memory.

Agent Governance

Control:

  • agent:execute
  • agent:spawn
  • agent:communicate

Audit Trail

Track every decision.

Async First

Built for high-scale agent systems.


Installation

pip install superagentx-policy-engine

Quick Start

Load Policy

from superagentx_policy_engine.policy_engine import PolicyEngine
from superagentx_policy_engine.store.file_store import FilePolicyStore

engine = PolicyEngine()

policy = FilePolicyStore.load(
    "policies/allow_search.json"
)

await engine.add_policy_document(policy)

Policy Format

{
  "version": "2026-01-01",
  "statements": [
    {
      "sid": "AllowWebSearch",
      "effect": "Allow",
      "action": [
        "tool:execute"
      ],
      "resource": [
        "tool:web_search"
      ]
    }
  ]
}

Effects

Supported effects:

Allow
Deny
Approve

Priority:

Deny
 >
Approve
 >
Allow

Human Approval Example

{
  "sid":"LargeSpendApproval",
  "effect":"Approve",
  "action":["llm:invoke"],
  "resource":["*"],
  "condition":{
    "NumericGreaterThan":{
      "context.custom.estimated_cost":100
    }
  },
  "approval":{
    "role":"finance_manager"
  }
}

Tool Governance

Block dangerous tools.

{
  "sid":"BlockShell",
  "effect":"Deny",
  "action":["tool:execute"],
  "resource":["tool:shell"]
}

Memory Governance

{
  "sid":"ProtectCustomerMemory",
  "effect":"Deny",
  "action":["memory:delete"],
  "resource":["memory:customer-*"]
}

Agent Spawn Protection

{
  "sid":"SpawnProtection",
  "effect":"Deny",
  "condition":{
    "NumericGreaterThan":{
      "context.custom.spawn_count":50
    }
  }
}

Threat Detection

Built-in threat protection.

Signature Detection

Detects known attacks.

Rule Detection

Detects suspicious behavior.

LLM Detection

Powered by LiteLLM.

Supported providers:

  • OpenAI
  • Claude
  • Gemini
  • Bedrock
  • Azure OpenAI
  • Ollama
  • Groq
  • DeepSeek

Multi-Stage Threat Detection

detector = EnsembleThreatDetector(
    detectors=[
        SignatureThreatDetector(),
        RuleThreatDetector(),
        LiteLLMThreatDetector(
            model="gemini/gemini-2.5-pro"
        )
    ]
)

Pipeline:

Request
   │
   ▼

Signature Detector
   │
   ▼

Rule Detector
   │
   ▼

LLM Detector
   │
   ▼

Policy Engine

Policy Hierarchy

Global Policy
      │
      ▼
Workflow Policy
      │
      ▼
Agent Policy
      │
      ▼
Engine Policy
      │
      ▼
Handler Policy

Multi-Agent Governance

Govern agent interactions.

Research Agent
      │
      ▼
Fact Check Agent
      │
      ▼
Summary Agent
      │
      ▼
Report Agent

Policies can control:

agent:execute
agent:spawn
agent:communicate

SuperAgentX Integration

AgentXPipe
     │
     ▼

workflow:start
     │
     ▼

agent:execute
     │
     ▼

engine:execute
     │
     ▼

tool:execute

Governance checks can happen at every stage.


Use Cases

AI Workforce Governance

Control autonomous teams.

FinOps

Control AI spending.

Production Change Management

Require approvals before production access.

Secure Tool Usage

Restrict dangerous operations.

Multi-Agent Security

Govern agent-to-agent interactions.

Memory Protection

Prevent accidental deletion.

Enterprise AI Governance

Apply policies consistently across all agents.


Examples

01_allow
02_deny_override
03_hitl_approval
04_tool_governance
05_cost_governance
06_spawn_protection
07_chain_depth_protection
08_memory_governance
09_threat_detection
10_budget_control
11_prod_database_approval
12_multi_agent_governance
13_showcase_demo
14_llm_threat_detection
15_multi_stage_threat_detection

Roadmap

Current

  • Allow
  • Deny
  • Approve
  • Conditions
  • Threat Detection
  • Rate Limiting
  • Quotas
  • Audit Logs
  • LiteLLM Integration

Upcoming

  • Policy Registry
  • Policy Versioning
  • Policy Signing
  • Workflow Policies
  • Agent Policies
  • Engine Policies
  • Handler Policies
  • ReBAC
  • Cedar Compatibility

Comparison

Feature SuperAgentX OPA Cedar
Agent Governance
HITL Approvals
Threat Detection
LLM Governance
Cost Governance
Multi-Agent Governance

Contributing

Contributions are welcome.

Please open issues, discussions, and pull requests.


License

SuperAgentX Policy Engine is released under the MIT License.


Built for the next generation of autonomous AI systems.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superagentx_policy_engine-0.1.0.tar.gz (121.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superagentx_policy_engine-0.1.0-py3-none-any.whl (33.3 kB view details)

Uploaded Python 3

File details

Details for the file superagentx_policy_engine-0.1.0.tar.gz.

File metadata

  • Download URL: superagentx_policy_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 121.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for superagentx_policy_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c2346e727a455430cd4ca92e1c2818f4b94ad6c8476f1c64dbb6bc7f5f6b4e0
MD5 130e1a227a829135cc610237b594b03f
BLAKE2b-256 82cea6fa6684a72b68144538321a5c14a7b215befefb604564ca564a40025757

See more details on using hashes here.

File details

Details for the file superagentx_policy_engine-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: superagentx_policy_engine-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for superagentx_policy_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbfde6855e014eb5f906e6c8b9d5019463ad0c1e51f00230a4a0dfffac259b57
MD5 7e08279f16946a6f361f98930ada5041
BLAKE2b-256 08bfbf6c7dd05a994e8aa393782ebf47a4a2e4d584a61bbfca3a7a3444370fe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page