call_agent_with_payment
Call an agent endpoint with automatic x402 payment. Handles 402 responses by signing and retrying up to a specified USDC limit.
Instructions
Call an agent HTTP endpoint with automatic x402 payment. Uses Coinbase's official x402-fetch SDK with the EOA wallet from $TEST_WALLET_KEY. If the endpoint returns 402, signs and retries automatically (up to max_pay_usdc).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | Full HTTPS URL. | |
| payload | No | Optional JSON body (omit for GET). | |
| max_pay_usdc | Yes | Max USDC to pay (e.g. 0.10). | |
| chain_id | No | Settlement chain (default 8453). |