> ## Documentation Index
> Fetch the complete documentation index at: https://docs.laso.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Managed agent wallet

> Let an AI agent pay x402 endpoints in USDC from a Laso-custodied Solana wallet, with no private key to hold and no payment header to build.

A **managed agent wallet** is a Solana wallet Laso custodies for your account. The agent makes ordinary authenticated HTTP calls, and Laso settles the x402 payment on its behalf. It pays endpoints that settle in USDC on Solana or on Base from [one balance](#one-balance-on-solana-and-base).

It is an alternative to the self-custody wallets in the [agent quickstart](https://docs.laso.finance/guides/agent-quick-start.md). Pick one, not both.

> [!NOTE]
>
> A managed wallet can pay **any** x402 endpoint, not just Laso's. See [Pay an
> endpoint](https://docs.laso.finance/guides/managed-wallet-payments.md).

## When to use one

> [card] Good fit
>
> Your agent runs somewhere you would rather not put a private key. You want
> spending visible in a dashboard and one funding source for Laso and
> third-party x402 services.

> [card] Poor fit
>
> You need self-custody or a spending-policy engine richer than a per-payment
> cap. Use Locus, Sponge, or Ampersend instead.

## The calls

All six are Firebase callables at `https://laso.finance/<name>`, authorized with `Authorization: Bearer <id_token>`. Arguments go in a `data` object; responses come back in a `result` object.

| Callable | Purpose |
| - | - |
| `announceAgentConnection` | Tell the human the agent connected |
| `getAgentWallet` | Read the wallet address and balance |
| `agentX402Pay` | Pay a Laso route or any external x402 endpoint |
| `agentWalletTransfer` | Send USDC (or any token) out of the wallet |
| `agentWalletSwap` | Swap a token the wallet holds into USDC |
| `moveAgentWalletFunds` | Move USDC between the wallet's two networks |

## Setup

**1. Sign in**

Call `GET /auth` as in the [authentication guide](https://docs.laso.finance/guides/authentication.md)
and save the `id_token`, `refresh_token`, and `user_id`. The examples
reference the token as `$LASO_ID_TOKEN`.

**2. Announce the connection**

Call this right after sign-in, before anything else.

```bash theme={null}
curl -X POST https://laso.finance/announceAgentConnection \
  -H "Authorization: Bearer $LASO_ID_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "agentName": "your name", "message": "a short hello for your human" }'
```

It flips the dashboard's "waiting for your agent" screen to "connected" and
returns the wallet's funding state.

> [!WARNING]
>
> Nothing enforces this step, so skipping it fails silently: the agent works
> but the human never sees it connect. Treat it as part of signing in.

**3. Read the wallet and fund it**

```bash theme={null}
curl https://laso.finance/getAgentWallet \
  -H "Authorization: Bearer $LASO_ID_TOKEN"
```

```json theme={null}
{
  "user_id": "usr_...",
  "has_wallet": true,
  "wallet_address": "3MZVk97x9SeRxbYpc3jhzRfU2fyA3emYutnqfn9kNfYX",
  "balance_usdc": 0,
  "needs_funding": true,
  "solana_balance_usdc": 0,
  "base_wallet_address": "0x4E2b9a1C7d3F5086aB12cD34eF56a7890b1C2d3E",
  "base_balance_usdc": 0
}
```

Send **USDC on Solana** to `wallet_address`, or **USDC on Base** to
`base_wallet_address`. Both land in the same balance. Full steps are in
[How do I fund my AI agent with USDC?](https://docs.laso.finance/guides/how-do-i-fund-my-ai-agent-with-usdc.md). If `needs_funding` is `true`,
ask your human for a deposit. If `has_wallet` is `false`, setup finishes at
[laso.finance/agent/dashboard](https://laso.finance/agent/dashboard).

> [!WARNING]
>
> `wallet_address` and `base_wallet_address` are the only places to send
> funds, each on its own network. `user_id` is an account id, not an
> address. USDC sent to it is lost.

## The wallet balance is not the account balance

`getAgentWallet` reports USDC held on-chain by the agent wallet. `GET /get-account-balance` reports a different number: the Laso account balance, a ledger held by Laso. Both are correct, and they rarely match.

Paying a route moves USDC from the wallet to Laso. That arrival is recorded on the account balance as a deposit, and the purchase then debits it. After a purchase the account balance usually reads `balance: 0`, and `total_deposits` has grown by the purchase amount. Nothing is missing.

| To do this | Use |
| - | - |
| See both balances in one call | `GET /get-account-balance` (wallet is under `agent_wallet`) |
| Move USDC out of the agent wallet | `agentWalletTransfer` |
| Move USDC out of the account balance | `POST /withdraw` |

`POST /withdraw` never draws on the agent wallet. If it reports an insufficient account balance while the wallet holds funds, the error names both figures and points to `agentWalletTransfer`. The full set of withdrawal calls is in [How do I get USDC back out of my AI agent's account?](https://docs.laso.finance/guides/how-do-i-withdraw-usdc-from-my-ai-agent.md).

## One balance on Solana and Base

The wallet is two on-chain wallets underneath, one on Solana and one on Base, and either can be funded. `balance_usdc` is what they hold together, and every payment and transfer draws on that whole amount:

* Paying an endpoint that settles on Base moves the USDC it needs from Solana to Base just before signing, usually within 10 seconds. Laso tops Base up by at least \$1 at a time, so a run of small Base payments moves funds about once per dollar.
* A transfer, or a payment to a Laso route, that needs more than the Solana side holds pulls the difference back from Base first, usually within 15 seconds.
* Each move costs 0.075% of the amount moved. Laso pays the gas on both chains.
* To move funds yourself, call `moveAgentWalletFunds` with `from` (`solana` or `base`) and an `amount`. It is optional, and useful for funding Base ahead of a run of Base payments so none of them waits on a move. The fee comes out of the amount, and the call returns once the USDC has arrived with `sentUsdc` and `receivedUsdc`. The human can do the same from "By network" on the dashboard.

`getAgentWallet` reports the split as `solana_balance_usdc` and `base_balance_usdc`, and the Base address as `base_wallet_address`. `base_balance_usdc` is `null` when its live chain read fails. Laso's own routes are paid from the Solana side, topped up from Base when needed.

## Next steps

> [card] [Pay an endpoint](https://docs.laso.finance/guides/managed-wallet-payments.md)
>
> Use `agentX402Pay` for Laso routes and external x402 services.

> [card] [Guardrails](https://docs.laso.finance/guides/managed-wallet-guardrails.md)
>
> Pin the price, asset, network, and receiver before paying a third party.

> [card] [Spend limit and activity](https://docs.laso.finance/guides/managed-wallet-spend-limit.md)
>
> The human's per-payment cap, and where every payment is recorded.

> [card] [Bank accounts](https://docs.laso.finance/guides/agent-bank-accounts.md)
>
> Fund this wallet by bank transfer instead of on-chain.

> [card] [Example: a self-funding agent](https://docs.laso.finance/how-we-use/self-funding-ppc-agent.md)
>
> An agent paid into its own wallet, holding the capital it spends.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.