An AI agent has already decided that a data response is worth buying. Its budget policy approves the price, and the service returns three acceptable payment options: USDC on one network, USDT on another, or USDC on a third.
The choice still is not obvious. One wallet balance would fall below its operating reserve. Another route has no native gas, although its payment method supports sponsorship. A third requires a bridge whose expected completion time exceeds the payment window.
This is the real runtime problem in cross-chain payments for AI agents. “Pay” is a commercial decision. “Use this network, asset, and settlement path” is an execution decision that should be made only after checking fresh terms, live inventory, policy, cost, timing, and failure state.
The correct objective is not the cheapest quoted transaction. It is the lowest-cost route that can still produce accepted payment evidence and service delivery within the agent’s constraints.
The Payment Decision and the Route Decision Are Separate
A purchase policy answers questions such as:
Is this resource worth its price?
Is the merchant or service allowed?
Does the task budget cover the charge?
Does this risk level require human or higher-tier approval?
A route selector starts after those questions have been answered. Its output should be a bounded execution plan:
That separation matters because route conditions change faster than purchase intent. A payment approved 20 seconds ago may now face a stale bridge quote, depleted gas balance, unhealthy RPC, changed merchant challenge, or another worker reserving the same funds.
Approval should therefore authorize a maximum commercial intent, not freeze a network choice too early. The final chain and asset selection should happen immediately before signing, and it must remain inside the original budget, merchant, resource, and risk boundaries.
An Accepted Option Is a Destination, Not an Executable Route
In x402 v2, a payment-required response can include an accepts[] array. Each entry identifies an acceptable payment method through fields such as:
schemenetworkamountassetpayTomaxTimeoutSeconds
The network uses a chain-agnostic identifier, while the asset is bound to a token address or another scheme-defined identifier. The amount is expressed in the asset’s atomic units. Together, those fields define what the resource server will accept.
They do not describe the payer’s complete route. The requirement does not say where the agent currently holds funds, whether its signer supports that network, whether it has gas, whether a bridge is healthy, or whether spending that balance would violate a reserve policy.
That makes accepts[] an acceptance interface, not a universal routing algorithm. The agent still has to connect its current state to one accepted destination.
This distinction also prevents a common architecture mistake: assuming that multi-network acceptance means the payer must bridge. If the merchant accepts a direct transfer on the network where the agent already holds the required asset, the payer’s route is single-chain even if the merchant later consolidates funds elsewhere.
Build Routes From Live Wallet State
Represent wallet inventory as network-specific positions rather than one total portfolio balance:
Then expand each accepted destination into possible paths. A practical route graph usually contains five shapes:
Route shape | What the agent does | Main tradeoff |
|---|---|---|
Direct | Pays with an accepted asset already held on the accepted network | Fewest moving parts, but may deplete a strategic balance |
Same-chain swap | Swaps another asset into the accepted asset, then pays | Avoids bridging, but adds price impact, approval, and swap failure |
Bridge then pay | Moves an asset to the accepted network, then pays | Reaches fragmented liquidity, but adds another settlement domain and delay |
Swap plus bridge | Converts and moves value before payment | Broadest reach, highest execution and recovery complexity |
Source-chain acceptance | Pays on a network accepted by a merchant or payment service that handles downstream routing | Keeps the bridge outside the payer’s critical path, but depends on the provider’s terms and verification flow |
Graph nodes should be exact asset positions. Edges should be executable actions with current quotes, expiry, fees, estimated completion time, and failure semantics. A route is valid only if every edge is valid in sequence.
Do not count funds twice. If two concurrent agent tasks can draw from the same USDC position, the router needs reservations or atomic budget accounting before either task signs. An RPC balance is an observation; spendable inventory is the observed balance minus pending transfers, gas reserve, policy reserve, and other committed work.
Eliminate Impossible Routes Before Comparing Cost
Cost ranking is meaningless until hard constraints have removed routes that cannot complete safely. At minimum, test the following in order.
Merchant-term integrity. The requirement must still match the resource, amount, network, asset, recipient, scheme, and expiry that the purchase policy approved. A cached catalog price cannot override a fresh payment challenge.
Execution support. The wallet, signer, client library, and facilitator or merchant path must support the exact network and payment scheme. “EVM compatible” is not proof that every token, signature method, or facilitator deployment is supported.
Policy eligibility. The network, recipient, asset, route class, bridge, DEX, and maximum loss must all be allowed. Automatic execution does not grant an agent permission to relax a network allowlist or spending limit when the preferred route fails.
Spendable inventory. Verify the token amount after reservations and reserve floors. Then verify how transaction fees are paid. Some x402 EVM mechanisms can use facilitator-sponsored gas; a direct ERC-20 transfer from the agent wallet normally needs an executable source-chain fee path. Gas responsibility is route-specific.
Path liquidity and health. A swap or bridge edge needs a fresh quote, sufficient liquidity, a valid destination, and operational endpoints. A theoretical route is not executable merely because a bridge contract exists.
Deadline fit. The route’s conservative completion estimate must fit inside the shortest applicable timeout: the payment requirement, quote validity, task deadline, and any merchant order expiry.
Only routes that pass every hard test should enter the cost comparison. If none pass, the safe output is NO_ELIGIBLE_PAYMENT_ROUTE, not an improvised payment.
Compare Landed Cost, Not Gas Alone
Network gas is only one term in the amount the agent must spend to obtain the resource. Normalize candidate routes into one policy reference unit and estimate:
The treasury-depletion term is not necessarily a fee. It represents the operational cost of pushing a useful balance below its target. Spending the last USDC on a low-fee network may force an expensive emergency rebalance before the next task.
Stablecoin labels also require a live valuation policy. One USDC and one USDT may often target similar dollar value, but a router should not hard-code permanent parity. Use bounded price inputs, reject stale valuations, and define what happens when a stablecoin moves outside the permitted range.
Avoid false precision in a single weighted score. A more defensible ordering is lexicographic:
satisfy merchant and policy constraints;
meet the deadline with a safety margin;
prefer higher observed route reliability;
minimize landed cost within that reliable set;
preserve treasury balance targets when costs are close.
This ordering stops a fractionally cheaper but unreliable bridge from defeating a direct route that is more likely to deliver the paid resource.
Treat the Timeout as a Path Budget
“Settlement time” is not one clock. A direct payment can involve authorization, submission, network inclusion, required confirmation, payment verification, and merchant acceptance. A bridged route may add source finality, message or liquidity relay, destination execution, and another confirmation policy before the payment itself begins.
Compute an available path budget:
Then compare that budget with a conservative route estimate, not the best observed block time. Use recent p95 or another policy-selected tail measure for each edge. Include RPC and verifier health because a transaction that confirms onchain but cannot be recognized by the merchant before expiry may still fail the commercial workflow.
This produces a useful boundary: bridging in the payment critical path is appropriate only when the entire route can finish with adequate margin. For frequent purchases, slow rebalancing is usually better performed before demand arrives.
Bind Assets by Chain, Contract, and Decimals
The string USDT is not a complete payment asset. A safe route binds at least:
Without that tuple, an agent can select the wrong contract, calculate the wrong atomic amount, or sign for an asset that the verifier does not recognize. Token symbols can be duplicated, and decimal conventions can differ across deployments.
A current GOAT AgentKit giftcard flow makes the problem concrete: its documented BSC USDT route uses 18 decimals, while the other listed stablecoin routes use six. The integration therefore exposes runtime token discovery as the authoritative source for per-chain token addresses and decimals.
The general rule is broader than that example. Parse the exact asset from the merchant’s fresh requirement, validate it against a trusted registry or policy allowlist, resolve decimals from trusted metadata or the token contract when necessary, and keep all arithmetic in integers. Convert to a display currency only for policy comparison and reporting.
Negotiate Preferences Without Rewriting Merchant Terms
When a merchant supports many networks, it can reduce failed attempts by learning what the payer can use. This can happen through an application-layer capability exchange before the final payment requirement.
For example, an agent might disclose only bounded capabilities:
This object is an application design pattern, not a field mandated by the x402 core protocol. It should not expose wallet balances or the agent’s full portfolio.
The merchant can use those capabilities to return a smaller acceptance set, but the fresh challenge remains authoritative. The agent must not substitute its preferred recipient, token contract, amount, or network after the merchant has issued the requirement. Preference negotiation narrows valid choices; it does not rewrite payment terms.
Run a Deterministic Selector Immediately Before Signing
The route-selection loop should be deterministic enough to replay in an audit and narrow enough that a language model cannot invent a payment path.
The reservation step belongs before signing. It should bind the logical purchase ID, selected requirement, route attempt ID, amount ceiling, policy version, and expiry. If the reservation fails because another worker consumed the balance or budget, rebuild the route set from fresh state.
Do not automatically retry every failed action. A quote read can be retried. A transfer with an unknown broadcast result requires reconciliation. A confirmed payment followed by a lost HTTP response should reuse payment evidence, not generate another payment.
Worked Example: Three Options, One Valid Attempt
Assume a merchant advertises three payment options for the same resource. The following values are illustrative, not live network measurements.
Candidate route | Wallet and path state | Extra landed cost | Conservative completion | Eligibility |
|---|---|---|---|---|
A: direct USDC on Network A | Sufficient nominal balance, but payment would leave the wallet $0.01 below its required operating reserve | $0.06 | 9 seconds | Reject: reserve policy |
B: direct USDT on Network B | Sufficient balance, no native gas, but the advertised payment mechanism supports approved sponsorship | $0.02 | 12 seconds | Select |
C1: direct USDC on Network C | Sufficient token and gas inventory | $0.05 | 18 seconds | Eligible fallback |
C2: bridge USDC from Network D, then pay on C | Bridge is operational, but its p95 path estimate is 90 seconds and the payment window is 60 seconds | $0.09 | 90 seconds | Reject: deadline |
Network A is technically capable of broadcasting, yet treasury policy makes it ineligible. The bridge route may show low destination gas, yet it cannot meet the payment window. Network B wins because it is eligible, sponsored under an allowed mechanism, timely, and cheaper than the remaining eligible direct route.
The router can record C1 as a fallback candidate, but it cannot execute C1 merely because B’s RPC times out after submission. First it must determine whether B produced a transaction, whether that transaction was replaced, and whether the merchant or facilitator already recognizes the payment.
Fallback Begins With Reconciliation
Fallback is safe only while the prior attempt is known not to have transferred value. Divide failure states into three classes.
No broadcast occurred. Examples include an expired quote, policy rejection, signer refusal, or deterministic simulation failure. Release the reservation, obtain a fresh payment requirement, and evaluate another eligible route.
Broadcast state is ambiguous. The client has a transaction hash, replacement hash, facilitator reference, or uncertain network response. Mark the attempt RECONCILING. Query the network, wallet nonce, payment service, and merchant order before doing anything else. The x402 v2 settlement_pending state exists for this reason: the transaction may still confirm even when confirmation could not be established immediately.
Payment settled but delivery is missing. Retry the protected request with existing proof, poll the order, or enter the merchant’s refund and exception flow. Do not pay again for the same logical purchase.
Use one stable commerce ID across the purchase and a new route-attempt ID for each execution path:
If the server supports a payment-identifier or equivalent idempotency extension, bind it to the commerce ID. The merchant should also deduplicate fulfillment. Payment idempotency without delivery idempotency can still produce duplicate work; delivery idempotency without payment reconciliation can still produce duplicate charges.
Routing and Treasury Rebalancing Run on Different Clocks
Per-request bridging is often a symptom of poor inventory placement. A high-frequency agent can forecast which networks and assets it uses, maintain bounded target balances, and rebalance during a slower treasury cycle.
Runtime routing then chooses among already funded, merchant-accepted positions. Treasury automation handles:
target balance bands by network and asset;
native gas or sponsorship availability;
scheduled swaps and bridges;
reserve floors and concentration caps;
stale or stranded balances;
reconciliation after rebalancing.
The two systems should exchange state but not authority. A payment router may request a rebalance; it should not silently expand a one-dollar purchase approval into permission for an unconstrained bridge and swap. Rebalancing has its own fees, counterparty assumptions, failure states, and authorization policy.
Payment Infrastructure Should Expose Verifiable Route Inputs
GOAT Network’s current homepage places x402 protocol and cross-chain routing in the same payment pillar. The useful developer interpretation is not “the agent never has to think about networks.” It is that the payment stack should expose enough structured state to make a network choice safely.
Current GOAT Flow documentation treats the x402 challenge or public manifest as the authority for available chain/token options. The buyer chooses an offered combination, while merchant status and payment records provide the backend confirmation path. Current AgentKit documentation adds payer actions, wallet operations, a policy-controlled runtime with idempotency and timeouts, and plugin surfaces for swaps, bridging, and status checks.
Its giftcard flow is a concrete cross-chain example: the agent discovers supported tokens, chooses pay_chain and pay_token when creating the order, broadcasts on the selected source chain, and polls through payment, fulfillment, or refund states. It also checks chain binding, expiry margin, order state, and idempotency before paying.
Those are valuable route inputs and execution controls. They are not proof of a generic optimizer that automatically finds the best path across every network. The documented DEX and bridge actions have specific scopes, and deployment-level chain/token support remains runtime configuration. Developers still need to define the objective function, treasury constraints, data freshness, and fallback policy for their own workload.
One GOAT-specific detail shows why this matters: GOAT Network uses BTC as native gas. For an unsponsored direct wallet transfer on GOAT, holding the accepted stablecoin does not by itself prove that the route is executable; the router must also verify the BTC fee path.
Log the Decision, Not Only the Transaction
A transaction hash explains what was submitted. It does not explain why that route was selected or why alternatives were rejected. Store a decision record containing:
hash or version of the fresh payment requirement;
considered network/asset options;
quote IDs and expiry times;
policy version and authorization reference;
reservation state;
rejection reason codes for alternatives;
selected route and signer capability;
transaction, facilitator, merchant-order, and delivery states;
final landed cost and completion time.
Do not log private keys, signatures before use, authentication headers, or the agent’s entire portfolio. A route decision can record that a balance passed a threshold without exposing the exact balance to every downstream service.
Operational metrics should include no_eligible_route rate, pre-broadcast aborts, ambiguous settlements, fallback attempts, delivered-payment p95, landed-cost error, and balance-fragmentation incidents. These metrics reveal whether routing logic is actually improving delivery rather than merely moving volume to a favored chain.
Production Rule: No Eligible Route, No Signature
A robust selector applies a strict order:
honor the exact merchant requirement;
enforce authorization and route policy;
prove the path is executable from live wallet state;
require adequate deadline and reliability margin;
choose the lowest landed cost that preserves treasury constraints;
reserve once, sign once, and reconcile before fallback.
This makes abstention a valid production result. If every route is stale, underfunded, disallowed, too slow, or operationally uncertain, the agent should return a machine-readable failure and let a funding, approval, or merchant-negotiation workflow resolve it.
Cross-chain reach is useful only when it remains bounded. The safest AI agent cross-chain payments are not the ones that can always find some way to move funds; they are the ones that can explain why one exact route was eligible before value left the wallet.
FAQ
What are cross-chain payments for AI agents?
They are machine-initiated payments in which the payer, merchant, or payment infrastructure can use more than one blockchain network. The agent may pay directly on a merchant-accepted source chain, or it may need a swap or bridge before payment. Those architectures have different cost, latency, and failure boundaries.
How should an AI agent choose a payment network?
First filter for exact merchant acceptance, wallet and signer support, policy permission, spendable balance, gas or sponsorship, infrastructure health, and deadline fit. Then compare reliability, landed cost, and treasury impact among the remaining routes.
Should an agent always choose the network with the lowest gas fee?
No. Low gas can be outweighed by bridge fees, slippage, sponsorship fees, slow verification, poor route health, or the cost of depleting a strategic balance. The relevant measure is the cost of obtaining verified delivery, not one transaction fee.
Does x402 automatically route payments across chains?
The x402 protocol can communicate multiple accepted payment requirements across networks and assets. It does not by itself define a universal bridge, liquidity route, or wallet-specific optimization policy. Cross-chain movement and route selection depend on the client and supporting infrastructure.
Is USDC or USDT better for AI agent cross-chain payments?
Neither is universally better. The router should evaluate the exact chain-specific token contract, decimals, accepted transfer method, live balance, valuation policy, fees, liquidity, and merchant support. A ticker alone is insufficient.
What should happen when the selected payment route times out?
If no transaction was broadcast, the agent can release its reservation and evaluate a fresh route. If broadcast or settlement is uncertain, it must reconcile the transaction and merchant state before attempting another payment. If payment settled but service delivery failed, it should reuse proof or enter the refund workflow rather than pay again.


