The self-healing exception handler for autonomous AI agents.
Project description
AgentX Security SDK & Semantic Gateway ๐ก๏ธ
AgentX is a production-grade security layer and semantic firewall designed specifically for autonomous AI agents. It intercepts, evaluates, and conditionally blocks agent-driven actions based on intent, policy violation, and neuro-symbolic evaluation.
Instead of failing silently or requiring immediate human intervention, the AgentX Edge SDK issues a Socratic Challenge, forcing the agent to reason about its actions and self-correct into a safe operation.
๐ Quickstart (Agent Integration)
Install the SDK via PyPI:
pip install agentx-security-sdk
Wrap any sensitive tool or function with the @agentx_protect decorator. AgentX operates at the edge, adding zero latency to your cloud operations until an anomaly is detected.
from agentx_sdk.decorators import agentx_protect
@agentx_protect(agent_id="agent_prod_01")
def execute_database_query(query: str):
# Your database logic here
return db.execute(query)
๐ Local Telemetry & Agent Health
AgentX ships with a built-in, privacy-first SQLite time-series event log (.agentx.db). It tracks every interception locally. When your agent script finishes or crashes, AgentX automatically prints a comprehensive Session Summary and Lifetime ROI dashboard:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก๏ธ AgentX Session Summary
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฑ๏ธ Uptime: 9.17 seconds
๐ ๏ธ Tools Monitored: 2
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Intercepts: 1 | Cumulative: 5
๐ฅ Critical Blocks: 1 | Cumulative: 5
๐ฐ Tokens Saved: ~1500 | Cumulative: ~7500
โณ Time Saved: ~5m | Cumulative: ~25m
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฉบ AGENT HEALTH INSIGHT
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๏ธ Top Offender: 'Database Isolation'
๐ ๏ธ Tip: Consider refining your agent's system prompt to avoid this.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐๏ธ The Architecture (Split-Plane)
AgentX relies on a decoupled, hybrid-cloud architecture to ensure maximum performance and security for AI-driven enterprise systems.
- The Edge SDK (AgentX): The lightweight Python package that instruments agent tools and triggers local Socratic self-healing.
- The Data Plane (Semantic Firewall): A Python FastAPI middleware (the "Wedge") that intercepts raw HTTP/SQL payloads before they hit the database.
- The Control Plane (Dashboard): A Next.js application (deployed via Vercel) that allows human reviewers to monitor intercepted agent traffic, review chains of thought, and approve or deny parked requests.
- The Shared Brain: Supabase acts as the central state manager. Both the Control Plane and Data Plane synchronize via Supabase, decoupling the network architecture and allowing asynchronous state polling.
- The Evaluator: Google's Gemini 2.5 Flash is used to translate an agent's Chain of Thought (CoT) into a zero-knowledge taxonomy to evaluate intent against YAML-defined enterprise policies.
โจ Key Features & Built-in Policies
- Automated Socratic Self-Healing: Intercepts dangerous tool calls and challenges the agent to revise its strategy.
- Fast Pass Heuristic Traps: Instantly intercepts structurally dangerous queries (e.g.,
DROP TABLE,DELETE) with minimal latency. - Zero-Knowledge Intent Extraction: Prevents malicious prompt injection by translating raw agent logic into a strict schema before policy evaluation.
- Dynamic YAML Policies: Enforces isolation rules like "Mass Destructive Intent", "Database Isolation", "Network Sandbox (SSRF)", and "Secrets Exfiltration".
๐ ๏ธ Getting Started (Backend Deployment)
If you are deploying your own instance of the Semantic Gateway Control Plane:
Prerequisites
- Python 3.10+
- Node.js 18+
- Supabase Account
- Google AI Studio API Key (Gemini)
1. Environment Variables
Create a .env file in the root directory. Ensure this file is in your .gitignore to protect your IP and keys.
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_service_role_key
GEMINI_API_KEY=your_gemini_api_key
2. Run the Semantic Firewall (Dockerized)
The Data Plane (Wedge) is fully containerized for maximum reliability. Make sure your .env is configured in the root directory, then build and run the backend:
cd backend
docker build -t agentx-gateway .
docker run -p 8000:8000 --env-file ../.env agentx-gateway
The firewall is now intercepting traffic at http://localhost:8000
3. Run the Control Plane Dashboard (Vercel/Local)
Start your Next.js application to view the intercepted incidents.
cd ui
npm install
npm run dev
Your dashboard is now live at http://localhost:3000
4. Run the Agent Simulation
Simulate a rogue agent attempting a destructive action. Watch the firewall intercept it, issue a challenge, and route it to your dashboard.
python examples/simulate_agent_sdk.py
๐ Security Posture
- Secret Management: API keys are never checked into version control. Production variables are managed securely via the Vercel Dashboard.
- History Scrubbing: This repository has been scrubbed of legacy keys using git-filter-repo.
- Private IP: Repository is private to protect proprietary evaluation prompts and architecture.
๐ Roadmap
- Trust Boundary Shift: Move the neuro-symbolic evaluation entirely behind the Data Plane to prevent agent manipulation.
- Dynamic Policy Engine: Shift YAML configurations directly into Supabase for instant Control Plane sync.
- Dockerization: Containerize the Data Plane for deployment to AWS ECS / Render for persistent, low-latency edge interception.
- Multi-Tenancy: Implement Supabase Row Level Security (RLS) for multi-org deployments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentx_security_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentx_security_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa578f16291a3bbb522f8ba467764e8d04d3b31cc6fc4ec879a4ce271f0c260
|
|
| MD5 |
16698ff7f77debfe69a38048b0e03b48
|
|
| BLAKE2b-256 |
47e37b3c16cd5d86f115c2e30c046771c7140245db2a469c8e0c01c20f0c9257
|