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 Config Loading Validation

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

Overview

A multi-stage validation pipeline that loads a scene configuration from YAML, resolves preset imports, enforces a Pydantic schema, and runs static reference, physics, smoke, and sanity checks before a world can be launched.

Description

Scene configuration in WorldSeed is a single YAML file that defines the entire world — entities, agents, actions, effects, preconditions, consequences, DM rules, perception, narrator, and director settings. Config loading and validation is the gatekeeper that ensures this declarative specification is structurally sound before the engine begins simulation.

The pipeline has five levels:

  1. Schema (Level 1): Pydantic models (`SceneConfig`) enforce type constraints, required fields, and cross-field validators at parse time.
  2. References (Level 2): Static checks verify that entity IDs referenced in effects, preconditions, and relationships exist; that the action graph is connected; and that enum sources are valid.
  3. Physics (Level 3): Simulates N ticks with no agents to verify resource trajectories and consequence triggers behave as expected.
  4. Smoke (Level 4): Attempts each action with each agent in the initial state to confirm executability.
  5. Sanity (Level 5): Runs the config's own declared `sanity_checks` section.

This layered approach catches errors early — from typos in entity IDs to resource exhaustion loops — before they manifest as runtime failures in a live simulation.

Usage

Use this principle whenever a new scene is created or modified. The validation pipeline is invoked by the `worldseed validate` CLI command and internally by `WorldEngine.__init__()` during world initialization. It is the mandatory first step before launching any simulation.

Theoretical Basis

The validation pipeline follows a defense-in-depth pattern: each level catches a different class of error, and earlier levels gate later ones (physics and smoke checks only run if reference checks pass).

Pseudo-code Logic:

# Abstract pipeline (NOT real implementation)
raw = yaml.safe_load(path)
raw = resolve_presets(raw)        # deep-merge preset YAML fragments
config = SceneConfig.model_validate(raw)  # Level 1: Pydantic schema

result = ValidationResult()
check_references(config, result)  # Level 2: ID existence, graph connectivity
if result.ok:
    run_physics(config, n_ticks)   # Level 3: simulate without agents
    run_smoke(config)             # Level 4: can actions execute?
    run_sanity(config)            # Level 5: config's own checks

Preset resolution uses a deep-merge strategy where imported YAML fragments are merged before validation: dicts merge recursively, lists append, and `dm_knowledge` concatenates.

Practical Guide

  • Always run `worldseed validate --config <path>` before launching a scene.
  • Use `--ticks N` to control physics simulation depth (default 50).
  • Use `--json-output` for programmatic consumption of validation results.
  • Use `--pedantic` to see hints in addition to errors and warnings.
  • Presets are resolved from `presets/` directories relative to the config file or built-in `configs/presets/`.

Related Pages

Implemented By

Page Connections

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