Metadata-Version: 2.4
Name: algate-sdk
Version: 0.1.0
Summary: Python client for Algate's Algorand-native pre-action safety gate.
Project-URL: Homepage, https://algate-x402.up.railway.app
Project-URL: Documentation, https://algate-x402.up.railway.app/llms.txt
Project-URL: Download wheel, https://algate-x402.up.railway.app/sdk/algate_sdk-0.1.0-py3-none-any.whl
Author: Algate
License: ISC
Keywords: ai-agents,algorand,mcp,security,x402
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: ISC License (ISCL)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx<1,>=0.27
Requires-Dist: py-algorand-sdk<3,>=2.6
Provides-Extra: test
Requires-Dist: pytest<10,>=8; extra == 'test'
Description-Content-Type: text/markdown

# Algate Python SDK

The Python SDK exposes the same `guard()` contract as the TypeScript client and implements x402 `exact` payments natively for Algorand MainNet.

```bash
pip install algate-sdk
# fallback (site-hosted wheel):
# pip install https://algate-x402.up.railway.app/sdk/algate_sdk-0.1.0-py3-none-any.whl
```

```python
import os
from algate import Algate, create_payment_id

payment_id = create_payment_id("invoice_")

with Algate(os.environ["PAYER_MNEMONIC"]) as algate:
    result = algate.guard(
        {
            "action": "pay_x402",
            "request": {"url": target_url, "method": "GET"},
            "payment_required": payment_required_header,
            "policy": {
                "max_amount_usdc": "0.05",
                "allowed_hosts": ["api.example.com"],
                "allowed_pay_to": [trusted_merchant],
                "require_payment_identifier": True,
            },
        },
        payment_id=payment_id,
    )

if result["recommended_action"] == "pay":
    # The target payment still belongs to the agent.
    pass
```

Persist `payment_id` with the logical operation and reuse it after a timeout or process restart. The mnemonic remains local and is only used to pay Algate's own `$0.001` analysis fee. Algate never receives the key and never pays the target merchant.
