Agents

Experimental alpha. Expect breaking changes and major bugs. Your feedback is much appreciated.

Agents

Crafting

An agent is a frame that runs a program. Walking, carrying, reaping, mining and laying blocks are its own; where learning beats a rule, a model in one of its slots decides, in exactly the format of that model's test, and the agent does what the model answers. You can see a model in its lantern of a head, turning faster while it thinks.

An agent's screen, part by part.

Home and models

Where you place an agent is its home, and its work happens around home. Set home, the house beside its screen, makes where it stands its new home.

The panel beside its screen holds its two model slots, and its upgrades. Its Model takes a Checkpoint with a model of up to 160 KB of weights, or a Relay Card tuned to a Model Server, for a model of any size: see Serving Models. This model writes the orders you give as programs, and makes the decisions of storing, hauling, building and copying. Its Filter takes a checkpoint that passes Sorting, and tells what kind each thing is. Its screen says what is missing.

Programs

The Program tab holds what it does when nothing else is asked of it: steps between commas, checked as you type.

  • take bread, come, give bread
  • until full (pickup)
  • repeat (mine 4 stone, put)
  • if ripe (harvest) else (wait 10)

Run starts it and Stop stops it. A program that goes on for good, a repeat without a count, is its standing work; any other runs once, and then it rests. The buttons on the Work tab set ready-made programs: Farm is repeat (farm), Sort is repeat (sort), and so on, and Rest clears it.

The Palette beside Stop lays out every piece of a program to click together instead of typing, each saying what it does when you point at it. Pieces go on the end, along with whatever plainly comes next: the ( that opens a block, the mark a place needs. To name a thing, pick it up and click the program, or the order box on the Work tab.

The steps an agent is usually given are below; everything a program can say, on an agent and on a Port, is in Programs: variables, lists, your own steps, events, areas, filters, and what a program can read of the world.

  • come, home, go 3 to the third mark, stay, follow
  • take 5 bread from the chests and barrels around home, or from the network of a Storage Terminal there, put everything or put wheat away in them, give bread to you, fetch bread, which is taking, coming and giving
  • craft 8 torch makes them there and then if it holds what they take; what it cannot make, it walks to a terminal around home whose network can, asks, and waits until it is made; supply goes after what a job on that network lacks, out of the chests and barrels or mined, and brings it to the network, so repeat (supply, wait 10) keeps a network's jobs going
  • pickup what lies around it, harvest, plant wheat seeds, till the grass near water, mine 4 stone (with a pickaxe it carries, for blocks that need one; it digs its way to anything buried, and to what a Surveyor found; mine caches for what the old world left in them; agents mining near each other take different blocks), place oak planks 2 on top of the second mark
  • wait 10 seconds, say hello
  • farm, store, sort, haul, build, copy or move: one round of a routine

Blocks: repeat (…), repeat 3 (…), if … (…) else (…), until … (…) and wait until …. Checks: have 3 bread, stocked bread in the stores and networks around home, ripe, full, night, near (you are within 8 blocks), powered 2 (the second mark has a redstone signal), each with not before it if need be.

The trace

The Trace tab shows what it did, checked and decided, newest last, and how each step went: storing and sorting note every stack they put away, and where. A step that fails says why, and the program goes on with the next. An agent that gets stuck on its way somewhere gives up after a while; stuck three times running, it jumps home. Beside it, the debugger holds a program at a step, runs it one step at a time and shows what it holds.

Upgrades

Upgrades go in the panel beside its screen. At the most, it acts every tick and carries 48 slots' worth. With a Lift Upgrade and energy it flies, and it comes down to walk when the energy runs out.

Routines

  • farm: walks the farmland within 7 blocks of home, harvests what is ripe and plants what is bare, and takes the harvest to the chest at home, keeping some seed. It is a rule, so no model is asked.
  • store: empties the barrels around home into the chests within 8 blocks, numbered 0 to 9, nearest first. A kind it has never seen goes to the emptiest chest. For a kind seen before, it shows its model where eight kinds went and asks which chest this one belongs in.
  • sort: empties the barrels around home into the chests labelled with each thing's kind: Food, Plants, Wood, Stone, Ores or Tools. Name a chest in an anvil to label it, or fix a sign to it. Its filter is asked the kind of each thing by its name alone, so it can sort things it has never seen. Whatever its filter calls other, or is less than 60% sure of, goes in a chest labelled Other, or else in one with no label.
  • haul: walks out along the six waymarks it was handed, loads up from the chest or barrel at the last one, and comes home. On the way back its model names the waymarks in reverse, and it walks wherever its model says.
  • build, copy and move: carry on a pattern along a run, copy a build, or move it, contents and all, as its model reads it: see The Architect.

The Survey Rod

Crafting

Use a Survey Rod on blocks to mark them, up to eight, in order; use a marked block again to unmark it, and sneak-use in the air to clear them all. Use the rod on an agent to hand it the marks: waymarks for hauling, a build's corners and where its copy goes, the ends of a run to build along, or places for go and place.

Program Cards

Crafting (Shapeless)

A Program Card carries a program from agent to agent. Use a blank card on an agent to copy its program, and a written one to hand the program over; sneak-use a written card to copy onto it instead. In an agent's screen, click the program holding a written card to load what it says, or holding a blank card to write the program onto it; shift-click writes onto a written card too.

Orders

Start a chat message with an agent's name to give it an order: Pip, bring me some bread. It hears you within 24 blocks, or anywhere a Model Server's relays reach while you are in reach too, holding a Terminal tuned to it. You can also type an order on the Work tab of its screen and Tell it.

Its model writes the order as a program, in all the words of Programs: move 16 iron ingots from mark 1 to mark 2, dig out everything between the marks, put all the logs on the network, go to every mark and say hello, make a step sweep that harvests and puts away. A plain step, or one of the jobs, it does at once, if its model is sure. Anything else it reads back with [Do it] and [Cancel] to click in chat, or on the Work tab of its screen, and runs only once you say yes: point at it to see its steps on lines. A model that passes Programs is trusted to run what it writes at once, however long. An order comes before its program, which it goes back to after. If what its model writes is no program at all, it is puzzled; a model that never practised orders will mostly be puzzled. With no model at all, an order already written as a program, dig at front, is taken as it stands.