Skip to content
On this page

Survival agent

@bedboo/agent is a scripted (no LLM) survival agent built on bedboo. It plays legit survival on a Bedrock Dedicated Server: wood → stone tools → iron → diamonds, it builds a house from a blueprint and mines every overworld ore, while it fights the mobs that attack it, eats, and gets out of lava and water. Everything goes through the public mineflayer API and the ecosystem plugins (mineflayer-pathfinder, -collectblock, -tool, -armor-manager, -auto-eat, -pvp), so the same code would drive a Java bot. It is also a large example of bedboo in use.

Quick start

js
const { Agent } = require('@bedboo/agent')

const agent = await Agent.create({ host: '127.0.0.1', port: 19132, username: 'Agent', log: console.log })
await agent.run('obtain', { item: 'iron_pickaxe' }) // wood, stone, a furnace, iron… whatever it takes
await agent.run('build', { blueprint: 'house5x5' }) // materials obtained, verified block by block
await agent.run('mine', { all: [{ item: 'diamond' }, { item: 'emerald' }] })
agent.writeReport('report.json') // tasks, timings, deaths, fights, event log
await agent.stop()

The agent joins as an ordinary offline player: no operator rights, no commands.

Options and tasks

Agent.create(opts) options: host, port, username (default Agent), bot (use an existing spawned bot), botOptions, safety (true / options / false), autoEat, keepFed (hunt for food between tasks when hungry), recoverItems (go back for the drops after a death), log (line sink), skills (registry).

agent.run(skill, args, { timeout, retries }) runs one skill as a task; agent.runScenario({ name, steps, timeout, verify }) runs steps in order (stops at the first failure) and returns the report; agent.on('event', e) streams { t, type, … } events (task-start, mine, craft, smelt, place, safety, death, log, …).

Skills

A skill is async (bot, args) => result (args.signal is the runner's AbortSignal); skills never send commands.

skilldoes
obtaingets count × item by any means: craft, smelt, mine, gather or hunt, recursively, planned by cost
mineores and stone: shafts down to deep ones, explores towards the right biome when none is loaded
gathersurface blocks: logs (item: 'log' = any), sand, gravel, …
craftbot.recipesFor / bot.craft, 2×2 or a crafting table (placed and taken back)
smeltbot.openFurnace; the furnace is placed and taken back
buildbuilds a blueprint near the bot, verifies it block by block and repairs what is wrong
navigatepathfinder with re-planning, legs for far goals and unsticking
explorespiral walk until a block or biome is loaded
surface, descend, escapeout of a mine, down a safe shaft, last-resort unsticking
food, hunt, fishkeep fed: hunt passive animals and cook the meat, or fish
restsleep through the night in the carried bed, or shelter
combat, portal, nether, endfighting, portals and the other dimensions

While a task runs, background safety behaviours fight or flee hostile mobs, get out of lava, swim up for air, eat (through mineflayer-auto-eat), and recover after a death. The full description of the skills, the obtain planner, the safety behaviours and the blueprint format is in the package's README.