Skip to main content

Prerequisites

  • Node.js 18+ or Python 3.9+
  • An AgentWallex API key (awx_...) — sign up for early access
  • Basic understanding of blockchain transactions

Installation

npm install @agentwallex/sdk

Step-by-Step Integration

1

Initialize the client

Create an AgentWallex client with your API key. Use sandbox for testing and production for mainnet.
import { AgentWallex } from "@agentwallex/sdk";

const aw = new AgentWallex({
  apiKey: process.env.AGENTWALLEX_API_KEY!,
  environment: "sandbox", // use "production" for mainnet
});
2

Create an agent wallet

Each agent gets its own MPC-secured wallet with configurable policies.
const agent = await aw.agents.create({
  name: "my-trading-agent",
  chain: "eip155:84532",
  policies: {
    maxTransactionAmount: "100",   // USDC
    dailyLimit: "1000",
    allowedAddresses: ["0x..."],
  },
});

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

Fund the wallet

Send testnet tokens to your agent’s wallet address. On Base Sepolia, you can use a faucet to get test USDC.
In sandbox mode, your agent wallet is on a testnet. No real funds are at risk.
4

Send a payment

Execute an on-chain payment through the agent.
const tx = await aw.payments.send({
  agentId: agent.id,
  to: "0xRecipientAddress",
  amount: "10.00",
  token: "USDC",
});

console.log(`Transaction hash: ${tx.hash}`);
console.log(`Status: ${tx.status}`); // "confirmed"

What Happens Under the Hood

  1. Policy Check — The policy engine validates the transaction against your agent’s rules (spending limits, address whitelist, velocity controls).
  2. MPC Signing — The transaction is signed using 2-of-3 threshold MPC. No single party ever holds the full key.
  3. Broadcast — The signed transaction is submitted to the network.
  4. Confirmation — AgentWallex monitors and confirms the transaction, then delivers a webhook event.

Next Steps

TypeScript SDK

Full SDK reference with all methods and types.

REST API

HTTP endpoints for custom integrations.

x402 Micropayments

Enable pay-per-API-call for your agents.

Policy Engine

Configure spending controls and security rules.