WAIaaS SDK: Programmatic Wallet Control in TypeScript and Python

Your AI agent can analyze market data, generate trading strategies, and even write smart contracts. But when it comes time to actually execute a trade or pay for premium API access? It hits a wall. Most AI agents can think about money, but they can't touch it.

This gap between AI decision-making and financial execution is where many automation dreams break down. You end up manually copying addresses, approving transactions, and babysitting what should be autonomous processes. Meanwhile, your agent sits idle, waiting for human intervention to complete tasks it could handle end-to-end.

The Missing Piece: Programmatic Wallet Control

AI agents need wallets the same way they need access to files, APIs, and databases—as tools to accomplish their goals. But traditional wallet integration is either too restrictive (requiring manual approval for every transaction) or too dangerous (giving agents full access to your funds with no safety nets).

WAIaaS bridges this gap with a self-hosted Wallet-as-a-Service that gives AI agents controlled access to blockchain operations. Instead of choosing between safety and automation, you get both: agents can execute transactions programmatically while operating within policies you define.

The platform exposes wallet functionality through both a TypeScript SDK and Python SDK, making it easy to integrate with any AI agent framework. Whether you're building with LangChain, CrewAI, or Claude's MCP protocol, your agents can now handle the complete workflow from analysis to execution.

Getting Started with the TypeScript SDK

Let's walk through integrating WAIaaS with an AI agent. First, install the SDK and start a local WAIaaS instance:

npm install @waiaas/sdk
npm install -g @waiaas/cli
waiaas init                        # Create data directory + config.toml
waiaas start                       # Start daemon (sets master password on first run)
waiaas quickset --mode mainnet     # Create wallets + MCP sessions in one step

Once your daemon is running, you can create a client connection:

import { WAIaaSClient } from '@waiaas/sdk';

const client = new WAIaaSClient({
  baseUrl: 'http://127.0.0.1:3100',
  sessionToken: process.env.WAIAAS_SESSION_TOKEN,
});

// Check balance
const balance = await client.getBalance();
console.log(`${balance.balance} ${balance.symbol}`);

// Send native token
const tx = await client.sendToken({
  to: 'recipient-address...',
  amount: '0.1',
});
console.log(`Transaction: ${tx.id}`);

The SDK provides clean abstractions over WAIaaS's REST API, handling authentication, error management, and transaction lifecycle automatically. Your agent code focuses on business logic rather than blockchain mechanics.

Building an Agent That Manages Its Own Budget

Here's a practical example: an AI agent that monitors its operating budget and automatically tops up when needed. This agent can execute DeFi swaps, check balances, and even pay for its own API calls using the x402 protocol.

import { WAIaaSClient, WAIaaSError } from '@waiaas/sdk';

const client = new WAIaaSClient({
  baseUrl: process.env['WAIAAS_BASE_URL'] ?? 'http://localhost:3100',
  sessionToken: process.env['WAIAAS_SESSION_TOKEN'],
});

// Step 1: Check wallet balance
const balance = await client.getBalance();
console.log(`Balance: ${balance.balance} ${balance.symbol} (${balance.chain}/${balance.network})`);

// Step 2: Send tokens
const sendResult = await client.sendToken({
  type: 'TRANSFER',
  to: 'recipient-address',
  amount: '0.001',
});
console.log(`Transaction submitted: ${sendResult.id} (status: ${sendResult.status})`);

// Step 3: Poll for confirmation
const POLL_TIMEOUT_MS = 60_000;
const startTime = Date.now();
while (Date.now() - startTime < POLL_TIMEOUT_MS) {
  const tx = await client.getTransaction(sendResult.id);
  if (tx.status === 'COMPLETED') {
    console.log(`Transaction confirmed! Hash: ${tx.txHash}`);
    break;
  }
  if (tx.status === 'FAILED') {
    console.error(`Transaction failed: ${tx.error}`);
    break;
  }
  await new Promise(resolve => setTimeout(resolve, 1000));
}

The agent can handle the complete transaction lifecycle: checking balances, submitting transactions, and monitoring for confirmation. Error handling is built-in through the WAIaaSError class, which provides structured error codes like INSUFFICIENT_BALANCE or POLICY_DENIED.

Python SDK for AI Frameworks

If you're working in Python with frameworks like LangChain or AutoGPT, the Python SDK provides the same functionality with familiar async patterns:

pip install waiaas
from waiaas import WAIaaSClient

async with WAIaaSClient("http://localhost:3100", "wai_sess_xxx") as client:
    balance = await client.get_balance()
    print(balance.balance, balance.symbol)

Both SDKs expose the same core methods: getBalance(), sendToken(), getTransaction(), listTransactions(), and signTransaction(). They also support advanced features like the x402 HTTP payment protocol, where agents can automatically pay for API calls by including payment headers.

Safety Through Sessions and Policies

WAIaaS implements a 3-layer security model that gives agents autonomy while protecting your funds. When you create a session for an agent, you're issuing time-limited credentials with specific permissions. The agent can execute approved transactions immediately, while larger amounts trigger delays and notifications.

Session tokens use JWT HS256 encoding and include built-in rate limiting and TTL controls. You can set absolute lifetime limits, renewal caps, and spending thresholds. If an agent goes rogue or gets compromised, you can revoke its session without touching the underlying wallet.

The platform also supports Account Abstraction through ERC-4337, enabling gasless transactions and smart account features. Your agents can operate on multiple chains without managing gas tokens, making cross-chain workflows seamless.

DeFi Integration Out of the Box

WAIaaS includes 14 DeFi protocol providers integrated: aave-v3, across, dcent-swap, drift, erc8004, hyperliquid, jito-staking, jupiter-swap, kamino, lido-staking, lifi, pendle, polymarket, and zerox-swap. Agents can swap tokens, provide liquidity, stake assets, and even trade prediction markets—all through the same SDK interface.

For example, executing a Jupiter swap on Solana is as simple as:

curl -X POST http://127.0.0.1:3100/v1/actions/jupiter-swap/swap \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer wai_sess_<token>" \
  -d '{
    "inputMint": "So11111111111111111111111111111111111111112",
    "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "amount": "1000000000"
  }'

The SDK wraps these protocol interactions in clean method calls, so your agent doesn't need to understand the underlying DEX mechanics.

MCP Integration for Claude

If you're using Claude Desktop, WAIaaS provides 45 MCP tools for seamless integration. The tools cover everything from basic wallet operations to advanced DeFi positions management. Claude can check balances, execute swaps, monitor transaction status, and even manage cross-chain bridging.

Setting up MCP integration is straightforward:

waiaas mcp setup --all

This automatically registers all your wallets with Claude Desktop, providing instant access to blockchain operations through natural language commands.

Quick Start: Agent-Controlled Wallet in 5 Steps

Ready to give your AI agent a wallet? Here's the fastest path:

  1. Install and initialize: npm install -g @waiaas/cli && waiaas init --auto-provision
  2. Start the daemon: waiaas start (runs on http://127.0.0.1:3100)
  3. Create wallets and sessions: waiaas quickset --mode mainnet
  4. Install SDK: npm install @waiaas/sdk or pip install waiaas
  5. Connect your agent: Use the session token from step 3 to authenticate SDK calls

Your agent now has programmatic access to multi-chain wallets with built-in safety controls.

What's Next

The WAIaaS SDK gives your AI agents the financial tools they need to operate autonomously while keeping your funds secure. Whether you're building trading bots, payment processors, or autonomous DAOs, the combination of programmatic control and policy-based security opens up new possibilities for AI-driven financial applications.

Ready to give your AI agents a wallet? Check out the complete documentation and examples at https://github.com/minhoyoo-iotrust/WAIaaS, or visit https://waiaas.ai to learn more about the platform's capabilities.