Documentation Index
Fetch the complete documentation index at: https://docs.useanima.sh/llms.txt
Use this file to discover all available pages before exploring further.
Agent Wallet
The Anima Agent Wallet gives each agent a dedicated balance with configurable spending guards and native support for the x402 payment protocol. Agents can transact autonomously within the boundaries you define, and any payment above your approval threshold is routed for human review before it clears.
Create a wallet
Provide an agentId, a currency, and an initial set of budget guards.
Tab Title
Tab Title
Tab Title
import { Anima } from "@anima-labs/sdk";
const anima = new Anima({ apiKey: "ak_..." });
const wallet = await anima.wallet.create({
agentId: "ag_8f3k2m9x1n4p7q6r",
currency: "usd",
budgetGuards: {
dailyLimitCents: 50000, // $500.00
monthlyLimitCents: 500000, // $5,000.00
perTransactionLimitCents: 10000, // $100.00
requireApprovalAboveCents: 5000, // $50.00
},
});
console.log(`Wallet: ${wallet.id}, Balance: ${wallet.balanceCents}`);
from anima import Anima
anima = Anima(api_key="ak_...")
wallet = anima.wallet.create(
agent_id="ag_8f3k2m9x1n4p7q6r",
currency="usd",
budget_guards={
"daily_limit_cents": 50000,
"monthly_limit_cents": 500000,
"per_transaction_limit_cents": 10000,
"require_approval_above_cents": 5000,
},
)
print(f"Wallet: {wallet.id}, Balance: {wallet.balance_cents}")
import "github.com/anima-labs/anima-go"
client := anima.NewClient("ak_...")
wallet, err := client.Wallet.Create(ctx, &anima.CreateWalletParams{
AgentID: "ag_8f3k2m9x1n4p7q6r",
Currency: "usd",
BudgetGuards: &anima.BudgetGuards{
DailyLimitCents: 50000,
MonthlyLimitCents: 500000,
PerTransactionLimitCents: 10000,
},
})
Budget guards
Budget guards enforce spending policy at the wallet level. When a payment would exceed a guard threshold, it is either declined automatically or held for human approval.
| Guard | Type | Description |
|---|
dailyLimitCents | number | Maximum total spend per calendar day |
monthlyLimitCents | number | Maximum total spend per calendar month |
perTransactionLimitCents | number | Maximum amount for a single transaction |
requireApprovalAboveCents | number | Transactions above this amount require human approval before clearing |
allowedMerchantCategories | string[] | Restrict payments to specific MCC codes; all others are blocked |
blockedMerchantCategories | string[] | Block payments to specific MCC codes regardless of other limits |
Update budget guards
Update one or more guards on an existing wallet at any time.
Tab Title
Tab Title
Tab Title
await anima.wallet.updateBudgetGuards("wlt_abc123", {
dailyLimitCents: 100000,
requireApprovalAboveCents: 20000,
});
anima.wallet.update_budget_guards(
"wlt_abc123",
{
"daily_limit_cents": 100000,
"require_approval_above_cents": 20000,
},
)
err := client.Wallet.UpdateBudgetGuards(ctx, "wlt_abc123", &anima.BudgetGuards{
DailyLimitCents: 100000,
RequireApprovalAboveCents: 20000,
})
x402 payments
Anima wallets natively support the x402 payment protocol, which lets agents pay for HTTP resources by including payment headers in the request. Use payAndFetch to make a request to a paid API endpoint — Anima handles the payment negotiation automatically.
const response = await anima.wallet.payAndFetch({
walletId: "wlt_abc123",
url: "https://data-provider.example/api/report",
maxPaymentCents: 500,
});
console.log(`Paid: ${response.paymentCents} cents`);
console.log(`Data: ${response.body}`);
response = anima.wallet.pay_and_fetch(
wallet_id="wlt_abc123",
url="https://data-provider.example/api/report",
max_payment_cents=500,
)
print(f"Paid: {response.payment_cents} cents")
print(f"Data: {response.body}")
maxPaymentCents sets a ceiling on what your agent will pay for the resource. If the provider requests more, the transaction is declined and payAndFetch raises an error.
Check balance and transactions
Tab Title
Tab Title
Tab Title
// Check current balance
const balance = await anima.wallet.getBalance("wlt_abc123");
console.log(`Available: $${(balance.availableCents / 100).toFixed(2)}`);
console.log(`Spent today: $${(balance.spentTodayCents / 100).toFixed(2)}`);
// List recent transactions
const txns = await anima.wallet.listTransactions("wlt_abc123", {
limit: 20,
startDate: "2026-03-01",
});
# Check current balance
balance = anima.wallet.get_balance("wlt_abc123")
print(f"Available: ${balance.available_cents / 100:.2f}")
print(f"Spent today: ${balance.spent_today_cents / 100:.2f}")
# List recent transactions
txns = anima.wallet.list_transactions(
"wlt_abc123",
limit=20,
start_date="2026-03-01",
)
balance, err := client.Wallet.GetBalance(ctx, "wlt_abc123")
fmt.Printf("Available: $%.2f\n", float64(balance.AvailableCents)/100)
fmt.Printf("Spent today: $%.2f\n", float64(balance.SpentTodayCents)/100)
Next steps