Skip to content
Sandworld

Search the docs and guides

    Open this page as Markdown
    On this page

      Quickstart

      Sandworld environments are deterministic twins of real app categories. An agent acts only through typed tools; when it's done, the task's verifier checks the final state and tells you exactly which checks passed. Three calls cover the whole loop.

      Your API key

      The public worlds need no key: anyone can run them, rate-limited per IP. A key gives you higher limits and keeps your episodes visible only to your organization. Create one in your workspace under API keys and send it on every request as a bearer token:

      HTTP header
      Authorization: Bearer sw_live_…

      The samples below read it from SANDWORLD_API_KEY. Without the variable they still run, on the public limits. See Authentication for scopes.

      1. Start an episode

      curl -s -X POST https://sandworld.dev/api/v1/environments/quickbasket/episodes \
        -H "authorization: Bearer $SANDWORLD_API_KEY" \
        -H "content-type: application/json" \
        -d '{"task_id": "qb-01", "seed": 7, "agent_name": "my-agent"}'

      The response has the episode_id, the user's instruction, the app's policy and the tools with JSON schemas. Give all three to your agent.

      2. Call tools

      curl -s -X POST https://sandworld.dev/api/v1/episodes/$EPISODE_ID/step \
        -H "authorization: Bearer $SANDWORLD_API_KEY" \
        -H "content-type: application/json" \
        -d '{"tool": "list_delivery_slots", "arguments": {}}'

      Each step returns the tool's observation — the same information a user of the app would see. Errors come back as data, the way a real API returns them.

      3. Submit for verification

      curl -s -X POST https://sandworld.dev/api/v1/episodes/$EPISODE_ID/submit \
        -H "authorization: Bearer $SANDWORLD_API_KEY"

      You get pass, a score and every check with detail. Use the checks as a reward signal, or open the episode in the workspace to replay it step by step.

      With the Python client

      The Python client (standard library only) wraps the same three calls and adds a Gymnasium-style wrapper. It reads the same SANDWORLD_API_KEY:

      Shell
      pip install https://sandworld.dev/files/sandworld-python.tar.gz
      Python
      from sandworld import SandworldEnv
      
      env = SandworldEnv("quickbasket", task_id="qb-10")     # SANDWORLD_API_URL, SANDWORLD_API_KEY
      obs, info = env.reset(seed=1)                          # info["tools"], info["policy"]
      obs, reward, terminated, truncated, info = env.step(
          {"tool": "get_order", "arguments": {"order_id": "QB-10388"}}
      )
      obs, reward, terminated, truncated, info = env.step({"tool": "submit"})
      print(reward, info["verification"].failed_checks)

      It also picks tasks by how often the published models solve them (tasks by difficulty), and starts episodes with a user style for the simulated user:

      Python
      from sandworld import Sandworld
      
      sw = Sandworld()
      # tasks some published models solve and others don't
      for t in sw.list_tasks(pass_min=0.01, pass_max=0.99):
          print(t["environment"], t["task_id"], t["difficulty"]["any_model"]["pass_rate"])
      # Bench Hard tasks one model fails
      hard = sw.list_tasks(suite="hard", model="gemini-3.5-flash-lite", pass_max=0)
      
      # a user who answers vaguely at first (default, impatient, vague or skeptical)
      ep = sw.start("quickbasket", task_id="qb-16", seed=1, user_style="vague")
      print(ep.user_style, ep.step("ask_user", {"message": "Which address should I send it to?"}).result)

      SandworldEnv(..., user_style="skeptical") takes the style too. To run Claude on any task end to end, see Use Claude as the agent.

      Next

      • API reference — authentication, every endpoint, training signals, fault injection, the local server.
      • Evaluate any model — Claude, OpenAI, Gemini, OpenRouter or your own endpoint (vLLM, SGLang…), with failure reasons.
      • Run from CI — Bench Hard on every release, with JUnit results, a scorecard and a score badge.
      • Computer use — operate the twins through their screens and measure the GUI tax.
      • MCP server — connect Claude.ai, ChatGPT, Cursor or any MCP client by URL, or run it locally.
      • Lab exports — a Docker image per world, and OpenEnv, Verifiers, Inspect and Gymnasium packages.
      • Harbor packages — export tasks as Harbor task directories for your own harness.
      • Open datasets — verified trajectories and preference pairs for SFT and DPO.
      • Environment spec — how twins, tasks, verifiers and QA probes are defined.