Principle:AIScientists Dev WorldSeed Server Launch
| 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:
- Load config: Parse CLI args, load scene config via `load_config()`
- Create DM provider: If a `--dm-model` is specified, create a `LiteLLMDMProvider`
- Create recorder: `RunRecorder` for persistence
- Create WorldEngine: With config, DM provider, recorder
- Create FastAPI app: `create_app()` wires all route modules
- Start Uvicorn: ASGI server with configurable host/port
- Wait for health: Probe the `/api/health` endpoint
- 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.