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:4thfever Cultivation world simulator get action infos str

From Leeroopedia
Knowledge Sources
Domains Action_System, AI_Agents
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete tool for assembling a JSON string of available game actions with descriptions, requirements, and parameter options, filtered by avatar feasibility, provided by the Cultivation World Simulator action system.

Description

The get_action_infos_str function returns a JSON string representing all actions available to a given avatar. It iterates all registered actual action classes, instantiates each to check `can_possibly_start()`, and for feasible actions, builds an info dict with `desc`, `require`, `params`, `param_options`, and `cd_months`.

The JSON output is passed to the LLM as `general_action_infos` in the AI decision prompt, telling the LLM which actions the avatar can take and what parameters they accept.

Usage

Import and call this function when:

  • AI decision: called in `LLMAI._decide` to build the action catalog for the LLM prompt
  • Debugging: inspect available actions for a specific avatar

Code Reference

Source Location

Signature

def get_action_infos(avatar: Avatar | None = None) -> Dict[str, Any]:
    """Get action info dict, filtered by avatar feasibility if provided."""

def get_action_infos_str(avatar: Avatar | None = None) -> str:
    """Get JSON string of action info dict."""

Import

from src.classes.actions import get_action_infos, get_action_infos_str

I/O Contract

Inputs

Name Type Required Description
avatar None No If provided, filters to only feasible actions via can_possibly_start()

Outputs

Name Type Description
get_action_infos_str return str JSON string of {action_name: {desc, require, params, param_options, cd_months}}

Usage Examples

Get Available Actions for LLM Prompt

from src.classes.actions import get_action_infos_str

action_catalog = get_action_infos_str(avatar)
info = {
    "avatar_name": avatar.name,
    "general_action_infos": action_catalog,
    # ... other context fields ...
}
res = await call_llm_with_task_name("action_decision", template_path, info)

Related Pages

Implements Principle

Required Environments

Uses Heuristics

Page Connections

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