Skip to main content

A production-grade middleware for AI agents to perform on-chain payments and verifiable consent.

Project description

AgentGuard SDK

AgentGuard is a production-grade middleware that enables AI agents to perform on-chain payments and generate verifiable consent proofs in compliance with DPDP (Digital Personal Data Protection) standards.

By isolating private keys in a hardened MCP Server (Vault) and using the AgentGuard Backend (Dispatcher) as a secure proxy, the SDK allows developers to add monetization and compliance to their agents with zero blockchain complexity.

Installation

pip install agentguard-python-sdk

Quick Start (3-Line Usage)

import asyncio
from agentguard import AgentGuardClient
from agentguard.types import DelegatedAuthorization, AuthorizationConstraints, NonceContext, AuthorizationMetadata

async def main():
    # 1. Initialize the client
    # NOTE: The backend requires a cryptographic signature on `/pay`.
    # Provide `private_key` as a base64-encoded Algorand private key seed for request signing.
    async with AgentGuardClient(
        wallet_address="YOUR_WALLET_ADDRESS",
        private_key="YOUR_PRIVATE_KEY_B64",
        backend_url="https://agentguard-backend-9s8j.onrender.com"
    ) as client:
        
        # 1.5 Authorize a capability (LogicSig)
        auth = DelegatedAuthorization(
            authorization_id="YOUR_AUTHORIZATION_ID",
            principal_id="YOUR_WALLET_ADDRESS",
            logic_sig_b64="YOUR_SIGNED_LOGICSIG_BASE64",
            constraints=AuthorizationConstraints(
                max_amount_microalgos=1000000,
                expires_at_unix=1900000000,
                max_txns_per_window=10,
                window_seconds=3600
            ),
            nonce_context=NonceContext(lease_strategy="deterministic", scope="session"),
            metadata=AuthorizationMetadata(created_at=1716000000, sdk_version="0.2.2", delegation_type="LogicSig")
        )
        await client.authorize(auth)
        
        # 2. Perform a secure payment (includes automatic DPDP consent hashing)
        receipt = await client.pay_and_fetch(
            resource_url="https://api.stock.com/reliance",
            amount_algo="0.05",
            purpose="Financial Analysis",
            authorization_id="YOUR_AUTHORIZATION_ID"
        )
        print(f"Payment Successful! TX ID: {receipt.tx_id}")

        # 3. Verify compliance audit trail
        proof = await client.verify(receipt.tx_id)
        print(f"On-Chain Verified: {proof.verified}")

if __name__ == "__main__":
    asyncio.run(main())

Architecture

  1. SDK: Generates UUID nonces and SHA256 consent hashes.
  2. Backend: Proxies requests to the internal vault and maintains audit records.
  3. MCP Server (Vault): A hardened, isolated environment that signs transactions using Algorand.
  4. Algorand Blockchain: Provides the irrefutable proof-of-consent and payment settlement.

Features

  • Async First: Built on httpx for high-performance agentic loops.
  • Zero-Trust: Private keys never leave the vault.
  • DPDP Compliant: Automatic cryptographic logging of purpose-bound consent.
  • Simple Audit: Direct links to blockchain explorers for every transaction.

© 2026 AgentGuard Team. Built for the Algorand Ecosystem.

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

agentguard_python_sdk-0.2.4.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

agentguard_python_sdk-0.2.4-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file agentguard_python_sdk-0.2.4.tar.gz.

File metadata

  • Download URL: agentguard_python_sdk-0.2.4.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for agentguard_python_sdk-0.2.4.tar.gz
Algorithm Hash digest
SHA256 5b610dacd972f99dfdfde6d02c41adb7eeca5efc81b395b1d2b5323e9fa9c121
MD5 65c84e055c2b9e7c3b7e1ec99201de1d
BLAKE2b-256 2ea8d84d048691ecb780375263058f75f359f6ef8e7181fa774e0b12969cc1c8

See more details on using hashes here.

File details

Details for the file agentguard_python_sdk-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for agentguard_python_sdk-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cd9ed6b49dd63f17a6a5f1d27bf7b47ac4908f9ab9e34303c737f1109f4ae5e2
MD5 00d755991ff7c64593f680faf1800050
BLAKE2b-256 bbe4014c556842eb7099b096ba2b21d7c61aca5cad2c9e62d38f77b5efc2284e

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