Trading tasks for agents on Solana: bots trade DeFi markets replayed on offline mainnet snapshots with Surfpool.
harbor run -d solana-foundation/machine-trading@17harbor download solana-foundation/machine-trading@17Trading tasks for agents on Solana. In each task the agent writes a bot. The bot is then graded on hidden market scenarios replayed against an offline copy of Solana mainnet, restored with Surfpool.
| Task | Market | A good bot… |
|---|---|---|
backrun-sol-usdc |
Orca Whirlpool and Raydium CLMM, SOL/USDC | reacts in the trigger's slot, sizes the cycle to the fee band through both curves, and bids only what it must to beat the other searchers |
backrun-thin-pools |
Orca Whirlpool and Raydium CLMM, ten pools over SOL, USDC, JitoSOL, JTO and GEOD | searches a graph of pools for the cycle that the latest swap opened, and skips cycles whose fees eat the gap |
flash-crash-nvda |
Phoenix NVDA perp | tells a shock from noise, rides the ones that keep going and cuts the ones that turn, and pays for every move it trades |
funding-carry-sol |
Phoenix SOL perp | prices the carry Phoenix will actually pay on the session's clock, weighs it against what trading costs, and reads how rich this session's basis is |
liquidation-flash |
Kamino main market, SOL/USDC | reads the price upstream of Kamino's oracle, sees an obligation cross its liquidation threshold before the oracle shows it, and pushes the update, liquidates with a flash loan and sells the collateral in one transaction, bidding only what it must to land ahead of competing liquidators |
market-making-cbrs |
Phoenix CBRS perp | earns the spread where the flow pays for it, and stays out of the way of informed flow and stale quotes |
weekend-gap-spcx |
Phoenix SPCX perp | knows what the reopen keeps of a weekend's move, tells the traders who know where it opens from the ones who don't, and sizes for the open's spread |
Planned tasks are
issues labelled new task.
Every release is in the changelog.
Each task has one headline score (headline = "headline" in
[metadata.mtx]). Harbor's reward is that score clamped between 0 and 1.
The scorer puts PnL on a scale with three anchors measured
on the same sessions: doing nothing scores 0, the task's reference 0.5,
and its informed bot 1. The informed bot knows everything the task's data
could tell in principle but not the session's future randomness, and trades
under the same costs and limits, so 1 is reachable. Losses count 1.5 times,
drawing down far deeper than the anchor costs a near-breach charge, a breach
scores at least the whole loss limit lost and costs the run 1.25 times its
breach rate (0.0125 a point of rate), and a refused call or tampering scores −1. The agent is told
all of it: mtx task sync writes the rules into the task's
instruction.md from the grader's settings (between its mtx:scoring
markers). How and why, with worked examples: grading.
A task using headline scoring has both anchors, a reference in the strength band (on
the ladder's sets, its loss-weighted PnL is 0.2 to 0.7 of the informed bot's,
so it is never anchor_floored, and its per-session Sharpe at least 0.25),
and opts into the probe gate. Until it has all of them it isn't released:
there is no fallback to reward and skill or to the hindsight ceiling, and
mtx gates refuses it. mtx task new scaffolds all of it, and the
new-task checklist walks through it.
Every session carries a mandate. It works like a trading desk's limits: one market, a position cap, and a loss limit. The grader checks the bot against it after every step (two slots):
| Rule | How it's checked |
|---|---|
| Trade only the task's market | No position or order on any other market. A second read confirms it, so a requote in flight doesn't count. |
| Position cap | The position, long or short, never exceeds the cap at any step. |
| Loss limit | The account's value never falls further below its running peak than the limit. |
| Standard RPC only | The bot never calls a method the RPC proxy refuses, such as a cheatcode. |
| Solvent at the end | The account doesn't end the session liquidatable. |
Breaking any rule in any session sets the whole grade to 0, for both
reward and skill. The verifier stops at the first breach. A breach never
scores better than complying.
Within the limits, risk is reported, not scored:
| Statistic | Definition |
|---|---|
worst_pnl_usd |
The worst session's PnL. |
tail_pnl_usd |
The mean PnL of the worst sixth of sessions. |
max_drawdown_usd |
The deepest any session's account value fell below its running peak (net of the hold in a net-scored session). |
profitable_share |
The share of sessions that made money. |
sharpe |
Mean session PnL over its standard deviation, per session and not annualized. |
These statistics are left out of the score on purpose. Over a few dozen short sessions they're noisy, and a score that blended them in would reward whatever weights it picked. The loss limit is the risk rule that's enforced. A bot that trades recklessly still has to stay inside it in every session.
A grade is void, rather than 0, when the baseline it's measured against is
broken: the reference bot breaks its mandate, crashes, or overruns its
turns. Some tasks add void conditions of their own. A void trial gets no
reward. bench/report.py lists it as void rather than scoring it 0;
re-run it on the same set.
The verifier receives only the agent's /app/bot, and it has no network.
It draws the hidden set from the batch's secret (MTX_EVAL_SEED, which no
task ships) and grades the reference on it first. Then, for each session:
mtx-turn-1). Nothing moves while the bot
thinks, so grades replay exactly.The agent's own environment has a Rust toolchain, the mtx-kit SDK, a
starter bot that builds but never trades, practice scenarios, the scenario
generator, and mtx-practice. mtx-practice grades a bot exactly as the
verifier does.
A task can give the agent a clock: time-left prints how much of the
agent's time limit is left. It's on every agent's PATH, and a task opts in by
setting MTX_AGENT_TIMEOUT_SEC (its [agent] timeout_sec) and
MTX_AGENT_TIMEOUT_MULTIPLIER = "${MTX_AGENT_TIMEOUT_MULTIPLIER:-1}" in its
[environment.env]; just bench exports the multiplier. The time starts
with the agent's harness, the oldest process of the agent's user.
What's public: the generator ships to agents, so the family of
scenarios is known. Each batch's draws aren't, and reports carry only the
SHA-256 of the batch's secret. Every trial in a batch is graded on the same
set. Before 0.9.0 the hidden scenarios shipped in each task's tests/, so
scores on those versions are a development signal, not a held-out
evaluation.
--jobs is only for trusted bots.Every task's README has the same sections, in this order. Anything every task shares belongs in this file, not in a task's README.
# solana-foundation/<task>
One sentence: what the agent's bot does, on which market.
| | |
| --- | --- |
| Market | venue, instrument, snapshot date |
| Sessions | hidden per grade, and how they split by regime; practice scenarios |
| Mandate | position cap, loss limit |
| Bound | what the reward divides by |
| Reference | its reward, and what it does in one line |
| Anchors | scoring: the reference (0.5) and what the informed bot (1) knows, one line |
## The skill
The thesis ("a good bot profits here because it ___"), what wins, and the
habits that lose.
## The market
The scenario family: what moves, how often, and what the agent can observe.
## Scoring
Only what's specific to this task: how the bound is computed, how the
account is valued, and any extra void or disqualifying conditions.
## Baselines
The check table (oracle, nop, cheater, sneaky), the ladder, and the
reference's numbers on fresh sets.
## Realism limits
What the simulation doesn't model.
## More
Links to DESIGN.md (why the task is built this way) and instruction.md
(the agent's contract).