Skip to main content

SRA-RiskGate Cloud

The hosted service behind sra_riskgate.cloud (sra-riskgate 2.0.0+). The library stays free, offline and open source. The cloud adds what one machine cannot do alone:

Feature What it does
Shared budgets One spend ledger for every machine an organisation's agents run on. The budget check and its ledger entry happen together, so eight workers racing for the last $30 of a budget cannot all win.
Threat feed Look-alike addresses reported by poisoning scans. An address enters everyone's feed only when at least two organisations report it (SRA_CLOUD_FEED_MIN_ORGS, never below 2) or an operator approves it, so no single customer can block an address for everyone.
Receipt vault Every cloud decision is signed with the organisation's own key, chained to the one before and stored. GET /v1/report builds the audit report.
Pay per check (x402) POST /v1/x402/check: agents with no account pay per check in USDC, through the official x402 SDK and a facilitator. Stateless: no shared ledger, since there is no account.
Dashboard GET /: plan, usage, verified receipts, feed size and recent decisions. The API key stays in the browser tab.

The payment's free text never reaches the service: CloudClient.check_payment checks it locally first and sends only the payment fields.

API

All /v1 routes except /v1/x402/check need Authorization: Bearer sra_live_....

Route
POST /v1/check {chain_id, sender, recipient, amount, token?, peg_deviation_pct?, payment_id?, known_recipients?}: the decision, flags, signed receipt, usage. 429 when the plan's monthly limit is reached.
POST /v1/ledger/release {payment_id}: give back the budget of an approved payment that was never sent.
GET /v1/policy, PUT /v1/policy The organisation's policy, in the library's policy format; ledger and screening are refused.
GET /v1/feed, POST /v1/feed/report The threat feed; report {address, imitates?, chain_id?, tx?}.
GET /v1/receipts?after=&limit=, GET /v1/report?format=json|md The vault and its audit report.
GET /v1/usage Checks used this month and the plan's limit.
POST /v1/x402/check Pay-per-check (when configured).
GET /healthz, GET / Health and dashboard.

Run it locally

pip install -e . -e "./cloud[x402]"          # from the repository root
export SRA_CLOUD_DB=./sra-cloud.db
sra-cloud create-org "My team" --plan free     # prints org id, API key and receipt key: save them
sra-cloud serve --port 8080
from sra_riskgate import CloudClient
cloud = CloudClient(api_key="sra_live_...", base_url="http://localhost:8080")
cloud.set_policy({"version": 1, "budgets": {"window_hours": 24, "total": 500}})
r = cloud.check_payment(chain_id=8453, sender=agent, recipient=payee, amount=25, peg_deviation_pct=0.0)

Deploy on Fly.io

From the repository root, with flyctl installed and fly auth login done:

fly apps create YOUR-APP-NAME                        # then set app = "YOUR-APP-NAME" in cloud/fly.toml
fly volumes create sra_data --size 1 --region iad --config cloud/fly.toml
fly deploy --config cloud/fly.toml --dockerfile cloud/Dockerfile
fly ssh console --config cloud/fly.toml -C 'sra-cloud create-org "First customer" --plan free'

Optional settings (fly secrets set NAME=value --config cloud/fly.toml):

Variable Default
SRA_CLOUD_PLANS {"free": 1000, "team": 100000, "scale": 2000000} Monthly check limit per plan
SRA_CLOUD_FEED_MIN_ORGS 2 Organisations that must report an address before it enters the feed (2 or more)
SRA_CLOUD_X402_PAY_TO unset Your USDC address: turns on pay-per-check
SRA_CLOUD_X402_RECEIPT_KEY unset Hex key that signs pay-per-check receipts (required with the above): python -c "import secrets; print(secrets.token_hex(32))"
SRA_CLOUD_X402_PRICE $0.002 Price per check
SRA_CLOUD_X402_NETWORK eip155:8453 Base mainnet. eip155:84532 for Base Sepolia while testing
SRA_CLOUD_FACILITATOR_URL x402 SDK default Facilitator for verify and settle

Operate it

sra-cloud orgs                                   # list organisations
sra-cloud new-key ORG_ID --label ci              # another key; revoke with: sra-cloud revoke-key sra_live_XXXXXXX
sra-cloud set-plan ORG_ID team
sra-cloud feed --pending                         # reports not yet in the feed
sra-cloud feed-approve 0x...  /  sra-cloud feed-reject 0x... --note "false positive"

Back up /data/sra-cloud.db (Fly volume snapshots are on by default; copy it off-site too). It holds API key hashes, organisation receipt keys, the ledger and the vault.

Limits of this version (0.1.0)

  • One instance. Atomic budgets rely on one process and one SQLite file. Keep min_machines_running = 1 and do not scale out until the ledger moves to Postgres.
  • No self-serve signup or card billing yet. You create organisations with sra-cloud create-org and invoice by hand; x402 pay-per-check needs no account.
  • Receipt keys are held by the service so it can sign; the organisation gets a copy at creation to verify receipts independently. Treat the database as secret.
  • Get an independent security review before taking money: the service holds budgets, keys and decision records.

Metadata

Release files for sra-riskgate-cloud 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sra-riskgate-cloud 0.1.0
File Size Uploaded Provenance Actions
sra_riskgate_cloud-0.1.0.tar.gz 25.5 kB Without provenance Details for sra_riskgate_cloud-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sra-riskgate-cloud 0.1.0
File Interpreter ABI Platform Actions
sra_riskgate_cloud-0.1.0-py3-none-any.whl Python 3 none any Details for sra_riskgate_cloud-0.1.0-py3-none-any.whl

Total release size: 46.5 kB

Release files / sra_riskgate_cloud-0.1.0.tar.gz

Download URL sra_riskgate_cloud-0.1.0.tar.gz
Size 25.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f4b2b3e9fea6108f057e4e396d7b7b0de22d0269a7fee0a20cb1b543b66e439c
BLAKE2b-256 checksum
How to use checksums
abac7bcfe1255a38c86edbb5c130800a05b6dcf8b37bcd6d9c4ed1f0cfbe9632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / sra_riskgate_cloud-0.1.0-py3-none-any.whl

Download URL sra_riskgate_cloud-0.1.0-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afad7fca456978d501e7d52a298cfff5add6275b0581ab1ce71ac0009e2cc70c
BLAKE2b-256 checksum
How to use checksums
339e9e6a687686eb49ca77b1e406b7b02dd3661ba02a072820023a4db8df3092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for sra-riskgate-cloud 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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