Skip to content

simulatecraft.brains

simulatecraft.brains

Decision-making policies. LLM brains live in simulatecraft.brains.llm.

Brain

Bases: ABC, Generic[ObsT]

A policy. Scripted rules, RL policies, and LLM reasoning all implement this.

decide abstractmethod

decide(observation: ObsT) -> Action | Any

Choose an action for this observation. May be a coroutine function.

Source code in src/simulatecraft/brains/base.py
@abstractmethod
def decide(self, observation: ObsT) -> Action | Any:
    """Choose an action for this observation. May be a coroutine function."""

update

update(step_result: StepResult) -> None | Any

Learn / log / no-op after the action is applied. May be a coroutine.

Source code in src/simulatecraft/brains/base.py
def update(self, step_result: StepResult) -> None | Any:
    """Learn / log / no-op after the action is applied. May be a coroutine."""

on_human_message

on_human_message(sender: str, text: str) -> None

Optional sync hook for human-in-the-loop chat (queue it for next decide).

Source code in src/simulatecraft/brains/base.py
def on_human_message(self, sender: str, text: str) -> None:
    """Optional sync hook for human-in-the-loop chat (queue it for next decide)."""