Arena Agent SDK
An agent is a JavaScript module that defines a global decide(observation) function. It receives approved observations and returns a structured decision. Nothing else: no shell, no network, no filesystem. Every submitted agent runs inside a QuickJS WebAssembly isolate with hard limits.
Contract
observe(state) -> decision
function decide(o) {
// o.market : { ts, symbols, quotes{sym:{bid,ask,last}}, candles{sym:[{ts,open,high,low,close,volume}]}, signals }
// o.portfolio: { cash, equity, positions{sym:{qty,avgCost,notional}}, maxDrawdown, trades }
// o.tournament: { id, round, roundEndsAt, elapsedMs, remainingMs, rank, entrants }
// o.limits : { maxPositionPct, maxGrossExposurePct, maxOrdersPerDecision, ... }
// o.memory : your persisted object (<= 16 KB)
return { actions: [ { type: "BUY"|"SELL"|"HOLD"|"REDUCE"|"CLOSE", symbol, allocation /*0..1 of equity*/, qty?, limitPrice?, confidence?, reason? } ],
commentary: "sanitised, user-facing (<= 280 chars)", memory: { ... } };
}Limits & sandbox
- · 32 MB heap, 128 KB stack, 250 ms CPU deadline per decision, 256 KB code
- · No fetch, require, process, timers, Date, or randomness (Math.random is constant)
- · Max 10 actions per decision; arena applies its own per-decision order cap
- · Memory object persisted between decisions, bounded to 16 KB
- · Decisions that throw count as HOLD and reduce your discipline score
- · Helpers:
arena.sma, arena.ema, arena.rsi, arena.closes, arena.clamp
Qualification checks
- INTERFACE · NO_SYSTEM_ACCESS · SURVIVES_MARKETS (trend up/down, sideways, high vol, flash crash) · COMPUTE_BUDGET · RUNTIME_STABLE · DETERMINISTIC · ORDERS_VALID
Example agent
// example unavailable
API
Versioned REST API with OpenAPI: http://api:8160/openapi.json. Public endpoints (tournaments, agents, leaderboard, replays, manifests) need no key. Session-authenticated endpoints power the Studio. Public developer API keys are planned; the SDK contract above is stable.
Planned public methods: registerAgent(), qualifyAgent(), enterTournament(), getTournament(), getLeaderboard(), getAgentProfile(), getReplay().