s2ar

env

/v1/env/reset · $0.02 a call · 10 keyless calls a day · paid by x402, credits, mpp

Deterministic environments an agent plays over HTTP: reset opens an episode of baba (Baba-Is-You rules on a tiny board; eleven levels with certified solution lengths) or sokoban (generated into a certified push band), step plays one action and answers the observation, the reward, done, the legal actions and a chained digest, and when the episode ends it is sealed as a signed record — the env version, the core's sha, the seed, the level, every action and reward, the final state — that anyone replays to the same digest and verifies free at /v1/verify/{record_sha256}. One price per episode, the steps free; an episode left open past its window (600 s; 50 s on x402) is never charged. A scorecard seals mean return and win rate over your episodes under your policy label. GET /v1/env is the catalogue.

Call it

curl 'https://api.s2ar.dev/v1/env/reset?env=baba&seed=0'
curl -X POST https://api.s2ar.dev/v1/env/reset \
  -H 'content-type: application/json' \
  -d '{"env": "baba", "seed": 0}'

With a key: add -H 'Authorization: Bearer $S2AR_KEY'. Over x402, while sales are open: the same call at https://api.s2ar.dev/x402/v1/env/reset; unpaid, it answers 402 with the accepts[] to sign, then send the payment as PAYMENT-SIGNATURE (or X-PAYMENT). Sales are paused since 2026-10-16, and the mirror answers 410. From an agent: the MCP tools env_episode, env_reset, env_scorecard, env_step at https://api.s2ar.dev/mcp.

Parameters

parametertyperequiredwhat
envstringbaba (default) or sokoban
seedintegerthe seed (default 0): picks or generates the level, deterministically
levelstringbaba: a level name from GET /v1/env instead of the seed's pick
bandstringsokoban: easy (default), medium or hard

The answer

{
 "ok": true,
 "episode_id": "ep_3f9a…",
 "env": "baba",
 "version": "baba/1",
 "core_sha": "…",
 "seed": 0,
 "level": "route_to_win",
 "horizon": 16,
 "ply": 0,
 "obs": {
  "ascii": "BIY\n...\nb.f\n...\nFIN",
  "ply": 0,
  "drift": "R"
 },
 "legal": [
  "U",
  "D",
  "R"
 ],
 "digest": "…",
 "expires_in_s": 600,
 "rail": "credits",
 "price_usd": 0.02,
 "charged_usd": 0.0,
 "step": "https://api.s2ar.dev/v1/env/step"
}

Every paid answer carries its receipt; a record's sha256 re-verifies free at /v1/verify/{sha256}. A call that fails is never charged.

A worked example

play an environment: the call, its answer and its record, re-derived.

The errors are the same on every route.