ai_economy_sdk module (ai-economy-sdk on PyPI), generated from the docstrings in x402-avm/ai-economy-sdk.
Server
| Object | Kind | Summary |
|---|---|---|
PaymentGate | class | Payment gate protecting FastMCP server tools with x402 on Algorand. |
AIEconomySDK | class | Payment-gated MCP server SDK. |
DefaultAvmSigner | class | A default implementation of AvmSigner for convenience. |
ChainReader | class | Reader for Algorand blockchain state via an Indexer client. |
SettleOnSuccessMiddleware | class | FastMCP middleware that settles payments on chain only upon tool success. |
Client
| Object | Kind | Summary |
|---|---|---|
paid_mcp_session | function | Open an MCP session that pays for tool calls with x402 on Algorand. |
Identity
| Object | Kind | Summary |
|---|---|---|
make_identity_txn | function | Create an unsigned identity proof payment transaction. |
sign_identity_txn | function | Create and sign an identity proof transaction, returning the X-Identity-Txn header. |
verify_identity_txn | function | Verify an X-Identity-Txn header value against timestamp skew and Algorand signature. |
sign_identity | function | Generate legacy identity verification headers signed with an Algorand private key. |
verify_identity | function | Verify identity headers against timestamp skew and Algorand signature. |
Networks
| Object | Kind | Summary |
|---|---|---|
resolve_network | function | Return the CAIP-2 id for a network name or id, and register it with x402. |
genesis_hash_for | function | Return the full 44-character base64 genesis hash for a network. |
endpoints_for | function | Default algod/indexer endpoints: AlgoNode for MainNet/TestNet, LocalNet for anything else. |
usdc_asset_id | function | Circle USDC’s asset id on MainNet/TestNet; None elsewhere. |
is_public | function | Check whether a network identifier represents public MainNet or TestNet. |
register_network | function | Register an Algorand network in x402’s network tables (no-op for MainNet/TestNet, which are built in). |
network_from_algod | function | Derive the CAIP-2 network id from an algod client and register it. |
Endpoints | class | Connection parameters for Algorand node services. |
Errors
| Object | Kind | Summary |
|---|---|---|
AIEconomyError | class | Base class for every exception the SDK raises deliberately. |
ConfigurationError | class | Invalid arguments or configuration, detected before any payment is attempted. |
UnknownNetworkError | class | A network name or CAIP-2 identifier could not be resolved. |
AlgodClientRequiredError | class | An operation needs an algod connection but the signer was created without one. |
PaymentVerificationError | class | A payment transaction group failed verification (for example, algod simulation). |
PaymentRequiredError | class | A priced tool was invoked without a verified payment. |
SettlementError | class | A verified payment could not be settled on chain after the tool succeeded. |
SpendLimitExceededError | class | The buyer’s own spend controls refused a payment, so nothing was signed or sent. |
Constants
| Object | Kind | Summary |
|---|---|---|
MAINNET, TESTNET, PASS_NOTE_PREFIX, ... | constants | Network ids, the pass note prefix and the legacy identity header names exported by ai_economy_sdk. |