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 SceneConfig

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

Overview

Concrete Pydantic schema model that validates and structures the entire scene configuration — entities, agents, actions, effects, preconditions, consequences, DM rules, perception, narrator, director — as the single declarative specification of a WorldSeed world.

Description

The SceneConfig Pydantic model (579 lines in `config_schema.py`) is the schema-level validation for scene YAML. It contains nested models for every config section:

  • EntityConfig: Flat format with id, type, and properties. Uses `extra="allow"` to flatten top-level keys into properties.
  • AgentConfig: Agent definitions with character cards, omniscient/system flags, wake_on_push.
  • ActionConfig: Action definitions with params, preconditions, effects, events, dm config, available_to filter.
  • EffectConfig: DSL effect with operator, target, value, and operator-specific fields.
  • PreconditionConfig: DSL precondition with operator and comparison fields.
  • DMConfig: DM judgment config with hint, allowed_ops, max_effects, scope.
  • ConsequenceConfig: Reactive rules with trigger, frequency, effects, optional dm.
  • PerceptionConfig: Visibility rules, event scopes, hidden properties.

The schema uses `model_validator` for cross-field validation and `ConfigDict(extra="allow")` for forward-compatible entity property definitions.

Usage

Import this model when you need to validate raw YAML dicts or access typed config fields. Used by `load_config()` and the validation pipeline.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: src/worldseed/models/config_schema.py

Signature

class SceneConfig(BaseModel):
    scene: SceneSection
    entities: list[EntityConfig]
    agents: list[AgentConfig]
    actions: dict[str, ActionConfig]
    consequences: dict[str, ConsequenceConfig] = {}
    auto_tick: list[AutoTickConfig] = []
    perception: PerceptionConfig
    narrator: NarratorConfig | None = None
    director: DirectorConfig | None = None
    sanity_checks: list[SanityCheckConfig] = []

Import

from worldseed.models.config_schema import SceneConfig

I/O Contract

Inputs

Name Type Required Description
raw dict Yes Parsed YAML dict (from yaml.safe_load)

Outputs

Name Type Description
return SceneConfig Validated Pydantic model instance

Usage Examples

Direct Validation

import yaml
from worldseed.models.config_schema import SceneConfig

raw = yaml.safe_load(open("configs/teahouse.yaml"))
config = SceneConfig.model_validate(raw)

# Access typed fields
for action_name, action in config.actions.items():
    print(f"{action_name}: {len(action.effects)} effects")
    if action.dm:
        print(f"  DM hint: {action.dm.hint}")

Related Pages

Implements Principle

Requires Environment

Page Connections

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