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 entities of

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

Overview

Concrete DSL function that lists entity IDs of a given type with an optional Python-like WHERE filter, provided by the WorldSeed library.

Description

The entities_of function registers via `register_function("entities_of", _call_entities_of)`. It parses `type='X', where=<expr>` arguments, queries entities by type from the state store, and filters using a small custom predicate evaluator (no `eval`/`exec`). The WHERE expression supports `==`, `!=`, `in [a, b, c]`, `in ('x', 'y')`, `and`/`or`/`not`, dot-path property access, `$agent` context substitution, and a `reviewed_by('id')` domain helper for paper-like entities. It is used by autoresearch's `enum_from` expressions to surface only the papers a given agent can legally act on.

Usage

Use this function in scene YAML `enum_from` expressions when an action's parameter choices must be dynamically filtered from live entity state — e.g., listing only draft papers not yet reviewed by the current agent.

Code Reference

Source Location

  • Repository: WorldSeed
  • File: src/worldseed/dsl/functions/entities.py

Signature

def _call_entities_of(
    args_str: str,
    store: StateStore,
    ctx: dict[str, Any],
) -> list[str]:
    """Return entity ids matching type + optional where filter."""

Import

# Auto-registered on import of the functions package:
# import worldseed.dsl.functions  # registers "entities_of"

I/O Contract

Inputs

Name Type Required Description
type str Yes Entity type to query (quoted)
where str No Python-like filter expression

Outputs

Name Type Description
returns list[str] Entity IDs matching the type and filter

Usage Examples

# List papers the agent can still review
actions:
  review_paper:
    params:
      - name: paper_id
        type: enum
        enum_from: "entities_of(type='paper', where=status in ['draft','under_review'] and author != $agent)"

Related Pages

Implements Principle

Requires Environment

Page Connections

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