> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eucaengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The world-engine API

> The four verbs that make Euca a world engine, not just a game engine — read the exact state, read the exact next-step odds, advance deterministically, and branch counterfactually.

Euca runs a world *and* hands you its exact, readable, forkable truth. That second face — the **world
engine** — is four verbs over one deterministic ECS substrate. Three are first-class HTTP routes on the
[`:3917` server](/quickstart); the fourth, `peek`, is the analytic answer-key read that powers
[evaluation](/evaluation/overview).

<CardGroup cols={2}>
  <Card title="observe" icon="eye">
    The full ECS state, read out exactly **without stepping** — facts, not pixels. `POST /observe` →
    a [flat table](/concepts/world-as-table) of entities and components.
  </Card>

  <Card title="peek" icon="dice">
    The **exact** probability distribution over the next step's outcome, read *analytically* from the
    declared generative model — not sampled. The answer key.
  </Card>

  <Card title="step" icon="forward">
    Advance one tick **deterministically**, sampling from *exactly* the distribution `peek` reported.
    `POST /step`.
  </Card>

  <Card title="fork" icon="code-branch">
    Clone the world mid-episode and branch a **counterfactual** (the do-operator) — change one
    action, the rest stays bit-identical. `POST /fork`. See [Forks](/concepts/forks).
  </Card>
</CardGroup>

## observe — exact current state

`POST /observe` returns every entity as a flattened, machine-readable projection (`RichEntityData`),
addressable by id. No interpretation, no pixels — the [world as a table](/concepts/world-as-table). It
does **not** advance time.

## step — deterministic advance

`POST /step` runs the shared schedule N ticks. Given the same seed and inputs, the trajectory is
[bit-identical](/concepts/determinism). Stepping consumes the world's single sanctioned RNG stream.

## fork — counterfactual branching

`POST /fork` deep-clones the world into an isolated branch; you apply an intervention and step the fork
without touching the main world. The same systems run on the fork, so a counterfactual is a true
do-operator, not an approximation. [Full guide →](/guides/fork-for-what-ifs)

## peek — the exact next-step distribution

`peek` is what makes Euca an *answer key*: it reads the **true** distribution over the next step's
declared stochastic outcomes — as a distribution, not a sample — directly from the generative
[rules](/concepts/rules-as-data). Only a white-box, executable world can report its own exact next-step
odds, because the randomness is declared in the code. `peek` is first-class in the `euca-online`
world engine and is surfaced through the truth-hiding [evaluation](/evaluation/overview) boundary
(it is deliberately **not** a plain `:3917` route — a contestant must never see the truth during a
scored run).

<Note>
  **The soundness invariant: `peek == step`.** A named test holds the distribution `peek` reports to be
  byte-for-byte the one `step` samples from. No rounding, no approximation. This is why a perfect
  predictor scores exactly **0 nats** of [regret](/evaluation/overview), and why counterfactual
  predictions can be graded against forked exact distributions.
</Note>

## Scope — what's exact, and what isn't

The exact distribution covers the **declared discrete/categorical** layer — a rule fires or not, a
branch outcome. Continuous physics evolves **deterministically** (a point next-state, not a
distribution). So "exact distribution" means *the declared variables' true odds*, not a full predictive
density over every position and velocity. See [Determinism](/concepts/determinism) for the
reproducibility guarantee and [Evaluation](/evaluation/overview) for how this becomes a score.

<Card title="The four verbs in action" icon="flask" href="/guides/fork-for-what-ifs" horizontal>
  A runnable walkthrough: observe a world, fork it, intervene, and compare.
</Card>
