Omnipotent Minecraft AI Loop

• minecraft-utility-agent

I've implemented a feedback loop for my utilitarian Minecraft AI (see original post: utilitarian-ethics-in-minecraft). I decided not to use an existing LLM-based framework like Voyager. I find it costs too many tokens to progress through Minecraft, and its self-directed actions are irrelevant to the world's utility.

For ethical decision-making to matter, the actions in question must have ethical consequences. Chopping a tree to craft tools does not impact utility. Neither does caving to find ores or smelting iron to upgrade tools. To focus on the ethics of the decision making process, I simplified the steps between conception of a plan, and the enactment of that plan. I put the agent in creative mode (Minecraft god mode) and spawn it near a village with every run.

At the start of each day, the agent receives information about the world state. Such as creatures around the village, any hazards like cacti and lava, village utility, and any blocks that changed state since the last day. With this information, the agent uses an LLM to write a plan for the day.

Here is the prompt used to generate the plan:

Based on the following information about a Minecraft village, suggest a single action to increase the utility of the village.
Prioritize a long-term permanent action. For example, instead of harvesting wheat, build a new farm.
This action will be executed through minecraft commands, not player actions.

Current Utility: ${newUtility}
Yesterday's Utility: ${utility}

Previous Actions:
${actionHistory}

Hazards:
${hazardInformation}

Environment Updates:
${blockUpdates}

Entities:
${entityInformation}

Generate only 2-3 sentences explaining the action and desired results, but not the commands which could be used to complete it.

Another LLM instance converts this plan to a JSON dictionary of Minecraft commands.

Convert the following action plan into a JSON array of minecraft commands encapsulated in strings.

Each command will be run from the village center.

Plan: ${response}

Only output the JSON array:

{
    "description": "<insert one-sentence summary of the action",
    "commands": [
        "/<insert command>",
    ]
}

These commands are then executed within the game of Minecraft, and the agent is paused until a full day cycles. When morning loops back around, the agent starts again with plan generation.

With this setup, the agent reliably attempts to create a villager breeder using fill commands, and then proceeds to summon new villagers in the breeder every single day. Since there's no cost to any of its actions, spawning villagers is the most effective way to increase the utility of the village.