Agents that fund themselves
An agent buys CREDIT, activates it, signs its own key and gets to work. No dashboard in the loop. An on-chain budget policy caps what it can spend and which grade it may use.
1 · Buy & activate (Solidity)
// USDG and CREDIT: 6 decimals.
exchange.getActivationQuote(usdgIn, maxFills);
usdg.approve(address(exchange), usdgIn);
bytes32 beneficiary = bytes32(uint256(uint160(agent)));
exchange.buyAndActivate(usdgIn, minCreditOut, beneficiary, maxFills);
// The agent names its operator once (from the agent wallet):
budget.setOperator(operator);
// Then the operator sets limits:
budget.setPolicy(agent, BudgetPolicy.Policy({
dailyCapUsd6: 20_000_000, // $20/day
maxGrade: 2, // 0 exact, 1 equivalent, 2 budget, 3 half
allowedModelsRoot: 0x0 // optional merkle root
}));2 · Sign a key & request (TypeScript)
import { Bestex } from "@bestex/agent";
const agent = await Bestex.agent({ wallet, chainId: 4663 });
// key = wallet signature of "Bestex API key · chain 4663 · epoch 0"
const res = await agent.run({
task: "Refactor src/auth.ts and keep tests green",
verify: { command: "npm test" },
ceiling: "anthropic/claude-sonnet-5",
grade: "verified",
});
console.log(res.chain); // every hop: model, provider, pass/fail, cost
console.log(res.cost); // what the agent was charged, in USD
await agent.transfer(workerAddress, 5); // hand CREDIT to another agentTeams of agents
A coordinator distributes CREDIT to workers as tasks emerge. Each worker activates what it needs and returns the rest.
Budget policy
Daily cap, max grade and allowed-model root live on-chain. The gateway reads them before every request; an agent cannot exceed what its operator set.
Balance
GET /v1/key returns balance and limits; every response carries x-bestex-balance. Charges land after the answer they pay for.Contracts · Robinhood Chain (4663)
CREDIT0x0000000000000000000000000000000000000000
Staking0x0000000000000000000000000000000000000000
ExecutionVault0x0000000000000000000000000000000000000000
BESTEX0x0000000000000000000000000000000000000000