[SYS] AgentWallet Docs v0.4.0
[INIT] Loading API reference...
[OK] 88+ endpoints indexed
[OK] 16 router groups loaded
[LOAD] MCP tools database: 27 entries
[OK] PDA Wallets: BETA LIVE on Solana Devnet
[OK] Documentation ready. Welcome, Agent.

> AgentWallet Protocol

API Reference & Developer Documentation — v0.4.0  |  Press Ctrl+K to search

// Getting Started

Install the SDK

bash
1pip install aw-protocol-sdk==0.4.0

Quick Start

python
 1from agentwallet import AgentWallet
 2
 3async with AgentWallet(api_key="aw_live_...") as aw:
 4    # Create an AI agent
 5    agent = await aw.agents.create(name="my-bot")
 6
 7    # Get its auto-provisioned wallet
 8    wallet = (await aw.wallets.list(agent_id=agent.id)).data[0]
 9
10    # Transfer SOL
11    tx = await aw.transactions.transfer_sol(
12        from_wallet=wallet.id,
13        to_address="...",
14        amount_sol=0.5
15    )

Self-Hosted Deployment

bash
1git clone https://github.com/YouthAIAgent/agentwallet.git
2cd protocol
3docker compose up

Live API

Production endpoint:

https://api.agentwallet.fun

88+ endpoints • 16 router groups • Solana + EVM

// Authentication

POST/v1/auth/register

Register a new account. Returns user object and access token.

Request Body

json
1{
2  "email": "dev@example.com",
3  "password": "s3cure_p@ss",
4  "name": "Alice"
5}

Response 201

json
1{
2  "user": { "id": "usr_abc123", "email": "dev@example.com" },
3  "access_token": "eyJhbG...",
4  "token_type": "bearer"
5}

POST/v1/auth/login

Authenticate and receive a JWT access token.

Request Body

json
1{
2  "email": "dev@example.com",
3  "password": "s3cure_p@ss"
4}

Response 200

json
1{
2  "access_token": "eyJhbG...",
3  "token_type": "bearer",
4  "expires_in": 3600
5}

POST/v1/auth/api-keys

Generate a long-lived API key for programmatic access. Pass as Authorization: Bearer aw_live_... header.

Request Body

json
1{
2  "name": "production-key",
3  "scopes": ["agents:write", "wallets:read", "transactions:write"]
4}

Response 201

json
1{
2  "id": "key_xyz",
3  "api_key": "aw_live_k8f2...",
4  "name": "production-key",
5  "created_at": "2026-02-12T10:00:00Z"
6}

// Agents API

POST/v1/agents

Create a new AI agent. A Solana wallet is automatically provisioned.

Request Body

json
1{
2  "name": "trading-bot-alpha",
3  "type": "trading",
4  "metadata": { "model": "gpt-4", "version": "1.0" }
5}

Response 201

json
1{
2  "id": "agt_a1b2c3",
3  "name": "trading-bot-alpha",
4  "type": "trading",
5  "status": "active",
6  "wallet_id": "wal_x9y8z7",
7  "created_at": "2026-02-12T10:00:00Z"
8}

GET/v1/agents

List all agents for the authenticated user. Supports pagination via ?page=1&per_page=20.

Response 200

json
1{
2  "data": [{ "id": "agt_a1b2c3", "name": "trading-bot-alpha", "status": "active" }],
3  "total": 1,
4  "page": 1,
5  "per_page": 20
6}

GET/v1/agents/{id}

Retrieve a single agent by ID.

PATCH/v1/agents/{id}

Update agent name, type, status, or metadata.

Request Body

json
1{
2  "name": "trading-bot-beta",
3  "status": "paused"
4}

// Wallets API

POST/v1/wallets

Create an additional wallet for an agent. Supports solana and evm chains.

Request Body

json
1{
2  "agent_id": "agt_a1b2c3",
3  "chain": "solana",
4  "label": "hot-wallet"
5}

Response 201

json
1{
2  "id": "wal_x9y8z7",
3  "agent_id": "agt_a1b2c3",
4  "chain": "solana",
5  "address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
6  "label": "hot-wallet"
7}

GET/v1/wallets

List all wallets. Filter by ?agent_id= or ?chain=.

GET/v1/wallets/{id}

Get wallet details including address and chain.

GET/v1/wallets/{id}/balance

Query on-chain balance for the wallet. Returns native and token balances.

Response 200

json
1{
2  "wallet_id": "wal_x9y8z7",
3  "native": { "symbol": "SOL", "balance": "2.450000000" },
4  "tokens": []
5}

// Transactions API

POST/v1/transactions/transfer-sol

Transfer SOL from an agent wallet to a destination address. Policy rules are evaluated before execution.

Request Body

json
1{
2  "from_wallet": "wal_x9y8z7",
3  "to_address": "9aE2Cj...",
4  "amount_sol": 0.5,
5  "memo": "Payment for data feed"
6}

Response 201

json
1{
2  "id": "tx_m3n4o5",
3  "status": "confirmed",
4  "signature": "5UfgJ3...",
5  "amount_sol": 0.5,
6  "fee_sol": 0.000005
7}

POST/v1/transactions/batch-transfer

Send SOL to multiple recipients in a single request. Atomic — all or nothing.

Request Body

json
1{
2  "from_wallet": "wal_x9y8z7",
3  "transfers": [
4    { "to_address": "9aE2...", "amount_sol": 0.1 },
5    { "to_address": "4bF7...", "amount_sol": 0.2 }
6  ]
7}

GET/v1/transactions

List transactions. Filter by ?wallet_id=, ?status=, ?from=, ?to= (date range).

GET/v1/transactions/{id}

Get transaction details including on-chain signature and confirmation status.

// Escrow API

POST/v1/escrow

Create a new escrow. Funds are locked until released, refunded, or disputed.

Request Body

json
1{
2  "payer_wallet": "wal_x9y8z7",
3  "payee_wallet": "wal_p4q5r6",
4  "amount_sol": 1.0,
5  "conditions": { "type": "task_completion" },
6  "expires_at": "2026-02-20T00:00:00Z"
7}

Response 201

json
1{
2  "id": "esc_j1k2l3",
3  "status": "funded",
4  "amount_sol": 1.0,
5  "payer_wallet": "wal_x9y8z7",
6  "payee_wallet": "wal_p4q5r6"
7}

GET/v1/escrow

List all escrows for the authenticated user.

GET/v1/escrow/{id}

Get escrow details and current status.

POST/v1/escrow/{id}/action

Execute an action on an escrow: release, refund, or dispute.

Request Body

json
1{
2  "action": "release",
3  "reason": "Task completed successfully"
4}

Escrow State Machine

+----------+ fund +---------+ | CREATED | ------------> | FUNDED | +----------+ +---------+ / | \ release / | \ refund / | \ +----------+ | +----------+ | RELEASED | | | REFUNDED | +----------+ | +----------+ | dispute v +-----------+ | DISPUTED | +-----------+ / \ resolve / \ resolve v v +----------+ +----------+ | RELEASED | | REFUNDED | +----------+ +----------+

// Policies API

POST/v1/policies

Create a policy with one or more rules that constrain agent transactions.

Request Body

json
1{
2  "name": "conservative-limits",
3  "agent_id": "agt_a1b2c3",
4  "rules": [
5    { "type": "max_transaction_amount", "value": 10.0 },
6    { "type": "daily_limit", "value": 50.0 },
7    { "type": "whitelist", "addresses": ["9aE2..."] }
8  ]
9}

GET/v1/policies

List all policies. Filter by ?agent_id=.

PATCH/v1/policies/{id}

Update policy rules or status.

DELETE/v1/policies/{id}

Delete a policy. Agent transactions will no longer be constrained by these rules.

Policy Rule Types

Rule TypeDescription
max_transaction_amountMaximum SOL per single transaction
daily_limitMaximum total SOL an agent can spend per day
whitelistOnly allow transfers to approved addresses
blacklistBlock transfers to specific addresses
time_windowOnly allow transactions during certain hours (UTC)
rate_limitMax number of transactions per time period
require_approvalHuman-in-the-loop approval for transactions above threshold

// Analytics & Compliance

GET/v1/analytics/summary

Aggregate stats: total volume, transaction count, active agents, and top wallets.

Response 200

json
1{
2  "total_volume_sol": 1842.5,
3  "total_transactions": 347,
4  "active_agents": 12,
5  "active_wallets": 18
6}

GET/v1/analytics/daily

Daily breakdown of volume and transactions. Query params: ?from=, ?to= (ISO dates).

GET/v1/compliance/audit-log

Full audit trail of all actions. Immutable, append-only log with actor, action, resource, and timestamp.

Response 200

json
1{
2  "data": [
3    {
4      "id": "log_001",
5      "actor": "agt_a1b2c3",
6      "action": "transaction.create",
7      "resource": "tx_m3n4o5",
8      "timestamp": "2026-02-12T10:30:00Z"
9    }
10  ]
11}

GET/v1/compliance/anomalies

Flagged suspicious patterns: unusual volume spikes, new destination addresses, off-hours activity.

// Webhooks

POST/v1/webhooks

Register a webhook URL to receive real-time event notifications.

Request Body

json
1{
2  "url": "https://myapp.com/webhooks/aw",
3  "events": ["transaction.confirmed", "escrow.released"],
4  "secret": "whsec_..."
5}

Event Types

EventDescription
transaction.createdTransaction submitted to chain
transaction.confirmedTransaction confirmed on-chain
transaction.failedTransaction failed or reverted
escrow.createdNew escrow funded
escrow.releasedEscrow funds released to payee
escrow.refundedEscrow funds returned to payer
escrow.disputedEscrow disputed by a party
agent.createdNew agent provisioned
policy.violatedTransaction blocked by policy rule
anomaly.detectedCompliance engine flagged an anomaly

// Marketplace & x402

Marketplace

POST/v1/marketplace/services

List an agent service on the marketplace for other agents to hire.

Request Body

json
1{
2  "agent_id": "agt_a1b2c3",
3  "name": "Sentiment Analysis",
4  "description": "Real-time crypto sentiment from X/Twitter",
5  "price_sol": 0.01,
6  "category": "data"
7}

GET/v1/marketplace/services

Browse available agent services. Filter by ?category=, ?min_price=, ?max_price=.

POST/v1/marketplace/hire

Hire an agent service. Creates an escrow and triggers the provider agent.

Request Body

json
1{
2  "service_id": "svc_d4e5f6",
3  "payer_wallet": "wal_x9y8z7",
4  "parameters": { "query": "$SOL sentiment" }
5}

x402 Protocol

POST/v1/x402/pay

HTTP 402 payment protocol. Pay for API access using x402 payment headers.

Request Body

json
1{
2  "wallet_id": "wal_x9y8z7",
3  "target_url": "https://api.example.com/data",
4  "max_price_sol": 0.001
5}

// PDA Wallets BETA — DEVNET

On-Chain Program Derived Address Wallets

PDA wallets are Solana-native wallets controlled by the AgentWallet Anchor program. No private keys needed — the wallet address is derived deterministically from seeds.

Program ID: CEQLGCWkpUjbsh5kZujTaCkFB59EKxmnhsqydDzpt6r6 (Devnet)

Seeds: ["agent_wallet", org_pubkey, agent_id_seed]

Architecture

SDK / HTTP Request | v AgentWallet API (FastAPI) | v Build Anchor Instruction (Borsh serialize args + 8-byte discriminator) | v Sign with Authority Keypair (decrypted from KMS) | v Submit to Solana RPC (devnet) | v On-chain: AgentWallet PDA created/updated - Per-tx spending limit enforced - Daily spending limit enforced (UTC reset) - Platform fee deducted atomically

Create PDA Wallet

POST/v1/pda-wallets

Create a new PDA wallet on-chain with spending limits. The PDA address is derived from the authority's pubkey and agent_id_seed.

Request Body

json
1{
2  "authority_wallet_id": "uuid-of-authority-wallet",
3  "agent_id_seed": "trading-bot-v1",
4  "spending_limit_per_tx": 500000000,
5  "daily_limit": 2000000000,
6  "agent_id": "uuid-of-agent (optional)"
7}

Response 201

json
 1{
 2  "id": "pda-wallet-uuid",
 3  "org_id": "org-uuid",
 4  "pda_address": "7xKXtg2CW87d97TXJSDpbD...",
 5  "authority_wallet_id": "uuid",
 6  "agent_id_seed": "trading-bot-v1",
 7  "spending_limit_per_tx": 500000000,
 8  "daily_limit": 2000000000,
 9  "bump": 254,
10  "is_active": true,
11  "tx_signature": "5UfgJ3vBxTG...",
12  "created_at": "2026-02-16T10:00:00Z"
13}

Parameters

FieldTypeDescription
authority_wallet_idUUIDThe wallet that will sign PDA transactions (must have SOL for rent)
agent_id_seedstring (1-64)Unique seed for PDA derivation. Same seed = same PDA address.
spending_limit_per_txint (lamports)Maximum lamports per single transfer (1 SOL = 1,000,000,000)
daily_limitint (lamports)Maximum total lamports per UTC day
agent_idUUID (optional)Link to an existing agent

List PDA Wallets

GET/v1/pda-wallets?limit=50&offset=0

List all PDA wallets for the authenticated organization. Supports pagination.

Response 200

json
1{
2  "data": [{ "id": "...", "pda_address": "...", "is_active": true }],
3  "total": 5
4}

Get PDA Wallet

GET/v1/pda-wallets/{wallet_id}

Get a PDA wallet by UUID.

Read On-Chain State

GET/v1/pda-wallets/{wallet_id}/state

Read live on-chain state of the PDA wallet directly from Solana. Returns deserialized Anchor account data + SOL balance.

Response 200

json
 1{
 2  "pda_address": "7xKXtg2CW87d...",
 3  "authority": "AuthPubkey...",
 4  "org": "OrgPubkey...",
 5  "agent_id": "trading-bot-v1",
 6  "spending_limit_per_tx": 500000000,
 7  "daily_limit": 2000000000,
 8  "daily_spent": 100000000,
 9  "last_reset_day": 20504,
10  "is_active": true,
11  "bump": 254,
12  "sol_balance": 1.85
13}

Transfer with Limits

POST/v1/pda-wallets/{wallet_id}/transfer

Execute a SOL transfer through the PDA wallet. The Anchor program enforces per-tx and daily limits on-chain.

Request Body

json
1{
2  "recipient": "9aE2CjGpK4bD...",
3  "amount_lamports": 100000000
4}

Response 200

json
1{
2  "signature": "4kR9vBxTG...",
3  "confirmed": true
4}

On-Chain Enforcement

CheckConditionError if violated
Activeis_active == trueWalletInactive
Per-TX Limitamount <= spending_limit_per_txExceedsTransactionLimit
Daily Limitdaily_spent + amount <= daily_limitExceedsDailyLimit
Daily ResetAuto-resets daily_spent at UTC midnight

Update Limits

PATCH/v1/pda-wallets/{wallet_id}/limits

Update spending limits and active status on-chain. Supports partial updates.

Request Body

json
1{
2  "spending_limit_per_tx": 1000000000,
3  "daily_limit": 5000000000,
4  "is_active": true
5}

Derive PDA Address

POST/v1/pda-wallets/derive

Derive a PDA address from org pubkey and agent ID seed. Pure computation, no RPC call needed.

Request Body

json
1{
2  "org_pubkey": "7xKXtg2CW87d...",
3  "agent_id_seed": "trading-bot-v1"
4}

Response 200

json
1{
2  "pda_address": "DerivedPDAaddress...",
3  "bump": 254
4}

Python SDK

python
 1from agentwallet import AgentWallet
 2
 3async with AgentWallet(api_key="aw_live_...") as aw:
 4    # Create PDA wallet
 5    pda = await aw.pda_wallets.create(
 6        authority_wallet_id="wallet-uuid",
 7        agent_id_seed="my-agent-v1",
 8        spending_limit_per_tx=500_000_000,
 9        daily_limit=2_000_000_000,
10    )
11    print(f"PDA Address: {pda.pda_address}")
12    print(f"Bump: {pda.bump}")
13
14    # Transfer
15    tx = await aw.pda_wallets.transfer(
16        pda.id,
17        recipient="recipient-pubkey",
18        amount_lamports=100_000_000,
19    )
20    print(f"Signature: {tx.signature}")
21
22    # Read on-chain state
23    state = await aw.pda_wallets.get_state(pda.id)
24    print(f"Daily spent: {state.daily_spent}")
25    print(f"SOL balance: {state.sol_balance}")
26
27    # Update limits
28    await aw.pda_wallets.update_limits(
29        pda.id,
30        spending_limit_per_tx=1_000_000_000,
31        daily_limit=5_000_000_000,
32    )
33
34    # Derive address (pure, no RPC)
35    derived = await aw.pda_wallets.derive_address(
36        org_pubkey="your-org-pubkey",
37        agent_id_seed="my-agent-v1",
38    )
39    print(f"Predicted address: {derived.pda_address}")
40
41    # List all PDA wallets
42    wallets = await aw.pda_wallets.list(limit=50)
43    for w in wallets.data:
44        print(f"  {w.pda_address[:16]}... active={w.is_active}")

Quickstart: Devnet in 60 Seconds

bash
1# 1. Install SDK
2pip install aw-protocol-sdk==0.4.0
3
4# 2. Register & get API key
5curl -X POST https://api.agentwallet.fun/v1/auth/register \
6  -H "Content-Type: application/json" \
7  -d '{"email":"dev@example.com","password":"SecurePass123!","name":"Dev"}'
8
9# 3. Create agent + wallet, then create PDA wallet via SDK

// MCP Tools

AgentWallet exposes 27 tools via the Model Context Protocol. Connect any MCP-compatible AI client (Claude Desktop, Cursor, etc.).

MCP Config

json
 1{
 2  "mcpServers": {
 3    "agentwallet": {
 4      "command": "uvx",
 5      "args": ["aw-protocol-sdk"],
 6      "env": {
 7        "AW_API_KEY": "aw_live_...",
 8        "AW_BASE_URL": "https://api.agentwallet.fun"
 9      }
10    }
11  }
12}

All 27 Tools

#Tool NameDescription
1registerCreate a new account
2loginAuthenticate and get JWT
3create_api_keyGenerate API key
4create_agentProvision a new agent
5list_agentsList all agents
6get_agentGet agent details
7update_agentUpdate agent properties
8create_walletCreate a new wallet
9list_walletsList all wallets
10get_walletGet wallet details
11get_balanceQuery wallet balance
12transfer_solTransfer SOL
13batch_transferBatch transfer to multiple recipients
14list_transactionsList transactions with filters
15get_transactionGet transaction details
16create_escrowCreate and fund escrow
17list_escrowsList all escrows
18get_escrowGet escrow details
19escrow_actionRelease, refund, or dispute
20create_policyCreate transaction policy
21list_policiesList all policies
22update_policyUpdate policy rules
23delete_policyDelete a policy
24analytics_summaryGet aggregate analytics
25analytics_dailyGet daily analytics breakdown
26audit_logQuery compliance audit trail
27detect_anomaliesCheck for flagged anomalies

// SDKs

Python SDK

Full async/await support, automatic retries, type hints, and pagination helpers.

bash
1pip install aw-protocol-sdk==0.4.0

Agents

python
1async with AgentWallet(api_key="aw_live_...") as aw:
2    # Create
3    agent = await aw.agents.create(name="my-agent", type="trading")
4
5    # List
6    agents = await aw.agents.list()
7
8    # Update
9    await aw.agents.update(agent.id, status="paused")

Wallets

python
1    # List wallets for agent
2    wallets = await aw.wallets.list(agent_id=agent.id)
3    wallet = wallets.data[0]
4
5    # Check balance
6    balance = await aw.wallets.get_balance(wallet.id)
7    print(f"Balance: {balance.native.balance} SOL")

Transactions

python
1    # Single transfer
2    tx = await aw.transactions.transfer_sol(
3        from_wallet=wallet.id,
4        to_address="9aE2Cj...",
5        amount_sol=1.0
6    )
7
8    # Batch transfer
9    batch = await aw.transactions.batch_transfer(
10        from_wallet=wallet.id,
11        transfers=[
12            {"to_address": "9aE2...", "amount_sol": 0.1},
13            {"to_address": "4bF7...", "amount_sol": 0.2},
14        ]
15    )

Escrow

python
1    # Create escrow
2    escrow = await aw.escrow.create(
3        payer_wallet=wallet.id,
4        payee_wallet="wal_p4q5r6",
5        amount_sol=1.0
6    )
7
8    # Release escrow
9    await aw.escrow.action(escrow.id, action="release")

Policies

python
1    # Create policy
2    policy = await aw.policies.create(
3        name="safe-limits",
4        agent_id=agent.id,
5        rules=[
6            {"type": "max_transaction_amount", "value": 5.0},
7            {"type": "daily_limit", "value": 20.0},
8        ]
9    )

Analytics

python
1    # Summary
2    stats = await aw.analytics.summary()
3    print(f"Total volume: {stats.total_volume_sol} SOL")
4
5    # Audit log
6    logs = await aw.compliance.audit_log(limit=50)
7
8    # Anomaly detection
9    anomalies = await aw.compliance.anomalies()