Build your own spatial tasks
Define the observations, actions and scoring rules for your environment. Playtest each action, evaluate controllers on the same seeds, and inspect the exact decision behind a failure.
How a task runs
World is where you author the scene and its camera. A task is a versioned bundle that decides what the controller sees, which actions it can send, and what counts as success. Spatial Bench resets the task with a seed, sends an observation to the controller, validates its action, then records the resulting observation, state fingerprint and reward.
- Observation
- JSON data and an optional PNG. Provide the information the controller should be able to use, such as a camera frame or an estimated pose.
- Action
- A named operation with declared arguments, such as
movewith a selected box and two impulse components. - Feedback
- The task’s reward, completion flag, success flag and reason. Multiple actions can earn partial credit before an episode ends.
- Replay
- The saved actions are applied to fresh state using the recording build. The verifier checks observations, private state fingerprints and feedback at each step.
Run Dispatch in a terminal
Extract Spatial Bench on an Apple silicon Mac running macOS 26.1 or later with Python 3.10+. Open a terminal in the extracted Crescent-Spatial-Bench directory.
runs=$(mktemp -d)
example="$PWD/SDK/examples/SpatialTask"
./spatial-bench custom-task --task "$example/dispatch" \
--policy "reference=$example/reference_policy.py" \
--policy "shortcut=$example/shortcut_policy.py" \
--output "$runs/dispatch"
./spatial-bench custom-task --verify "$runs/dispatch"
open "$runs/dispatch/report.html"The reference controller moves the key onto its pad, confirms it, moves the cargo onto its own pad, then seals the shipment. The shortcut tries to seal immediately and fails the task’s ordering rule. Inspect the action and reward in each run. Both controllers and the full example are in SDK/examples/SpatialTask.
Start with a World scene
- In World, save your scene with a dynamic box collider for the agent, a goal marker, a perspective camera and realtime lighting. Add compatible box colliders for surfaces and obstacles that should participate in physics.
- Open Experiments → Benchmark → Create Custom Task. Select the agent, goal marker and sensor camera. Mark any bodies the agent must avoid and enter an instruction such as “Reach the green marker without touching the blue barrier.”
- Save to a new folder outside the source project. The editor captures the source scene and assets in the bundle and generates the task manifest and Python entrypoint. The starter uses horizontal impulses with fixed-step box physics.
- In Custom Tasks, choose the bundle and select Validate Task. Preflight repeats the reset and first action in two fresh runtime processes.
Use the instruction to tell the controller what to do. Use the Python code to decide whether it succeeded. For “reach the green marker without touching the blue barrier,” the task can finish with failure as soon as forbidden contact is recorded and finish with success when the body enters the goal radius.
First project in Crescent Editor · Native simulation and observation APIs
Define actions and scoring
task.json- Declare
version,id,entrypoint,files,instruction,seeds,max_stepsandactions. List bundle inputs by relative path. task.py- Implement
create(context)and return a task exposingreset(seed),observe(),state()andstep(action). Addclose()for cleanup if needed. - Scene and assets
- An editor-generated starter includes
physics.spatial.json,world.jsonand a project snapshot. Keep all required assets in the bundle when you share it.
A controller sends a JSON object such as the following Dispatch action. Declare each argument in the manifest as a bounded number or integer, a string choice, or a boolean. Keep private verification state, such as whether an earlier requirement passed, in state() along with any scoring-relevant engine fingerprint.
{"action":"move","args":{"box":"key","x":1,"z":0}}Import Observation and Feedback from crescent_task. Use context.library for CSDK-Sim and SceneRuntime(context.renderer, context.metallib) from crescent_scene for a saved Crescent World camera. You can implement sequenced objectives, custom action parameters and scoring in Python. The available built-in physics primitives and scene capture features come from the runtime. Run bundles from authors you trust because task Python executes locally.
Playtest before calling a model
- Open Experiments → Benchmark → Custom Tasks → Playtest and choose the task bundle and seed.
- Choose an action from the contract, enter its parameters, and use Preview First Action. For a sequence, use Add Action, arrange your actions, then select Run Sequence.
- Use the step picker to compare the observations before and after each action, along with its reward and reason. A terminal action ends the episode and the remaining queued actions stay unapplied.
Download dispatch-actions.json into the directory you ran the quickstart from. Run the same sequence used for the recording on this site:
./spatial-bench custom-task --validate "$example/dispatch" \
--seed 21 --sequence dispatch-actions.json --output "$runs/playtest"
open "$runs/playtest/report.html"The report shows 11 of 12 actions applied, a total reward of 1.00 and a successful finish. In Dispatch, confirm changes the task state and reward while the simulation tick and camera stay at the same point. When replay diverges, the validator reports the first mismatching step.
report.html in the output folder to inspect your own recording.Connect a controller or model
- Open Experiments → Benchmark → Custom Tasks → Run Tasks. Use Choose Bundle for a folder containing
task.jsonorsuite.json. You can also choose a bundled example. - Select OpenAI, Google Gemini, Anthropic Claude or Custom. Enter a model ID available to your account and provide the provider's API key. With Custom, enter the full compatible endpoint URL. Select an image-capable model for a task that supplies camera frames.
- Use Check Models to validate one response from each configured endpoint. Enable Send action schema only when the endpoint accepts JSON Schema responses with a root
anyOf. Run Pilot records one episode per controller on the selected seed for a single task. For a suite, select a partition and use Run Suite.
A remote endpoint receives each model-visible observation, including its PNG when present. Run an executable policy locally to exercise the task with no API key.
In the terminal, use --policy name=/path/to/policy.py for a local executable policy. Implement serve_policy from crescent_task to receive the instruction, action contract, decision index and observation over standard input and output. Use --models models.json for Chat Completions endpoints. This example targets a local server already listening on loopback:
{
"models": [
{
"id": "local",
"endpoint": "http://127.0.0.1:8080/v1/chat/completions",
"model_id": "your-loaded-model-id"
}
]
}For remote endpoints use the full HTTPS URL. Set token_env to the name of an environment variable holding the credential. Archive verification plays recorded actions locally without contacting the model.
Run a repeatable suite
Create a suite.json beside your bundles. Give it a version, id and cases. Each case declares its own id, a relative bundle, and disjoint development and evaluation seed lists selected from the task manifest. Use development seeds to iterate and evaluation seeds for held-out measurements.
./spatial-bench custom-task-suite --suite "$example/suite.json" \
--partition evaluation --policy "reference=$example/reference_policy.py" \
--policy "shortcut=$example/shortcut_policy.py" \
--checkpoint "$runs/evaluation.checkpoint" --output "$runs/evaluation"
./spatial-bench custom-task-suite --verify "$runs/evaluation"The checkpoint freezes the selected inputs and saves completed cases. Repeat the same command with the same options, native build and checkpoint path to resume. Completed cases are verified offline and model calls resume from the first unfinished case. Keep the final archive to verify the completed run independently.
Evaluate lighting and export replay video
Use Lighting Variants on a custom task exported from a realtime-lit World. Select a light, multiplier range, lighting seed and shared physics seed. Generate Suite creates development and evaluation cases. Open Lighting Report shows the original and variant camera frames. Use the same controller settings when measuring changes in task performance.
With Parallel Trials, up to eight independent seed and controller trials can run concurrently. Each uses its own runtime. A suite still completes and saves one case at a time.
For a single task, enable Export an HD replay after the run to save video for the first seed and up to two controllers. Use Export HD Video to work from a saved compatible recording. Keep the run archive for observation and action verification.
Find the first changed decision
Choose Compare Runs in Custom Tasks. Select two controllers from compatible archives or one shared archive, then use Verify and Compare → Open Report. The report shows gained and lost successes, rewards and the first differing action with its input observation. Compatible inputs use the same recording build, task files, partition and start seeds.
./spatial-bench compare-custom-task-suites \
--baseline "$runs/evaluation" --baseline-controller reference \
--candidate "$runs/evaluation" --candidate-controller shortcut \
--output "$runs/comparison" --fail-on-regressionIn a CI job, keep the HTML report and original archives as artifacts. Exit status 2 indicates a previous success was lost and the comparison report is available. Status 1 indicates a comparison error. For behavior changes between native builds, use engine release comparison.
Investigate a failed decision
Open the recorded input to see what the controller received before it acted. Use Try Action Offline to supply an alternative and test the simulator's response. Use Retry From Decision when you want the original model to answer again. Follow a worked example with a paired failure report.
Export verified trajectories
In Export Dataset, choose a saved Development run and optionally limit it to successful episodes or one controller. The exporter verifies the source replay before writing dataset.json, episodes.jsonl and optional camera PNGs. Observation i is the input to action i, and observation i + 1 is its result.
./spatial-bench custom-task-suite --suite "$example/suite.json" \
--partition development --policy "reference=$example/reference_policy.py" \
--output "$runs/development"
./spatial-bench custom-task-dataset --run "$runs/development" \
--controller reference --success-only --output "$runs/demonstrations"
./spatial-bench custom-task-dataset --run "$runs/development" \
--verify "$runs/demonstrations"The export accepts development runs so held-out observations stay outside the training dataset.