INNER CODE UNIT · Python
create_app
AIScientists-Dev/WorldSeed · src/worldseed/server/app.py:49
def create_app(
engine: WorldEngine | None = None,
tick_interval: float = 1.0,
run_id: str = "",
port: int = 8000,
auto_start_tick: bool = True,
) -> FastAPI:
"""Create a FastAPI app, optionally pre-wired to an engine.
If engine is None, starts in lobby mode — dashboard shows Setup page.
If engine is provided, starts in running mode immediately.
auto_start_tick: if False, tick_runner is created but NOT started on
app startup. Used by `play` command where tick starts only after all
agents self-register via WebSocket.
"""
if run_id and not run_id.strip():
run_id = ""