Autonomous Agents: Wallet Identity + Credits
AgentPMT lets autonomous agents buy Agent Credits (100 credits = $1) and invoke marketplace tools and workflows over HTTP. Identity is a wallet signature (no API keys).
For the full endpoint docs and code samples, see /external-agent-api.
1) Identity: A Wallet Address + Signatures
Your agent is identified by an EVM wallet address. To check balances, invoke tools, or fetch and run workflows, your agent signs standardized messages (EIP-191 personal-sign). Credits are attached to that wallet address.
2) If Your Agent Doesn't Have a Wallet: Use AgentAddress
If your agent runtime doesn't already have a wallet, generate one with AgentAddress. AgentAddress runs locally in your browser and produces an address + secret key + recovery phrase.
Operational guidance
- Treat the AgentAddress secret key like a real wallet secret. If someone gets it, they can spend that wallet's credits.
- If you want strong guardrails, keep the agent wallet empty of on-chain funds and fund it with credits only (see sponsored top-ups below).
3) Buying Credits (Two Patterns)
Purchase API supports three flow variants: x402direct (body-based two-step, recommended), x402 v2 header handshake (PAYMENT-REQUIRED/PAYMENT-SIGNATURE), and x402 self-broadcast (submit transaction_hash).
Pattern A: Agent Pays and Credits Itself (Fully Autonomous)
Use this when your agent wallet holds USDC and is allowed to purchase credits directly. This is the simplest flow.
# Option A1: x402direct (recommended, server broadcasts after authorization)
curl -s -X POST "https://www.agentpmt.com/api/external/credits/purchase" \
-H "Content-Type: application/json" \
-d '{ "wallet_address":"0xAGENT_WALLET", "credits": 500, "payment_method":"x402direct" }'
# Then submit authorization in a second call.
# Option A2: x402 v2 header handshake
# Step 1 -> read PAYMENT-REQUIRED, Step 2 -> send PAYMENT-SIGNATURE (base64 JSON).
curl -i -s -X POST "https://www.agentpmt.com/api/external/credits/purchase" \
-H "Content-Type: application/json" \
-d '{ "wallet_address":"0xAGENT_WALLET", "credits": 500, "payment_method":"x402" }'
# Option A3: x402 self-broadcast proof (you submit tx hash after broadcasting on-chain)
curl -s -X POST "https://www.agentpmt.com/api/external/credits/purchase" \
-H "Content-Type: application/json" \
-d '{ "wallet_address":"0xAGENT_WALLET", "credits": 500, "payment_method":"x402", "transaction_hash":"0xYOUR_TX_HASH" }'Pattern B: Human Sponsors Credits to the Agent Wallet (Recommended Guardrails)
Use this when a human wants to pay from their own wallet, but give the agent only a capped amount of spend power via credits (without sharing the human wallet key).
In this model:
- The agent has its own wallet (for identity and signing requests).
- The human pays USDC from a different wallet.
- The human includes a sponsor signature authorizing which agent wallet should receive the credits for that payment.
Human does
- sign an EIP-3009 USDC authorization (x402direct)
- sign the sponsor message that names the agent wallet
Agent does
- POST the signed payloads to buy credits to its own wallet
- use those credits autonomously via signed tool/workflow calls
# Human sponsors credits to an agent wallet using x402direct
# (The payment authorization "from" is the human wallet; credits are granted to wallet_address.)
curl -s -X POST "https://www.agentpmt.com/api/external/credits/purchase" \
-H "Content-Type: application/json" \
-d '{
"wallet_address":"0xAGENT_WALLET",
"credits": 500,
"payment_method":"x402direct",
"payer_wallet_address":"0xHUMAN_WALLET",
"sponsor_signature":"0x<signature-by-human-wallet>",
"authorization": {
"from":"0xHUMAN_WALLET",
"to":"0xUSER_CREDIT_WALLET",
"value":"5000000",
"valid_after":"0",
"valid_before":"1700000000",
"nonce":"0x<32-bytes>",
"signature":"0x<65-bytes>"
}
}'
# sponsor_signature signs this exact message (EIP-191 personal-sign):
agentpmt-external-sponsor
payer:0xhuman_wallet_lower...
recipient:0xagent_wallet_lower...
credits:500
nonce:0x<same-nonce-as-authorization>If sponsored purchase uses self-broadcast transaction-hash mode instead of authorization mode, the sponsor signature reference line becomes tx:0xYOUR_TX_HASH instead of nonce:....
4) Running Tools and Workflows Autonomously
Once the agent wallet has credits, the agent can:
- create a session nonce
- check credit balance
- list and invoke tools
- list, fetch, and run workflows with wallet-based session tracking
Quick links
- External API docs: /external-agent-api
- Generate an agent wallet: /agentaddress
- Browse tools: /marketplace
- Browse workflows: /agent-workflow-skills
Notes
- Credits are only charged for successful tool calls (failed calls are refunded).
- Credits expire 12 months after purchase.
- Always call the Next.js API routes (
/api/external/...), not the backend container directly.