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 populate

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

Overview

Concrete tool for populating a StateStore with world entities from a SceneConfig provided by the WorldSeed library.

Description

The populate function converts `EntityConfig` objects from a validated `SceneConfig` into runtime `Entity` dataclass instances and adds them to the `StateStore`. It handles only world entities (spaces, resources, objects, concepts) — agents are registered separately via `WorldEngine.register_agent()`.

The function deep-copies properties to isolate runtime state from config, and separates constraints from data properties so the engine can enforce them without polluting observable state.

Usage

Import this function when you need to populate a StateStore from a SceneConfig. In production, this is called automatically by `WorldEngine.__init__()`.

Code Reference

Source Location

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

Signature

def populate(config: SceneConfig, store: StateStore) -> None:
    """Populate a StateStore with world entities only.

    Agents are registered via WorldEngine.register_agent().
    """

Import

from worldseed.scene.populator import populate

I/O Contract

Inputs

Name Type Required Description
config SceneConfig Yes Validated scene config with entities
store StateStore Yes In-memory entity store to populate

Outputs

Name Type Description
(mutation) None Store is mutated: entities added with copied properties

Usage Examples

Direct Population

from worldseed.scene.config import load_config
from worldseed.scene.populator import populate
from worldseed.engine.state_store import StateStore

config = load_config("configs/teahouse.yaml")
store = StateStore()
populate(config, store)

print(f"Populated {len(store.all_entities())} entities")
for entity in store.all_entities():
    print(f"  {entity.id} ({entity.type})")

Related Pages

Implements Principle

Requires Environment

Page Connections

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