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

Implementation:AIScientists Dev WorldSeed load config

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

Overview

Concrete tool for loading and validating a scene config YAML file with preset resolution provided by the WorldSeed library.

Description

The load_config function is the entry point for scene configuration loading. It reads a YAML file, resolves any preset imports declared in `scene.use`, and validates the result through the Pydantic `SceneConfig` schema.

Preset resolution is a deep-merge process: imported YAML fragments are loaded from `presets/` directories and merged before validation. Dicts merge recursively, lists append (entities dedupe by id), and `dm_knowledge` concatenates. Circular preset references are detected and rejected.

Usage

Import this function when you need to load a scene config from a YAML file path. Used by `WorldEngine.__init__()` and the `worldseed validate` CLI.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: src/worldseed/scene/config.py

Signature

def load_config(path: str | Path) -> SceneConfig:
    """Load and validate a scene config YAML file.

    If scene.use lists preset names, the corresponding YAML fragments
    are loaded from a presets/ directory and deep-merged before validation.
    """

Import

from worldseed.scene.config import load_config

I/O Contract

Inputs

Name Type Required Description
path Path Yes Path to scene YAML file

Outputs

Name Type Description
return SceneConfig Validated Pydantic scene config model

Usage Examples

Basic Loading

from worldseed.scene.config import load_config

config = load_config("configs/teahouse.yaml")
print(f"Scene: {config.scene.description}")
print(f"Entities: {len(config.entities)}")
print(f"Actions: {len(config.actions)}")

With Presets

# Scene YAML with presets:
# scene:
#   use: [base_items, social_actions]
#   description: "A teahouse scene"

config = load_config("configs/my_scene.yaml")
# Presets are deep-merged: base_items entities + social_actions
# are combined with the scene's own definitions

Related Pages

Implements Principle

Requires Environment

Page Connections

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