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 load decide result chain

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

Overview

Concrete tool for loading an LLM-decided action chain onto an avatar as a plan queue, setting thinking and short-term objective, provided by the Cultivation World Simulator avatar action system.

Description

The load_decide_result_chain method (part of `ActionMixin` on `Avatar`) takes the parsed action pairs from the LLM decision, converts them into `ActionPlan` instances, and appends or prepends them to the avatar's `planned_actions` queue. It also sets the avatar's `thinking` and `short_term_objective` text fields.

The first action is NOT immediately set as `current_action` — that happens in the `phase_commit_next_plans` phase, which triggers start events uniformly.

Usage

Import and call this method when:

  • AI decision phase: `phase_decide_actions` calls this for each avatar after parsing the LLM response
  • Plan injection: programmatically setting an avatar's action plan (e.g., in tests or scripted events)

Code Reference

Source Location

Signature

def load_decide_result_chain(
    self: "Avatar",
    action_name_params_pairs: ACTION_NAME_PARAMS_PAIRS,
    avatar_thinking: str,
    short_term_objective: str,
    prepend: bool = False
):
    """
    加载AI的决策结果(动作链),立即设置第一个为当前动作,其余进入队列。
    
    Args:
        action_name_params_pairs: 动作名和参数对列表
        avatar_thinking: 思考内容
        short_term_objective: 短期目标
        prepend: 是否插队到最前面(默认False,即追加到末尾)
    """

Import

# This is a method on Avatar (via ActionMixin); no separate import needed.
# Avatar instances have this method automatically.

I/O Contract

Inputs

Name Type Required Description
action_name_params_pairs list[tuple[str, dict]] Yes Ordered list of (action_name, params) tuples
avatar_thinking str Yes LLM-generated thinking text
short_term_objective str Yes LLM-generated short-term objective
prepend bool No If True, insert at front of queue (default False = append)

Outputs

Name Type Description
(side effects) None avatar.planned_actions updated; avatar.thinking and avatar.short_term_objective set

Usage Examples

Load Decision Result

# After LLM decision parsing:
pairs = [("Respire", {}), ("Move", {"direction": "north"})]
avatar.load_decide_result_chain(
    action_name_params_pairs=pairs,
    avatar_thinking="I should cultivate to improve my realm.",
    short_term_objective="Breakthrough to Foundation Establishment",
)
# avatar.planned_actions now has 2 ActionPlan entries
# avatar.thinking and avatar.short_term_objective are set

Related Pages

Implements Principle

Required Environments

Page Connections

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