Skip to main content

Create an Agent Wallet

Every agent gets its own MPC-secured wallet. Specify the chain and initial policies at creation time.
const agent = await aw.agents.create({
  name: "payment-agent",
  chain: "eip155:8453",  // Base mainnet
  policies: {
    maxTransactionAmount: "500",
    dailyLimit: "5000",
    allowedTokens: ["USDC"],
  },
  metadata: { team: "growth" },
});

console.log(`Agent ID: ${agent.id}`);
console.log(`Wallet address: ${agent.wallet.address}`);
console.log(`Chain: ${agent.wallet.chain}`);

Fund the Wallet

Send tokens to the agent’s wallet address. The wallet address is a standard on-chain address that can receive tokens from any source.
In sandbox mode (eip155:84532), use a testnet faucet to get test tokens. No real funds are needed.
For x402 operations, you can also deposit via the balance endpoint:
curl -X POST https://api.agentwallex.com/api/v1/x402/balances/deposit-address \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "agent_abc123", "chain": "eip155:8453"}'

Send a Payment

Execute an on-chain payment through the agent. The transaction passes through the policy engine and MPC signing before broadcast.
const tx = await aw.payments.send({
  agentId: "agent_abc123",
  to: "0xRecipientAddress",
  amount: "50.00",
  token: "USDC",
  memo: "Payment for API access",
});

console.log(`Transaction ID: ${tx.id}`);
console.log(`Hash: ${tx.hash}`);
console.log(`Status: ${tx.status}`);   // "pending" -> "confirmed"
console.log(`Fee: ${tx.fee}`);         // Network gas fee

Check Balance

Query the x402 balance for an agent:
curl -X GET https://api.agentwallex.com/api/v1/x402/balances \
  -H "X-API-Key: awx_your_api_key"

List Transactions

View transaction history for an agent:
const { transactions } = await aw.payments.list({
  agentId: "agent_abc123",
  limit: 50,
  status: "confirmed",
});

transactions.forEach(tx => {
  console.log(`${tx.amount} ${tx.token} -> ${tx.to} (${tx.status})`);
});

Freeze and Unfreeze

Instantly stop all transactions for an agent. Useful for emergencies or scheduled maintenance.

Freeze

await aw.agents.freeze("agent_abc123");
// All transactions are now blocked

Unfreeze

// Subject to 10-minute cool-down after freeze
await aw.agents.unfreeze("agent_abc123");
There is a mandatory 10-minute cool-down period after freezing before you can unfreeze. Attempting to unfreeze earlier will return an error.

Delete an Agent

Permanently delete an agent and its wallet. This action is irreversible.
curl -X DELETE https://api.agentwallex.com/api/v1/agents/agent_abc123 \
  -H "X-API-Key: awx_your_api_key"
Ensure the wallet balance is zero before deleting. Any remaining funds will be inaccessible after deletion.