Skip to main content

Installation

Client Initialization

Agents

aw.agents.create(params)

Create a new agent with an MPC-secured wallet.
Returns:

aw.agents.get(agentId)

Retrieve an agent by ID.

aw.agents.list(params?)

List all agents for your account.

aw.agents.freeze(agentId)

Immediately freeze an agent’s wallet, preventing all transactions.

aw.agents.unfreeze(agentId)

Re-enable an agent’s wallet after a freeze (subject to 10-minute cool-down).

Payments

aw.payments.send(params)

Send a direct on-chain payment.
Returns:

aw.payments.get(transactionId)

Get transaction details and status.

aw.payments.list(params)

List transactions for an agent.

x402 Micropayments

aw.x402.createSession(params)

Create an x402 payment session with a spending budget.

aw.x402.check(params)

Check whether a target URL supports x402 payment negotiation.

aw.x402.pay(params)

Negotiate and complete one x402 payment.

aw.x402.sessionPay(sessionId, params)

Pay using an existing session budget.

aw.x402.httpInterceptor(params)

Create an HTTP fetch wrapper that automatically handles x402 v2 challenges:
The interceptor:
  1. Reads the PAYMENT-REQUIRED header from a 402 response
  2. Submits payment via AgentWallex
  3. Retries the request with the PAYMENT-SIGNATURE header

Policies

aw.policies.update(agentId, policies)

Update an agent’s spending policies.

aw.policies.get(agentId)

Get current policies for an agent.

aw.policies.applyTemplate(agentId, templateName)

Apply a policy template to an agent.

aw.policies.createTemplate(name, rules)

Create a reusable policy template.

Webhooks

aw.webhooks.create(params)

Register a webhook endpoint.

Error Handling

The SDK provides typed error classes:

TypeScript Types

All types are exported from the package: