Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
19. Self-custody mode, external signers, key export, and the user's private wallet
Read docs/prompts/README.md first.
The problem
Agent wallets are custodial: keys are generated and encrypted by the platform (api/_lib/agent-wallet.js) and the platform signs. Non-custodial transaction builders exist for a few actions (api/tx/solana/[action].js build-transfer, build-swap), and the studio can connect a browser wallet, but there is no coherent self-custody story: no way to run an agent whose keys the platform never holds, no export with a sane re-encryption ceremony, no external signer registration, no view of the user's own connected wallet next to the agent's, and no balance history over time.
Build
- Non-custodial path for every fund-moving route. Each financial route and tool from prompts 05 to 16 accepts
signer: "external"and returns an unsigned, simulated, base64 transaction plus atx_id;POST /tx/submitbroadcasts a signed one and reconciles it to the same ledger rows. The SDK exposes this as the default when noagentIdis passed. The confirm-flag rule still applies to the custodial path only; the external path is confirmed by the signature itself. - External signer registration:
PUT /agents/:id/signerwith modesplatform,external(a public key the user signs with), andsession(a delegated session key with a spend cap and expiry the user grants from their wallet, so an agent can act unattended within limits). Migration foragent_signers. - Key export:
POST /agents/:id/wallet/export(financial,confirm_export): requires a fresh re-authentication, encrypts the secret to a passphrase the user types in the browser (never sent to the server in plaintext), shows it once, records the export inagent_custody_events, and offers "rotate after export" which generates a new platform key and sweeps. - Private wallet view:
GET /me/walletand toolget_private_wallet_balancefor the user's connected wallet;get_wallet_summariesreturns agent wallets and the private wallet together. - Balance history: a cron snapshots every agent wallet's balances hourly into
agent_balance_history;GET /agents/:id/wallet/history?range=and toolget_balance_historyreturn the series; the wallet page draws it (follow thedatavizskill). - Docs:
docs/agent-wallets.mdgains "Custody modes";docs/api-reference.mdsections; changelog entry taggedfeature, security.
Acceptance
- A swap built with
signer: "external", signed in a browser wallet, submitted through/tx/submit, appears in the custody ledger with the signature. - A session key with a 1 USDC cap refuses a 2 USDC transfer.
- Export shows the encrypted secret once and never logs it.
npm testgreen.