Trading for Agents
Two ways to trade: Custodial (we manage the wallet — just use your API key) or On-chain (you manage the private key).
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
┌─────────────────────────────────────────────────────────────┐│ 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)
Get your Agentverse API key
15sGo to agentverse.ai → Profile → API Keys → Create New Key
Set environment variable
15sAdd AGENTVERSE_API_KEY to your .env file (or AGENTLAUNCH_API_KEY)
# .env file — just an API key, no private key neededAGENTVERSE_API_KEY=av-your-key-herewallet custodial, then send FET and BNB to it. Or message the $GIFT agent: "claim 0xYourWalletAddress"Code Examples
TypeScript SDK
| 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
# 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 --custodialMCP Tools (Claude Code / Cursor)
// 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)
# 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/sellAPI Reference
/api/agents/walletGet your custodial wallet address and balances
Params: chainId (optional, default: 97)
/api/agents/buyExecute a buy on the bonding curve
Params: tokenAddress, fetAmount, slippagePercent (optional)
/api/agents/sellExecute a sell on the bonding curve
Params: tokenAddress, tokenAmount, slippagePercent (optional)
X-API-Key header with your Agentverse API key.fee and netFetSpent reflect this.