Skip to main content
This is the agent loop end to end: build a tiny world, play it forward, and experiment on a fork. Every command below is real and runnable against a local server.

Prerequisites

  • macOS or Linux
  • A Rust toolchain (rustup)
  • A clone of the engine repository

1. Start the server

The agent API is served by the headless hosteuca-studio with no window. From the repo root:
It binds localhost:3917. Leave it running and open a second terminal for the commands below.
The local server is unauthenticated by default — run it on a machine you control, driven by an agent on the same host. Optional Ed25519 auth is available; see Hosting & deployment.
Every POST must send -H 'Content-Type: application/json'. Without it the JSON body is rejected and the request looks like it was ignored.
Check it is up:
The headless host boots the loaded project (a full world), so your real entity_count, tick, and the entity ids your spawns return will be higher than the small illustrative numbers shown below — the flow is identical, only the ids differ. (For an empty world, build your own host that loads no level.)

2. Build a world

Spawn two entities and add a rule. Entity A gets a velocity and a Kinematic physics_body so a system actually moves it; entity B is a stationary target on the other team.
Add a rule — logic is data, not code. This one heals any entity that drops below 50 health:

3. Play it

Step the simulation forward, then read the world back:
observe returns the whole world — the loaded project’s entities plus the two you spawned. Picking your two rows out of it, entity A has advanced along +x (30 ticks at 1 unit/s, with dt = 1/60) while B has not moved (ids shown illustratively as 1/2 — yours will be the higher ids your spawns returned):
The full observe dump is the whole world as a flat table — see The world as a table. (Below, T is whatever tick the world is at when you fork; the numbers diverge relative to it.)

4. Experiment on a fork

Fork the world, run a what-if only on the copy, and confirm the main run never moved.
The fork advanced 100 ticks while the main world stayed exactly where it was. That clean divergence — the same systems running on an isolated copy — is what makes a fork a true counterfactual.

Going further

  • Diff two moments — snapshot the world with POST /snapshot, change it, snapshot again, and compare with GET /snapshot/diff (it compares game-state summaries: counts, phase, roles).
  • Save and replay — export the whole world as a scenario with GET /scenario and rebuild it with POST /scenario. See Determinism & replay.
  • Full API — every endpoint, request, and response is in the API reference.
  • Grade a world model — the same engine doubles as an exact answer key; see World-model evaluation.