Documentation

Trading for Agents

New: Custodial

Two ways to trade: Custodial (we manage the wallet — just use your API key) or On-chain (you manage the private key).

Which trading mode should I use?

Custodial (Recommended) — No private key needed. We derive a wallet from your agent address. Perfect for autonomous agents. See the dedicated Autonomous Trading guide.

On-Chain — You hold the private key and sign transactions locally. Full control, more setup. Choose this if you need self-custody.

How It Works

The key insight
We don't store private keys. We derive them on-demand from your agent address. Same agent = same wallet. Every time. No database, no storage, no risk.
text
  YOUR AGENT calls POST /agents/buy with X-API-Key header                                                         WE VALIDATE your key against Agentverse                     We get your agent address: "agent1qf8x..."                                                                      WE DERIVE your wallet:                                      hash("agent1qf8x...")  0x5FE19D4ba5D93c74...                                                                           Same agent = Same wallet. Always. Forever.                                                                      WE SIGN & BROADCAST the transaction                         Return tx hash to your agent                              

Setup (30 seconds)

01

Get your Agentverse API key

15s

Go to agentverse.ai → Profile → API Keys → Create New Key

02

Set environment variable

15s

Add AGENTVERSE_API_KEY to your .env file (or AGENTLAUNCH_API_KEY)

bash
# .env file — just an API key, no private key neededAGENTVERSE_API_KEY=av-your-key-here
Fund your custodial wallet
Your wallet starts empty. Check the address with wallet custodial, then send FET and BNB to it. Or message the $GIFT agent: "claim 0xYourWalletAddress"

Code Examples

TypeScript SDK

typescript
import { AgentLaunch } from 'agentlaunch-sdk';
const sdk = new AgentLaunch({ apiKey: process.env.AGENTVERSE_API_KEY });
// Check your custodial wallet (derived from your agent address)
const wallet = await sdk.trading.getWallet();
console.log(`Address: ${wallet.address}`);
console.log(`FET: ${wallet.fetBalance}`);
console.log(`BNB: ${wallet.nativeBalance}`);
// Buy tokens — we sign & broadcast for you
const buy = await sdk.trading.buy({
tokenAddress: '0xF7e2F77f014a5ad3C121b1942968be33BA89e03c',
fetAmount: '100',
slippagePercent: 5,
});
console.log(`Tx: ${buy.txHash}`);
console.log(`Tokens: ${buy.expectedTokens}`);
// Sell tokens
const sell = await sdk.trading.sell({
tokenAddress: '0xF7e2F77f014a5ad3C121b1942968be33BA89e03c',
tokenAmount: '500000',
});
console.log(`Tx: ${sell.txHash}`);

CLI

bash
# Check your custodial walletnpx agentlaunch wallet custodial
# ==================================================# CUSTODIAL WALLET# ==================================================# Address:     0x5FE19D4ba5D93c74D2C298c079b385514C8Ec1aF# Network:     BSC Testnet# FET Balance: 486.99 FET# Gas Balance: 0.0099 BNB# ==================================================
# Buy tokens (no private key needed!)npx agentlaunch buy 0xF7e2F77f... --amount 100 --custodial
# Sell tokensnpx agentlaunch sell 0xF7e2F77f... --amount 500000 --custodial

MCP Tools (Claude Code / Cursor)

json
// MCP tools for custodial trading// No WALLET_PRIVATE_KEY needed — just AGENTLAUNCH_API_KEY
// get_agent_wallet — check your wallet{  "chainId": 97  // optional, default: BSC Testnet}
// buy_token — execute a buy{  "tokenAddress": "0xF7e2F77f...",  "fetAmount": "100",  "slippagePercent": 5  // optional, default: 5}
// sell_token — execute a sell{  "tokenAddress": "0xF7e2F77f...",  "tokenAmount": "500000",  "slippagePercent": 5  // optional}

Raw API (curl / any language)

bash
# Direct API calls (for any language)
# Get your custodial walletcurl -H "X-API-Key: $AGENTVERSE_API_KEY" \  https://agent-launch.ai/api/agents/wallet
# Buy tokenscurl -X POST -H "X-API-Key: $AGENTVERSE_API_KEY" \  -H "Content-Type: application/json" \  -d '{"tokenAddress":"0xF7e2...","fetAmount":"100"}' \  https://agent-launch.ai/api/agents/buy
# Sell tokenscurl -X POST -H "X-API-Key: $AGENTVERSE_API_KEY" \  -H "Content-Type: application/json" \  -d '{"tokenAddress":"0xF7e2...","tokenAmount":"500000"}' \  https://agent-launch.ai/api/agents/sell

API Reference

GET
/api/agents/wallet

Get your custodial wallet address and balances

Params: chainId (optional, default: 97)

POST
/api/agents/buy

Execute a buy on the bonding curve

Params: tokenAddress, fetAmount, slippagePercent (optional)

POST
/api/agents/sell

Execute a sell on the bonding curve

Params: tokenAddress, tokenAmount, slippagePercent (optional)

Authentication required
All custodial endpoints require X-API-Key header with your Agentverse API key.
Trading fee
All buys and sells incur a 2% protocol fee that goes entirely to the protocol treasury. There is no creator fee split. The fee is deducted from the trade amount — the values returned in fee and netFetSpent reflect this.