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

# Read the current observation (passive)



## OpenAPI

````yaml /train-v1.yaml get /v1/sim/sessions/{id}/obs
openapi: 3.1.0
info:
  title: Alakazam Train API
  version: 1.0.0
  summary: >-
    Train policies inside a world model, certify them in a frozen physics
    oracle.
  description: >
    The **Train API** runs the dream-training pipeline as reproducible jobs:


    1. TRAIN: CMA-ES evolves a 6-parameter controller *inside the doom world
       model* (the same public checkpoint as
       [`alakazamworld/doom-dungeon-hg`](https://huggingface.co/alakazamworld/doom-dungeon-hg)
       on Hugging Face, byte-identical, sha256-verified).
    2. EXAM: the champion is replayed in a frozen Webots oracle (two physical
       worlds, fixed contract, anti-exploit control arms). The oracle is the
       sole scoreboard; dream fitness is never a capability claim.

    One `POST /jobs` does both and leaves a machine-readable `job.json` you can

    poll at any time, jobs are asynchronous, kill-tolerant, and append-only.


    ### Honest verdict semantics

    The exam verdict has four bars per world (contacts, clearance, coverage,

    path). Warm-started jobs reproduce the historical best-known profile,
    contact-safe

    (0 contacts in 40/40 episodes), but no policy in program history has

    passed all four bars. A `pass: false` verdict with clean

    contacts is the expected state of the art, not an error.


    ### Reproducibility

    Training is bit-deterministic for a given spec seed **on a fixed platform**;

    champions differ across platforms (macOS-arm64 vs Linux-amd64 float paths).

    Exam results are deterministic to aggregates (third-decimal physics drift).


    ### Availability & timings

    The serving VM runs on-demand (it is started for sessions, not 24/7).

    Measured wall-times, serving VM (e2-standard-2; CPU generation varies

    per boot): smoke job (`pop 6, gens 2, T 20`) 12-17 min; real-scale

    (`pop 10, gens 8, T 60`) 3-4 h; exam alone 4-6 min. Poll `GET
    /jobs/{job_id}`, never block on the POST.
servers:
  - url: https://api.alakazam.gg/train
    description: >
      The Train jobs + exam API. Bearer-key auth; the serving VM behind it is
      start-on-demand, so coordinate a session window with us before calling.
security:
  - bearerAuth: []
tags:
  - name: Jobs
    description: Submit and poll dream-training jobs.
  - name: Simulation gym
    description: >
      **Beta, self-hosted runner.** Drive a world headlessly as a training
      environment (gym) and stream the SNN-controller observation contract: two
      virtual proximity sensors, a terminal collision spike, object labels, and
      an optional square RGB camera. The same schema is emitted offline by the
      dataset exporter (JSONL episodes), so controllers trained on recorded data
      plug straight into the live loop. Each session holds a real world-model
      GPU stream, sessions are metered by wall-time; create only as many
      parallel environments as your session budget allows, and DELETE them when
      done.
paths:
  /v1/sim/sessions/{id}/obs:
    servers:
      - url: '{runner_url}'
        description: >
          Simulation-gym endpoints are served by the self-hosted runner
          (gym-server.mjs), NOT by the jobs VM, your runner URL is provided with
          your key.
        variables:
          runner_url:
            default: https://your-runner-url.example
    get:
      tags:
        - Simulation gym
      summary: Read the current observation (passive)
      operationId: getSimObservation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Current observation, no action applied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimObservation'
        '404':
          description: Unknown session
components:
  schemas:
    SimObservation:
      type: object
      description: >
        The SNN-controller observation contract. `proximity` = two virtual range
        sensors (0 = clear, 1.0 = contact range): compact obstacles grade by
        screen-space closeness, walls/elongated structures by time-to-contact;
        an object dead ahead excites both. `collision` is a TERMINAL SPIKE , 
        true exactly once, on the step the contact engine confirms the hit , 
        after which `done` stays true until reset.
      properties:
        proximity:
          type: object
          properties:
            left:
              type: number
              minimum: 0
              maximum: 1
            right:
              type: number
              minimum: 0
              maximum: 1
        collision:
          type: boolean
          description: >
            SPIKE, true exactly once per collision event (derived from the
            monotonic counter, so a pulse between two step reads is never
            missed). With terminal_collision=false the run continues and later
            events spike again.
        collision_count:
          type: integer
          description: Monotonic count of collision events this run.
        done:
          type: boolean
          description: >-
            Only latches when terminal_collision=true (or the world ends the
            run).
        t_ms:
          type: integer
          description: Milliseconds survived this run.
        sensor_age_ms:
          type:
            - integer
            - 'null'
          description: >
            Lag accounting, how stale the sensor side (proximity/labels) is
            relative to the camera frame in the same observation. Cloud-detector
            worlds run ≈500–1000 ms behind; local-detector worlds tens of ms.
            Controllers should compensate or discount accordingly.
        applied_action:
          type: string
          description: >-
            The discrete action actually applied (echoes wheel quantization).
            Present on step responses.
        labels:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: Persistent tracker id (`obj_<n>`).
              type:
                type: string
                description: Normalized category (robot
                wall: null
                box: null
                barrier: null
                cone: null
                ...).: null
              confidence:
                type: number
        camera:
          type: object
          description: Present when the session requested a camera resolution.
          properties:
            image:
              type: string
              description: Square RGB frame as a data-URL JPEG.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Single per-partner bearer key, provisioned by Alakazam.

````