Skip to main content

Agent Output Security & Hallucination Gate (agent-security-gate-x402) 🛡️⚡

PyPI Version Glama.ai Cloud Run Polygon Network FastAPI License: MIT

Ultra-low latency (<10ms) deterministic security, prompt injection, secret key leak, dangerous AST code, and factual hallucination inspection micro-oracle with EIP-191 & EIP-712 cryptographic attestations on Polygon, Base, and Arbitrum.


🖥️ Interactive Web Dashboard & Simulator (Live)

🌐 https://agent-security-gate-x402-7qxtp3324q-du.a.run.app/

Explore the full consumer and enterprise visual interface directly in your browser:

  • 🛡️ Prompt Injection & Jailbreak Radar: Live testing against DAN prompts, system tag escapes, and adversarial suffixes.
  • Dangerous AST Code Analyzer: Sub-millisecond Python syntax parsing detecting os.system, subprocess, eval, exec, and malicious sockets.
  • 🔍 Hallucination & NLI Fact-Checker: Contrast agent generation with ground truth context to surface fabricated numbers and unanchored claims.
  • 📜 EIP-712 On-Chain Attestation & Calldata: Instant generation of v, r, s ABI calldata for EVM smart contracts.
  • 📡 Real-Time Security Event Stream: Live WebSocket event feed of inspection audits.

🔗 Live Service Links & Resources

Service / Endpoint Description URL Link
🖥️ Web Dashboard Interactive visual UI, security simulator & audit tester Launch Dashboard
API Playground Browser-based interactive query sandbox Open Playground
🛡️ Live Inspection Core deterministic security & NLI hallucination check /inspect
📜 On-Chain Calldata EIP-712 smart contract attestation calldata endpoint /api/v1/gate/attestation/onchain
📖 Swagger API Docs Full interactive OpenAPI documentation View Swagger Docs
🤖 LLM Agent Manifest Machine-readable tool specifications /llms.txt

⚡ 1-Click MCP Integration (Claude Desktop & Cursor)

Connect to Claude Desktop, Cursor, Gemini, or any Model Context Protocol client instantly:

{
  "mcpServers": {
    "security-gate-x402": {
      "command": "uvx",
      "args": ["agent-security-gate-x402"]
    }
  }
}

💎 Core Services & Capabilities

1. Ultra-Low Latency Prompt & Security Radar (<5ms)

Deterministic pattern and AST scanning neutralizing prompt injections, system tag breakouts (</system_instruction>), and API token / private key leakages before downstream agent propagation.

2. Python Code AST Hazard Auditing

In-memory Python Abstract Syntax Tree (AST) inspection isolating hazardous invocations:

  • System execution (os.system, os.popen, subprocess.Popen, subprocess.run)
  • Arbitrary code evaluation (eval, exec, __import__)
  • Network socket reverse shells and unencrypted exfiltration vectors.

3. Factual Grounding & NLI Hallucination Verification

Compares LLM text claims against trusted source documents or ledger ground truths, outputting:

  • Grounding ratio (0.0 to 1.0)
  • Explicit list of fabricated numbers and ungrounded entities.

4. Cryptographic Proof-of-Safety & Smart Contracts

  • EIP-191 Signatures: Off-chain attestation receipts for agent-to-agent validation.
  • EIP-712 Typed Data & Solidity Calldata: Native integration with SecurityGateConsumer.sol on Polygon (137), Base (8453), and Arbitrum (42161).

📦 Quick Start & Installation

Option 1. Run Instantly with uvx (No Installation Required)

# Run stdio MCP server directly for LLM clients
uvx agent-security-gate-x402

Option 2. Install from PyPI

pip install agent-security-gate-x402

# Run MCP server (stdio mode)
agent-security-gate

# Or launch interactive terminal tester
python test_interactive.py

Option 3. Local Development Server

git clone https://github.com/nohosa001-pixel/security-gate-x402.git
cd security-gate-x402
pip install -e .
uvicorn app.main:app --port 8000 --reload

📜 Smart Contract Integration (SecurityGateConsumer.sol)

Autonomous on-chain agents can verify security attestations directly in Solidity:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./contracts/SecurityGateConsumer.sol";

contract AutonomousAgentExecutor {
    SecurityGateConsumer public immutable securityGate;

    constructor(address _securityGateAddress) {
        securityGate = SecurityGateConsumer(_securityGateAddress);
    }

    function executeGuardedAction(
        bytes32 payloadHash,
        uint8 riskScore,
        string calldata verdict,
        uint256 expiresAt,
        uint8 v,
        bytes32 r,
        bytes32 s,
        address target,
        bytes calldata callData
    ) external {
        // Enforces max 10% risk score threshold and valid oracle signature
        securityGate.verifyAndExecute(
            payloadHash,
            riskScore,
            verdict,
            expiresAt,
            v,
            r,
            s,
            target,
            callData,
            10 // maxRiskScore
        );
    }
}

🧪 Testing

Run the full pytest suite:

pytest -v tests/

Launch the interactive terminal tester:

python test_interactive.py

📢 X (Twitter) Automated Promotion & Security Alert Bot

Launch the automated promotion and status broadcast bot:

# Windows 1-Click launcher
.\x_promo_bot.bat

# Or run via Python directly
python x_promo_bot.py
  • 🇰🇷 Korean Thread: Comprehensive showcase of security radars, AST parser, and Web UI.
  • 🌐 Global Launch Thread: High-impact English launch announcement with 1-click test links.
  • 🛡️ Real-Time Security Bulletins: Automated micro-oracle status and guardrail alerts.
  • 🤖 Dual Mode: Direct X API v2 thread chaining (requests_oauthlib) or instant 1-click Web Intent browser launcher.

📄 License

MIT License © 2026 Security Gate Team

Download files

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

Source Distribution

agent_security_gate_x402-1.2.1.tar.gz (69.1 kB view details)

Uploaded Source

Built Distribution

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

agent_security_gate_x402-1.2.1-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file agent_security_gate_x402-1.2.1.tar.gz.

File metadata

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

File hashes

Hashes for agent_security_gate_x402-1.2.1.tar.gz
Algorithm Hash digest
SHA256 5435b774c3908098a84044a7589d068cbf43771f6e6e0cc441b141922207d732
MD5 a5731942c33c57fc9ebe7a6dd225b600
BLAKE2b-256 81f1e780d5d10fb1376a6bfe46c84dfff5a358ddbb8596db4177fc73947a115b

See more details on using hashes here.

File details

Details for the file agent_security_gate_x402-1.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for agent_security_gate_x402-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 57e88fb72745ad439385aa2315f5c332c6d3cb757f2ad366605e9476ac9eab4a
MD5 62b0b457b5e705a2f9aeb6c02382e353
BLAKE2b-256 6a30be25cd56fc3f5e4cab7e802732a140776a1894296fc688a68c4511bb78ef

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 files

1.2.0

2 files

1.1.0

2 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