Skip to main content

Building a Self-Sustaining Agent

Design an agent that funds its own compute costs through trading fees.

The Self-Sustaining Model

┌─────────────────┐
│ Your Agent │
│ (provides │
│ value) │
└────────┬────────┘
│ Users interact

┌─────────────────┐
│ Token Trading │
│ (generates │
│ fees) │
└────────┬────────┘
│ Fees accumulate

┌─────────────────┐
│ Fee Claims │
│ (ETH/WETH) │
└────────┬────────┘
│ Revenue

┌─────────────────┐
│ Your Agent │◀──┐
│ (continues │ │
│ running) │───┘
└─────────────────┘
Gas Sponsorship

Bankr covers gas fees for agent wallets on supported chains. Your agent can execute transactions without needing ETH for gas.

Choose Your Integration

The simplest path to a self-sustaining agent. Bankr handles wallet management, transaction execution, security, and gas fees.

Install in OpenClaw

Tell your agent:

install the bankr skill from https://github.com/BankrBot/openclaw-skills

Your agent can then:

  • Deploy tokens and earn fees
  • Execute trades automatically
  • Claim fees with natural language
  • No wallet management code needed

Option 2: Agent API

For custom integrations with full wallet control via API key authentication.

const API_KEY = process.env.BANKR_API_KEY;
const BASE_URL = 'https://api.bankr.bot/agent';

async function executePrompt(prompt: string) {
// Submit prompt
const submitRes = await fetch(`${BASE_URL}/prompt`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY,
},
body: JSON.stringify({ prompt }),
});

const { jobId } = await submitRes.json();

// Poll for completion
while (true) {
const statusRes = await fetch(`${BASE_URL}/job/${jobId}`, {
headers: { 'X-API-Key': API_KEY },
});
const job = await statusRes.json();

if (job.status === 'completed') return job.response;
if (job.status === 'failed') throw new Error(job.error);

await new Promise(r => setTimeout(r, 2000));
}
}

// Use it
const fees = await executePrompt('check fees for MyToken');
await executePrompt('claim my fees for MyToken');

Benefits:

  • Bankr manages wallet security
  • No private keys in your code
  • Gas fees covered on supported chains
  • Simple REST API

Calculating Sustainability

Fee Revenue (Base)

Your 60% share of trading fees:

  • High volume token: $10-100+/day possible
  • Moderate volume: $1-10/day
  • Low volume: Less than $1/day

Fee Revenue (Solana)

During bonding curve: 0.5% creator fee on each trade After migration: LP trading fees from your 50% position

Break-Even

With the Agent API:

  • No per-request fees
  • Gas fees are covered by Bankr on supported chains
  • Your trading fees go directly to growing your treasury

Strategies for Sustainability

1. Build Genuine Utility

Agents with real utility get more usage:

// Examples of useful agents:
- Trading signal bot
- Portfolio rebalancer
- News aggregator
- Social engagement bot
- Data analysis tool

2. Smart Fee Collection

Automate fee collection with the Agent API:

async function collectFees() {
// Check fees
const fees = await executePrompt('check fees for MyToken');
console.log('Current fees:', fees);

// Claim if worthwhile
await executePrompt('claim my fees for MyToken');
console.log('Fees claimed');
}

// Run daily
setInterval(collectFees, 24 * 60 * 60 * 1000);

3. Batch Operations

Combine related queries:

// Instead of:
"price of ETH"
"price of BTC"
"price of SOL"

// Use:
"prices of ETH, BTC, and SOL"

4. Community Growth

More users = more trading = more fees:

  • Share your agent publicly
  • Engage on social media
  • Provide good documentation
  • Respond to feedback

Example: Self-Sustaining Bot with Agent API

const API_KEY = process.env.BANKR_API_KEY!;
const BASE_URL = 'https://api.bankr.bot/agent';

class SelfSustainingBot {
private tokenName: string;

constructor(tokenName: string) {
this.tokenName = tokenName;
}

private async prompt(text: string): Promise<string> {
const submitRes = await fetch(`${BASE_URL}/prompt`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': API_KEY,
},
body: JSON.stringify({ prompt: text }),
});

const { jobId } = await submitRes.json();

// Poll for completion
for (let i = 0; i < 60; i++) {
const statusRes = await fetch(`${BASE_URL}/job/${jobId}`, {
headers: { 'X-API-Key': API_KEY },
});
const job = await statusRes.json();

if (job.status === 'completed') return job.response;
if (job.status === 'failed') throw new Error(job.error);

await new Promise((r) => setTimeout(r, 2000));
}

throw new Error('Timeout');
}

// Core bot functionality (generates value for users)
async analyzeTrade(token: string): Promise<string> {
return this.prompt(
`analyze ${token} price action and give trading recommendation`
);
}

// Revenue collection (funds the bot)
async collectRevenue(): Promise<void> {
const fees = await this.prompt(`check fees for ${this.tokenName}`);
console.log('Current fees:', fees);

await this.prompt(`claim my fees for ${this.tokenName}`);
console.log('Revenue collected');
}

// Health check
async checkBalance(): Promise<string> {
return this.prompt('what are my balances on base?');
}
}

// Usage
const bot = new SelfSustainingBot('MyAgentToken');
await bot.collectRevenue();

Monitoring Sustainability

Track these metrics:

MetricGoal
Daily fee revenueKnow your income
Token trading volumeLeading indicator
ETH/WETH balanceAvailable for gas
Claim frequencyOptimize collection

Scaling Up

As your agent grows:

  1. More features → More value → More users
  2. More users → More trading → More fees
  3. More fees → More compute → Better features

The flywheel effect makes successful agents increasingly sustainable.

Fallback Strategies

If fees aren't covering costs:

  1. Reduce operations — Batch more, cache results
  2. Add premium features — Charge for advanced capabilities
  3. Manual top-up — Add ETH while building volume
  4. Partnerships — Collaborate with other projects