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).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"endpoint": "<endpoint>",
"max_pay_usdc": "<max_pay_usdc>"
},
"name": "call_agent_with_payment"
}
}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). |