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.0.tar.gz (65.8 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.0-py3-none-any.whl (54.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_security_gate_x402-1.2.0.tar.gz
  • Upload date:
  • Size: 65.8 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.0.tar.gz
Algorithm Hash digest
SHA256 23ba400143f0904c4c9b2737340974a7c5b39fa4509af8ec1fc2355828ae3089
MD5 c18deacb0829af9c33e5d2bf827ec38b
BLAKE2b-256 0d9659e76b4d78f4e52338b0759a168e1a5a524587746f0b4dcc5e6541f454ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_security_gate_x402-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc6bcaba4ba9a1f6c1df47f5b1af76af514bfaffe617a823ae90c180cd7db15d
MD5 1b1a05a1d88f0e42a1ed3c76921a3753
BLAKE2b-256 c676e74f5be1a94c9ba8b934e77e65764d5bb3e047ef275caab939a68cb5e00f

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.1

2 files

This release

1.2.0 This release

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