Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:AIScientists Dev WorldSeed Server Launch

From Leeroopedia
Knowledge Sources
Domains Deployment, API_Design
Last Updated 2026-10-26 18:00 GMT

Overview

A CLI-driven server launch process that loads a validated scene config, initializes the WorldEngine with an optional DM provider, starts a FastAPI HTTP/WebSocket server via Uvicorn, and exposes agent registration, perception, action, and management endpoints — supporting both bare-engine and OpenClaw gateway modes.

Description

The `worldseed play` CLI command launches the full WorldSeed stack. Two runtime modes:

  • none (default): Bare engine + HTTP/WS server. Agents are driven externally by any runtime using `POST /act`, `GET /perceive`, `GET /perceive`. Ticks auto-start when all preset agents register. No OpenClaw, no gateway.
  • openclaw (legacy): Auto-spawn the OpenClaw gateway, wire the WebSocket connector, wait for preset agents to register via plugin, then start ticks.

The launch process:

  1. Load config: Parse CLI args, load scene config via `load_config()`
  2. Create DM provider: If a `--dm-model` is specified, create a `LiteLLMDMProvider`
  3. Create recorder: `RunRecorder` for persistence
  4. Create WorldEngine: With config, DM provider, recorder
  5. Create FastAPI app: `create_app()` wires all route modules
  6. Start Uvicorn: ASGI server with configurable host/port
  7. Wait for health: Probe the `/api/health` endpoint
  8. Register agents: Pre-populate or wait for external registration

The HTTP API exposes: agent register/perceive/act, world start/stop/resume, director signals, gazette generation, GM narrative commands, run data/replay, settings, and SSE event streaming.

Usage

Use this principle to launch a WorldSeed simulation. Run `worldseed play --config <path> [--port 8000] [--dm-model "provider/model"] [--agent-runtime none|openclaw]`.

Theoretical Basis

The launch follows a config-to-server pattern:

# Abstract launch (NOT real implementation)
def play(args):
    config = load_config(args.config)
    dm_provider = LiteLLMDMProvider(args.dm_model) if args.dm_model else None
    recorder = RunRecorder(run_id, config_path, scene_id, dm_model)
    engine = WorldEngine(config=config, dm_provider=dm_provider, recorder=recorder)
    app = create_app(engine)
    uvicorn.run(app, host=args.host, port=args.port)
    wait_for_health(app)

The server is stateless from the API perspective: state is read from disk (state.json), not from the engine's in-memory state. This decouples the API from the tick loop.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment