ai-economy-sdk 0.5.1
Fixed- When the buyer’s own spend controls refused a payment inside
paid_mcp_session, the caller got anExceptionGroupwrapping x402’sPaymentError(causeNoMatchingRequirementsError), soexcept AIEconomyErrormissed it. The refusal now surfaces asSpendLimitExceededError, with the x402 error as__cause__. Other errors, and groups that contain anything besides the refusal, propagate unchanged.
SpendLimitExceededError(AIEconomyError), exported from the package and documented inai_economy_sdk.exceptions. Its message includes the amount and asset the server asked for.
x402-avm-js 0.4.1
FixedalgodClient('localnet')connected to port 80 instead of 4001: the empty-string port passed toalgosdk.Algodv2made algosdk 3.x override the port in the URL. The port is now omitted so the URL’s own port (or the scheme default for MainNet and TestNet) is used. Affected every release since the first.
Security
ai-economy-sdk 0.5.0- The gate inspects the JSON-RPC body of every HTTP
POST, whatever its path or transport, and its route table matches every path. - Fails closed:
SettleOnSuccessMiddlewarerefuses (withPaymentRequiredError) any priced tool call that did not pass through the HTTP gate. A gated call whose payment reservation has expired is refused instead of being served without settlement. JSON-RPC batches containingtools/callare rejected with HTTP 400, and the HTTP middleware refuses priced calls with HTTP 500 ifSettleOnSuccessMiddlewarewas never installed. subscription_issuercan no longer be silently ignored: the issuer is always passed tochain.has_active_subscription(), andPaymentGateraisesConfigurationErrorat construction if that method has noissuerparameter.DefaultAvmSignerno longer stores the key in a public attribute, and itsrepr()shows only the address.
- Client-side spend limits protect against a server requesting an unexpectedly large amount (see Breaking below).
Breaking and changed
x402-avm-js 0.4.0- Default spend cap.
payForRequirementandbuildExactAvmGrouprefuse any payment above 1,000,000 base units (1 ALGO, or 1 USDC) with aSpendLimitExceededError, before anything is signed. To pay more, pass the new options argument, for examplepayForRequirement(challenge, address, algod, signer, { maxAmount: 5_000_000n });maxAmount: Infinityremoves the cap. - Node.js 18 is no longer supported; the package requires Node.js 20 or later.
- Types:
extraandextensionsvalues areunknowninstead ofany;selectRequirement,encodePaymentHeaderandpayForRequirementtakePaymentRequiredinstead ofPaymentRequired | any. decodePaymentRequiredvalidates the decoded shape and throwsInvalidPaymentRequiredError(it used to return whatever JSON it found).src/is published in the package, so source maps and go-to-definition resolve.
PaymentGate.wrap()withouttransport=still serves SSE but emits aFutureWarning; the default will change to"streamable-http"in a future release.- The SSE compatibility patch (stateless MCP sessions, so raw JSON-RPC clients can call tools without the
initializehandshake) is applied only for the SSE transport. Correction to the 0.4.0 entry “Removed monkeypatches”: this FastMCP patch was still present in 0.4.0 and 0.4.1. - Potentially breaking:
AIEconomySDK.add_tool()decides once, from the pricing function’s signature, whether to call it as(args, sender)or(args); a function accepting neither raisesConfigurationErrorat registration (0.4.x failed per request). - Potentially breaking:
ChainReaderandPaymentGatecatch only lookup errors (algod/indexer HTTP errors, connection errors, malformed responses), log them and report no usage, subscription or pass, as before. Other exceptions now propagate. - Potentially breaking:
DefaultAvmSigner.private_keyis a read-only property; assigning to it raisesAttributeError. - On the SSE transport the
POSTresponse is the server’s own response plus settlement headers. - Signing uses
AccountTransactionSignerinstead of the deprecatedTransaction.sign(). - Requires
x402-algorand>=0.2.1.
- Errors for unsupported or unregistered networks are
NetworkError, for an algod on the wrong networkNetworkMismatchError, and for undecodable transactionsTransactionDecodeError. All are subclasses ofValueError, as before. - The facilitator checks every transaction sent by one of its own addresses (not only the first), and signs all of the advertised
feePayer’s transactions, as the specification requires. - Fee payer signing, simulation and settlement failures are also logged to the
x402_algorandlogger; the returnedinvalid_reason/error_reasoncodes are unchanged. settle()returns the ID ofpaymentGroup[paymentIndex]as the transaction, as required by the specification; with a fee payer it previously returned the ID of the fee payer transaction.- The V1 facilitator and client wrappers accept the official SDK’s
PaymentPayloadV1/PaymentRequirementsV1models and returnVerifyResponse/SettleResponse, so V1 payments routed throughx402Facilitator/x402Clientwork. Requirements withoutextrano longer fail validation. - Ed25519 signature verification of a payment from a rekeyed account uses the auth address. A rekey pair is only accepted when the second rekey returns authority to the sender.
pynaclis a declared dependency (it was already required throughpy-algorand-sdk).
Added
ai-economy-sdk 0.5.0- Streamable HTTP support:
PaymentGate.wrap(mcp, transport="streamable-http")(alias"http") serves the MCP Streamable HTTP transport atPOST /mcp, stateless by default (stateless_http=Falseenables MCP sessions).wrap()also acceptspath=and otherFastMCP.http_app()keyword arguments.AIEconomySDK.build_app(transport=...)forwards to it. paid_mcp_session(..., transport=...)connects over Streamable HTTP or SSE. Withouttransport=, URLs whose path ends in/mcpuse Streamable HTTP and all others use SSE.- Exception hierarchy, exported from the package:
AIEconomyError,ConfigurationError(aValueError),UnknownNetworkError,AlgodClientRequiredError(also aRuntimeError),PaymentVerificationError(aRuntimeError),PaymentRequiredErrorandSettlementError(FastMCPToolErrors). Each also subclasses the type raised at the same place in 0.4.x. See Errors and error codes. - Typing module
ai_economy_sdk.types(ServerSigner,ChainLookup,Prices,GatePriceFunction,ToolPriceFunction,SpendControlsArg,Transport), and apy.typedmarker. ai_economy_sdk.__version__.SettleOnSuccessMiddlewareis exported for apps that build the FastMCP HTTP app themselves.- Logging to the
ai_economy_sdklogger: refused calls, settlement failures, expired reservations and failed chain lookups atWARNING. - Python 3.14 support.
- Ready-made signers:
PayerAvmSigner(client side) andServerAvmSigner(facilitator side: fee payer signing, simulate, send, confirm; also usable as a client signer), built withfrom_private_key(...)orfrom_mnemonic(...).ServerAvmSigneraccepts several keys, analgod_clientoralgod_url/algod_token, and checks that algod is on the requested network. Keys are never included inrepr(), error messages or logs. - Exception hierarchy in
x402_algorand.errors, exported fromx402_algorand:X402AlgorandError,NetworkError,NetworkMismatchError,TransactionDecodeError,SigningError,SimulationError. - Payments authorized by a k-of-n multisig, a logic signature, or the auth address of a rekeyed account are accepted, as allowed by the exact scheme specification.
x402_algorand.__version__, apy.typedmarker, and Python 3.14 support.
- Spend controls:
maxAmount(per payment, or per asset),allowedAssets,allowedNetworks,allowedPayTo; exportedSpendControls,DEFAULT_MAX_AMOUNT,checkSpendControls. See Guardrails. - Typed errors, all extending
X402AvmErrorwith a stablecode:SpendLimitExceededError,PaymentNotAllowedError,InvalidPaymentRequiredError,NoSupportedRequirementError,NetworkMismatchError,UnknownNetworkError,InvalidOptionsError. parsePaymentRequired(value: unknown)for validating untrusted input.buildExactAvmGrouprejects requirements whoseextra.genesisHashorextra.genesisIddisagrees with the algod parameters, and malformedpayTo,feePayer,amountandassetvalues.
Deprecated
ai-economy-sdk 0.5.0sign_identity()(legacyx-sender-*headers): usesign_identity_txn(), which binds the proof to one network. It still works and emits aDeprecationWarning; servers keep accepting legacy headers, andpaid_mcp_sessionstill sends them.- Reading
DefaultAvmSigner.private_keyemits aDeprecationWarning. Keep your own reference to the key.
Fixed
ai-economy-sdk 0.5.0- A
TypeErrorraised inside a two-argument pricing function was caught and the function was called again with one argument.
ai-economy-sdk 0.4.1
- Project URLs (
Homepage,Documentation,Repository,Issues,Changelog) and PyPI classifiers inpyproject.toml. - Dependency ranges kept at
fastmcp>=3.4,<4andmcp>=1.29,<2:mcp2.x andfastmcp4.x are excluded because of upstreamhttpxchanges that affectx402compatibility.
x402-algorand 0.2.1
- Project URLs (
Homepage,Documentation,Issues,Changelog) and classifiers (Python 3.10–3.13,Typing :: Typed,Development Status :: 4 - Beta) inpyproject.toml.
x402-avm-js 0.3.1
- Package metadata: repository, homepage, bugs URL, keywords and author.
- The timestamp helper
getNs()readsglobalThis.processsafely, so it works in browser, edge and Node.js environments.
PythonJavaScriptLicensing
ai-economy-sdk 0.4.0, x402-algorand 0.2.0, x402-avm-js 0.3.0, and earlier 0.2/0.3 releases
x402-algorand 0.2.0
Changed- x402-algorand is now a plugin for the official
x402Python SDK (x402>=2.28,<3, github.com/x402-foundation/x402). It ships only the Algorand exact scheme, under the import namex402_algorand(wasx402.mechanisms.avminside a fork of the whole SDK). - Network ids follow the Algorand CAIP-2 profile:
algorand:plus the first 32 characters of the URL-safe base64 genesis hash (MainNetalgorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k, TestNetalgorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDe). Legacy long ids are accepted and converted. - The facilitator checks the network by the id derived from each transaction’s genesis hash, so LocalNet and private networks need no registry entry.
caip2_from_genesis_hash,register_networkandget_genesis_hashhelpers.- The client scheme implements
find_default_asset, so the officialx402Clientspend controls pay ALGO and USDC by default (capped at 1,000,000 base units per payment); other assets are allowed withx402Client.set_spend_controls(...). - The client refuses to build a payment when its algod is on a different network than the requirement.
- The bundled copy of the x402 core SDK (
x402/); install the officialx402package instead.
ai-economy-sdk 0.4.0
Added- Integration with the official
x402>=2.28framework and thex402-algorand>=0.2.0plugin. spend_controlsparameter ofpaid_mcp_session(dict | Literal[False] | None = None), to enforce per-payment caps or allow custom ASAs before signing.- NumPy-style docstrings across the public API (
PaymentGate,paid_mcp_session,ChainReader,DefaultAvmSigner).
- Monkeypatches removed in favour of the native
find_default_assetand spend control filtering provided byx402-algorand. - Network ids follow the Algorand CAIP-2 profile (first 32 characters of the URL-safe base64 genesis hash).
x402-avm-js 0.3.0
Added- CAIP-2 short network ids (
algorand:plus 32 characters), with fallback for legacy 44-character ids. - Compatibility with the official
x4022.28 protocol and thex402_algorandplugin. - Native ALGO (asset 0) and ASAs, including Circle USDC.
- Fee sponsorship through
feePayertwo-transaction atomic groups. - Identity proofs with
buildIdentityTxnandencodeIdentityHeader(X-Identity-Txn). - A self-contained test suite that funds LocalNet accounts from the KMD dispenser and creates its own test ASAs.
ai-economy-sdk 0.3.1
- Added vendor passes:
ChainReader.active_passes(),ChainReader.has_pass()andPaymentGate(pass_scopes=..., pass_days=...). - The MIT
LICENSEfile ships in the package. - Requires
x402-algorand>=0.1.4.
ai-economy-sdk 0.3.0
- Multi-network resolution:
PaymentGate,AIEconomySDKandpaid_mcp_sessionaccept"mainnet","testnet","localnet"and CAIP-2 ids. - New network utilities:
resolve_network,endpoints_for,is_publicandusdc_asset_id. - Identity proofs for browser wallets:
make_identity_txn,sign_identity_txnandverify_identity_txn, producing zero-feeX-Identity-Txnproofs. - Subscription issuer enforcement:
PaymentGate(subscription_issuer=...)andhas_active_subscription(issuer=...). paid_mcp_sessionresolves algod endpoints from the network (AlgoNode for MainNet and TestNet).- The 2,000 microALGO fee floor applies only to native ALGO prices.
x402-algorand 0.1.4
- Licensed Apache-2.0 like the projects it derives from (GoPlausible/x402-avm, coinbase/x402). Ships
LICENSEandNOTICE, and each file changed from x402-avm 2.0.2 says so. Releases 0.1.0 to 0.1.3 were labelled MIT by mistake.
x402-algorand 0.1.3
- Package metadata update (README as the PyPI description). Network ids were still the long form
algorand:<full genesis hash>.
x402-avm-js 0.2.1
- The MIT
LICENSEfile is included in the published npm package.
x402-avm-js 0.2.0
- No Node
Bufferdependency: runs in browsers, workers and edge runtimes without polyfills. - Network presets and helpers:
MAINNET,TESTNET,LOCALNET_ENDPOINTS,resolveNetwork,networkFromAlgod,networkFromGenesisHash,algodClientandselectRequirement. payForRequirementchecks that the algod’s network matches the server’s offers and throws when none matches.- Read-only
PUBLIC_NETS=1tests on MainNet and TestNet. - Published package manifest with an
exportsmap, types, and build and tests inprepublishOnly.
ai-economy-sdk 0.2.0
- Settle-on-success:
PaymentGateverifies payments before the tool runs and settles only after the tool succeeds. - Replay protection:
ReplayStore, in memory or SQLite in WAL mode for several processes. - Fee floor: ALGO prices at or below 2,000 microALGO are rejected at start-up unless
allow_loss=True. - Caller identity:
sign_identityandverify_identity.
x402-avm-js 0.1.0
- First implementation of the Algorand exact-scheme client: parse
PAYMENT-REQUIRED, build the transaction group, sign through a wallet callback and encodePAYMENT-SIGNATURE.