Run an autonomous agent
Fork V6 introduces agentic mining: a miner runs a multi-step loop with tool calls (web search, chain queries, math), emitting one AGENT_STEP tx per iteration. You pay only for tokens actually generated — billing is per-token with escrow + refund.
Lifecycle
USER MAINNET MINER
[AGENT_REQUEST] │ │
├─ escrow maxFee (default 1 OMBRA) ───────────►│
├── P2P broadcast ──────────────►│
│ [agent listener]
│ ├─ AGENT_CLAIM
│ ├─ loop:
│ │ LLM call w/ tools
│ │ AGENT_STEP × N
│ └─ AGENT_FINISH
│◄───────────────────────────── │
│ settle: minerReward, refund │
Billing constants
| Constant | Value | Meaning |
|---|---|---|
AGENT_REWARD_PER_TOKEN | 1 micro | 0.000001 OMBRA per output token |
AGENT_NETWORK_FEE_PER_STEP | 100 micro | 0.0001 OMBRA per AGENT_STEP tx |
CHAT_TURN_FEE | 100 micro | Public chat message fee |
maxFee is escrowed at request time. At finish:
minerReward = totalTokensOut × AGENT_REWARD_PER_TOKENnetworkFee ≈ steps × AGENT_NETWORK_FEE_PER_STEPuserRefund = maxFee − minerReward − networkFee(returned to submitter)
Available tools
A miner advertises which tools it implements. The user picks a subset (whitelist). Common tools:
- Chain read —
chain_get_balance,chain_get_height,chain_get_block,chain_get_tx,chain_list_nfts,chain_recent_blocks,chain_list_validators - Utilities —
now,date_parse,date_diff,math_eval,regex_match - Web —
web_search,fetch_url
The full list is enumerated by GET /api/agent/v6/tools on the miner's local IPC (not exposed publicly).
Example: agent run
- TypeScript
- Python
- cURL
import {
OmbraClient, Wallet,
buildAgentRequestTx,
computeAgentRunId, computeConversationId,
MICRO_OMBRA,
} from "@ombrachain/sdk";
const client = new OmbraClient({ endpoint: "https://api.ombra-net.com" });
const wallet = Wallet.fromMnemonic("...");
const acct = await client.chain.getAccount(wallet.address);
const runId = computeAgentRunId(wallet.address, acct.nonce, "What's my balance?");
const convId = computeConversationId(wallet.address);
const tx = buildAgentRequestTx(wallet.address, {
agentRunId: runId,
conversationId: convId,
prompt: "What's my balance and how many NFTs do I own?",
toolsWhitelist: ["chain_get_balance", "chain_list_nfts"],
maxFee: BigInt(MICRO_OMBRA), // 1 OMBRA escrow
maxSteps: 100,
}, acct.nonce, wallet.privateKey);
await client.chain.submitTx(tx);
// Poll status + steps
for (let i = 0; i < 60; i++) {
await new Promise((r) => setTimeout(r, 2000));
const res = await fetch(`https://api.ombra-net.com/api/agent/v6/run/${runId}`);
if (!res.ok) continue;
const run = await res.json();
if (run.status === "completed") {
console.log("answer:", run.finalAnswerInline);
console.log("tokens:", run.totalTokensOut, "reward:", run.minerReward, "refund:", run.userRefund);
break;
}
}
import time
from ombrachain import (
OmbraClient, Wallet,
build_agent_request_tx,
compute_agent_run_id, compute_conversation_id,
MICRO_OMBRA,
)
client = OmbraClient(endpoint="https://api.ombra-net.com")
wallet = Wallet.from_mnemonic("...")
acct = client.get_account(wallet.address)
run_id = compute_agent_run_id(wallet.address, acct["nonce"], "What's my balance?")
conv_id = compute_conversation_id(wallet.address)
tx = build_agent_request_tx(wallet.address, {
"agentRunId": run_id,
"conversationId": conv_id,
"prompt": "What's my balance?",
"toolsWhitelist": ["chain_get_balance"],
"maxFee": MICRO_OMBRA,
"maxSteps": 50,
}, acct["nonce"], wallet.private_key)
client.submit_tx(tx)
for _ in range(60):
time.sleep(2)
run = client.get_agent_run(run_id)
if run.get("status") == "completed":
print("answer:", run["finalAnswerInline"])
break
# Inspect a pending run
curl https://api.ombra-net.com/api/agent/v6/run/AGENT_RUN_ID
# List all steps emitted so far
curl https://api.ombra-net.com/api/agent/v6/run/AGENT_RUN_ID/steps
# List pending runs (for miners)
curl 'https://api.ombra-net.com/api/agent/v6/by-status/pending?limit=20'
Browser flow via window.ombra
If you're building a dApp, use the Ombra Wallet extension instead of holding private keys:
const result = await window.ombra.request({
method: "ombra_submitAgentRequest",
params: {
prompt: "What's my balance?",
toolsWhitelist: ["chain_get_balance"],
maxFee: "1000000",
maxSteps: 50,
},
});
console.log("agentRunId:", result.agentRunId);
The extension opens an approval popup with prompt + escrow details, then signs with the user's wallet.
See Recipes › Submit agent run for full SSE streaming + step rendering.