Text Generation
Transformers
Safetensors
English
qwen3
stablecoin
payments
compliance
x402
eip-3009
eip-712
disputes
refunds
agents
agentkit
trl
web3
usdc
fraud-detection
financial-risk
qwen
mcp
ai-agents
prompt-injection
agentic-payments
payment-security
risk-assessment
ofac
reproducibility
conversational
Eval Results (legacy)
Eval Results
text-generation-inference
Instructions to use sriram1983007/SRA-RiskGate-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sriram1983007/SRA-RiskGate-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sriram1983007/SRA-RiskGate-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sriram1983007/SRA-RiskGate-4B") model = AutoModelForCausalLM.from_pretrained("sriram1983007/SRA-RiskGate-4B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sriram1983007/SRA-RiskGate-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sriram1983007/SRA-RiskGate-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
- SGLang
How to use sriram1983007/SRA-RiskGate-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "sriram1983007/SRA-RiskGate-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sriram1983007/SRA-RiskGate-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sriram1983007/SRA-RiskGate-4B with Docker Model Runner:
docker model run hf.co/sriram1983007/SRA-RiskGate-4B
Card: sra-riskgate command line (1.9.x) and MCP 0.17.2
Browse files
README.md
CHANGED
|
@@ -254,6 +254,7 @@ If this is useful for your agent, a ❤️ like on this page helps others find i
|
|
| 254 |
| In LangChain / Coinbase AgentKit (Python) | `pip install langchain-sra-riskgate` ([GitHub](https://github.com/sriram1983007-dev/langchain-sra-riskgate)) |
|
| 255 |
| Rule checks in Python, no GPU | `pip install sra-riskgate` ([details](#📦-python-sdk-one-call-before-every-payment-pypi)) · [try them in Colab](https://colab.research.google.com/github/sriram1983007-dev/sra-riskgate/blob/main/notebooks/try-sra-riskgate.ipynb) |
|
| 256 |
| Test your agent's payments in CI | [GitHub Action](https://github.com/sriram1983007-dev/sra-riskgate-action): `uses: sriram1983007-dev/sra-riskgate-action@v1` |
|
|
|
|
| 257 |
| Your own cloud API, no setup | [Runpod Serverless](https://console.runpod.io/serverless): **Deploy LLM API**, model `sriram1983007/SRA-RiskGate-4B`, Max Model Length `8192`, a 24 GB or 48 GB GPU, min workers 0. Use `https://api.runpod.ai/v2/<ENDPOINT_ID>/openai/v1` as an OpenAI-compatible base URL with your Runpod API key. About 2.4 s per check once warm (measured on a 48 GB GPU); the first request after idle takes about 2 minutes |
|
| 258 |
| Your own OpenAI-compatible server (GPU) | [vLLM](#⚡-serve-with-vllm-openai-compatible-api): `docker run --gpus all -p 8000:8000 --ipc=host vllm/vllm-openai:v0.31.0 --model sriram1983007/SRA-RiskGate-4B --max-model-len 8192` |
|
| 259 |
|
|
@@ -290,7 +291,7 @@ If this is useful for your agent, a ❤️ like on this page helps others find i
|
|
| 290 |
{ "mcpServers": { "sra-riskgate": { "command": "uvx", "args": ["sra-riskgate-mcp"] } } }
|
| 291 |
```
|
| 292 |
|
| 293 |
-
Pass the payment's own text as `untrusted_text` so self-asserted claims are held. From 0.9.2, the payment tools also take `account_code` (the sender's `eth_getCode` result) and hold if the account is delegated to a contract not listed in `SRA_EXPECTED_DELEGATES`. Every tool fails closed, and the agent should only pay on `approve`. From 0.13.0, set `SRA_ALLOWED_TOKENS=USDC,USDT,USDB,USDG` (or any subset) so the payment tools also check those stablecoins; it is a server setting only, so a manipulated agent cannot turn a token on. From 0.14.0, `SRA_EXTRA_TOKENS` describes stablecoins the SDK does not list, as JSON (`symbol`, `chain_id`, `contract`, `decimals`), so every tool recognises them too. From 0.16.0, set a screening provider's key (`SRA_CHAINALYSIS_API_KEY`, `SRA_TRM_API_KEY` or `SRA_TRM_KEYLESS=1`, `SRA_RANGE_API_KEY`, `SRA_WEBACY_API_KEY`, or `SRA_ELLIPTIC_API_KEY` with `SRA_ELLIPTIC_API_SECRET`) and the payment tools also screen the sender and payee with it: a sanctions match rejects, and a provider with no answer holds. A half-configured provider is a configuration error, never screening silently switched off. From 0.17.0, `SRA_BUDGET_TOTAL`, `SRA_BUDGET_PER_PAYEE`, `SRA_MAX_PAYMENTS_PER_HOUR` and `SRA_AMOUNT_SPIKE_FACTOR` hold payments that break a rolling budget or look unlike the wallet's history, `SRA_RECEIPT_KEY` adds a signed receipt to every payment decision (checked with `verify_receipt`), and `SRA_POLICY_FILE` keeps all the rules in one reviewed file. The server is listed in the official MCP Registry and on [Glama](https://glama.ai/mcp/servers/sriram1983007-dev/sra-riskgate-mcp), and rated Grade A (trust score 98/100, November 2026) on [mcprush](https://mcprush.com/sriram1983007-dev/sra-riskgate-mcp).
|
| 294 |
|
| 295 |
**Coding agents:** the [agent-payment-guard](https://github.com/sriram1983007-dev/agent-payment-guard) Agent Skill teaches Claude Code and other agents to run this check before paying: `npx skills add sriram1983007-dev/agent-payment-guard`.
|
| 296 |
|
|
@@ -301,9 +302,26 @@ Pass the payment's own text as `untrusted_text` so self-asserted claims are held
|
|
| 301 |
The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing. From 0.17.0, smart accounts are covered: `check_user_operation(user_op, chain_id=...)` decodes the calls an ERC-4337 UserOperation makes (Coinbase Smart Wallet, CDP smart accounts, Safe, Kernel, Nexus, SimpleAccount) and checks each one, so an unlimited `approve()` hidden in a batch next to a payment is held and payments to the same payee are summed against your limit; self-calls, delegatecalls and unexpected paymasters are held too. Tested against callData produced by viem and permissionless for seven account types. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain, USDC and USDG implement EIP-3009 (USDG's support was confirmed on 2026-11-14 and its x402 signatures are checked from 1.6.0; earlier releases held them), so an x402 signature for USDT or USDB is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)). From 1.2.0 and 1.3.0, `with_dispute_window()`, `payment_messages()` and `dispute_messages()` build this model's exact training prompts, and `parse_payment_verdict()` / `parse_dispute_verdict()` read its answer, failing closed. From 1.4.0, `check_payment(screening_providers=[...])` adds outside address screening: Chainalysis's and TRM Labs' free sanctions APIs, Range and Webacy are built in (TRM from 1.5.0), and any other provider plugs in with `CallableProvider`. A provider's sanctions match or severe risk rejects, high risk holds, and a provider with no usable answer holds; only the sender's and recipient's addresses are sent. The adapters are built from each provider's published API documentation and tested against responses shaped like it; none has yet been run against a live provider account ([details](https://github.com/sriram1983007-dev/sra-riskgate#screening-providers-chainalysis-range-webacy-and-your-own-140)).
|
| 302 |
|
| 303 |
```bash
|
| 304 |
-
pip install --upgrade "sra-riskgate>=1.
|
| 305 |
```
|
| 306 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
### 🔎 Screening providers: Chainalysis, TRM Labs, Range, Webacy, Elliptic or your own (1.4.0+)
|
| 308 |
|
| 309 |
Add outside address screening to the same one-call check. Both the sender and the recipient are screened, only
|
|
@@ -425,7 +443,7 @@ Depeg checks run only when a `peg_feed` is supplied.
|
|
| 425 |
|
| 426 |
## 🚀 Transformers Quickstart
|
| 427 |
|
| 428 |
-
**Shortcut:** `pip install "sra-riskgate>=1.
|
| 429 |
|
| 430 |
The model was trained on a specific prompt format, and it only performs as benchmarked when you use that format exactly:
|
| 431 |
|
|
|
|
| 254 |
| In LangChain / Coinbase AgentKit (Python) | `pip install langchain-sra-riskgate` ([GitHub](https://github.com/sriram1983007-dev/langchain-sra-riskgate)) |
|
| 255 |
| Rule checks in Python, no GPU | `pip install sra-riskgate` ([details](#📦-python-sdk-one-call-before-every-payment-pypi)) · [try them in Colab](https://colab.research.google.com/github/sriram1983007-dev/sra-riskgate/blob/main/notebooks/try-sra-riskgate.ipynb) |
|
| 256 |
| Test your agent's payments in CI | [GitHub Action](https://github.com/sriram1983007-dev/sra-riskgate-action): `uses: sriram1983007-dev/sra-riskgate-action@v1` |
|
| 257 |
+
| From a terminal or a shell script, no code | `uvx sra-riskgate check --chain 8453 --sender 0x… --to 0x… --amount 25 --peg 0`: exits 0 approve, 10 hold, 20 reject ([details](#💻-command-line-190)) |
|
| 258 |
| Your own cloud API, no setup | [Runpod Serverless](https://console.runpod.io/serverless): **Deploy LLM API**, model `sriram1983007/SRA-RiskGate-4B`, Max Model Length `8192`, a 24 GB or 48 GB GPU, min workers 0. Use `https://api.runpod.ai/v2/<ENDPOINT_ID>/openai/v1` as an OpenAI-compatible base URL with your Runpod API key. About 2.4 s per check once warm (measured on a 48 GB GPU); the first request after idle takes about 2 minutes |
|
| 259 |
| Your own OpenAI-compatible server (GPU) | [vLLM](#⚡-serve-with-vllm-openai-compatible-api): `docker run --gpus all -p 8000:8000 --ipc=host vllm/vllm-openai:v0.31.0 --model sriram1983007/SRA-RiskGate-4B --max-model-len 8192` |
|
| 260 |
|
|
|
|
| 291 |
{ "mcpServers": { "sra-riskgate": { "command": "uvx", "args": ["sra-riskgate-mcp"] } } }
|
| 292 |
```
|
| 293 |
|
| 294 |
+
Pass the payment's own text as `untrusted_text` so self-asserted claims are held. From 0.9.2, the payment tools also take `account_code` (the sender's `eth_getCode` result) and hold if the account is delegated to a contract not listed in `SRA_EXPECTED_DELEGATES`. Every tool fails closed, and the agent should only pay on `approve`. From 0.13.0, set `SRA_ALLOWED_TOKENS=USDC,USDT,USDB,USDG` (or any subset) so the payment tools also check those stablecoins; it is a server setting only, so a manipulated agent cannot turn a token on. From 0.14.0, `SRA_EXTRA_TOKENS` describes stablecoins the SDK does not list, as JSON (`symbol`, `chain_id`, `contract`, `decimals`), so every tool recognises them too. From 0.16.0, set a screening provider's key (`SRA_CHAINALYSIS_API_KEY`, `SRA_TRM_API_KEY` or `SRA_TRM_KEYLESS=1`, `SRA_RANGE_API_KEY`, `SRA_WEBACY_API_KEY`, or `SRA_ELLIPTIC_API_KEY` with `SRA_ELLIPTIC_API_SECRET`) and the payment tools also screen the sender and payee with it: a sanctions match rejects, and a provider with no answer holds. A half-configured provider is a configuration error, never screening silently switched off. From 0.17.0, `SRA_BUDGET_TOTAL`, `SRA_BUDGET_PER_PAYEE`, `SRA_MAX_PAYMENTS_PER_HOUR` and `SRA_AMOUNT_SPIKE_FACTOR` hold payments that break a rolling budget or look unlike the wallet's history, `SRA_RECEIPT_KEY` adds a signed receipt to every payment decision (checked with `verify_receipt`), and `SRA_POLICY_FILE` keeps all the rules in one reviewed file. From 0.17.2, the server requires sra-riskgate 1.9.1, so `uvx sra-riskgate policy validate` checks the file you give `SRA_POLICY_FILE`, and `uvx sra-riskgate receipt verify result.json --key-env SRA_RECEIPT_KEY` checks a saved receipt with no server running. The server is listed in the official MCP Registry and on [Glama](https://glama.ai/mcp/servers/sriram1983007-dev/sra-riskgate-mcp), and rated Grade A (trust score 98/100, November 2026) on [mcprush](https://mcprush.com/sriram1983007-dev/sra-riskgate-mcp).
|
| 295 |
|
| 296 |
**Coding agents:** the [agent-payment-guard](https://github.com/sriram1983007-dev/agent-payment-guard) Agent Skill teaches Claude Code and other agents to run this check before paying: `npx skills add sriram1983007-dev/agent-payment-guard`.
|
| 297 |
|
|
|
|
| 302 |
The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing. From 0.17.0, smart accounts are covered: `check_user_operation(user_op, chain_id=...)` decodes the calls an ERC-4337 UserOperation makes (Coinbase Smart Wallet, CDP smart accounts, Safe, Kernel, Nexus, SimpleAccount) and checks each one, so an unlimited `approve()` hidden in a batch next to a payment is held and payments to the same payee are summed against your limit; self-calls, delegatecalls and unexpected paymasters are held too. Tested against callData produced by viem and permissionless for seven account types. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain, USDC and USDG implement EIP-3009 (USDG's support was confirmed on 2026-11-14 and its x402 signatures are checked from 1.6.0; earlier releases held them), so an x402 signature for USDT or USDB is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)). From 1.2.0 and 1.3.0, `with_dispute_window()`, `payment_messages()` and `dispute_messages()` build this model's exact training prompts, and `parse_payment_verdict()` / `parse_dispute_verdict()` read its answer, failing closed. From 1.4.0, `check_payment(screening_providers=[...])` adds outside address screening: Chainalysis's and TRM Labs' free sanctions APIs, Range and Webacy are built in (TRM from 1.5.0), and any other provider plugs in with `CallableProvider`. A provider's sanctions match or severe risk rejects, high risk holds, and a provider with no usable answer holds; only the sender's and recipient's addresses are sent. The adapters are built from each provider's published API documentation and tested against responses shaped like it; none has yet been run against a live provider account ([details](https://github.com/sriram1983007-dev/sra-riskgate#screening-providers-chainalysis-range-webacy-and-your-own-140)).
|
| 303 |
|
| 304 |
```bash
|
| 305 |
+
pip install --upgrade "sra-riskgate>=1.9.1"
|
| 306 |
```
|
| 307 |
|
| 308 |
+
### 💻 Command line (1.9.0+)
|
| 309 |
+
|
| 310 |
+
The SDK installs a `sra-riskgate` command, so a payment flow, a CI job or a finance team can use the checks
|
| 311 |
+
without writing Python:
|
| 312 |
+
|
| 313 |
+
```bash
|
| 314 |
+
uvx sra-riskgate check --chain 8453 --sender 0xAgent --to 0xPayee --amount 25 --peg 0 --policy policy.json
|
| 315 |
+
uvx sra-riskgate policy validate policy.json
|
| 316 |
+
uvx sra-riskgate receipt verify receipt.json --key-env SRA_RECEIPT_KEY
|
| 317 |
+
```
|
| 318 |
+
|
| 319 |
+
`check` exits **0 approve, 10 hold, 20 reject**, so a script can stop on a hold. It is a dry run (1.9.1+): with a
|
| 320 |
+
policy that has budgets it reads the spend ledger but never adds to it, so testing a policy never spends an agent's
|
| 321 |
+
real budget (`--record` counts the payment). `policy validate` prints the file's SHA-256, the same hash every
|
| 322 |
+
signed receipt carries. `receipt verify` accepts a receipt or a whole saved MCP tool result. Add `--json` for
|
| 323 |
+
machine-readable output.
|
| 324 |
+
|
| 325 |
### 🔎 Screening providers: Chainalysis, TRM Labs, Range, Webacy, Elliptic or your own (1.4.0+)
|
| 326 |
|
| 327 |
Add outside address screening to the same one-call check. Both the sender and the recipient are screened, only
|
|
|
|
| 443 |
|
| 444 |
## 🚀 Transformers Quickstart
|
| 445 |
|
| 446 |
+
**Shortcut:** `pip install "sra-riskgate>=1.9.1"` gives `payment_messages()` and `dispute_messages()`, which build the exact prompts below for you, and `parse_payment_verdict()` / `parse_dispute_verdict()`, which read the answer and fail closed.
|
| 447 |
|
| 448 |
The model was trained on a specific prompt format, and it only performs as benchmarked when you use that format exactly:
|
| 449 |
|