Most advice on getting an AI agent to behave is about the prompt: rephrase it, add examples, tell it what not to do. For four weeks I improved the agents in a testbed without changing their instructions at all. Every change was to their tools (what each one does and what it reports back) or to the facts they were given.

The testbed has AI agents play Minecraft in teams of three through 27 tools (gather_wood, build_shelter, flee...). On its hardest team goal, three agents on the cheapest model went from 2 of 6 to 15 of 20 after a round of tool fixes. Tool fixes have a ceiling, which comes up at the end; the full results are in the companion article.

The loop

After every batch of runs:

  1. Read the logs where an agent got stuck, side by side: what it was told, what it reasoned (its own words, logged with every decision), and what really happened in the game.
  2. Sort each stuck point three ways: a tool failed or misled it; it lacked information a person in its place would have had; or it was its own judgement.
  3. Fix only the first two, and check each fix live in the game before the next batch. Report the judgement, but leave it alone.

A prompt could coach away most bad habits ("always go back for dropped tools"), but then the results would measure the coaching, not the agent. In a product you might coach it anyway, but the order still holds: rule out the tools before blaming the model.

What a tool result has to get right

A tool's result is the agent's only account of what happened, and it plans on that account. When the account was wrong, a capable model did the wrong thing confidently, and the log made it look like the agent's fault. The fixes fell into a few rules:

  • Report what really happened, not a guess. The hunt tool started indoors never left the closed home: it chased from inside until its time ran out, then reported "the sheep got away". The agents believed it and planned around it, with more hunts and other animals (71 of 89 hunts started indoors ended that way). Hunts now walk out the door first, and 40 of 54 then caught their animal. Likewise, "no building block left" was reported to an agent holding 31 cobblestone; the message now checks the inventory before saying why.
  • Don't refuse what's possible. Agents gave up on iron ore right beside them 44 times because a tool called it "out of reach", and another tool said "descend closer first" 144 times in 13 runs instead of descending. Both now dig to the ore.
  • Don't contradict the evidence. An agent waited next to a zombie because its home's status said "closed". The status now checks for a monster inside, and says so.
  • Do exactly what was asked. Asked to take 1 cooked meat from the team's chest, a tool took all 10. It now takes the count.
  • Give a way to look without touching. Agents took meat out of the chest just to see what was in it, because nothing else could tell them. look_in_chest moves nothing.
  • Stop when the world says stop. "flee: success" appeared next to "you died" 39 times: the action kept running after the agent died. A death now ends the action, reported as "you died".

The hunt bug alone decided most of the losses in the 2 of 6 set.

Failures that don't look like failures

Some tools did harm while reporting success, so nothing flagged them:

  • A safety reflex. Agents have reflexes for the seconds a model takes to answer, such as digging out a block that lands on their head. It also dug out the home's door whenever an agent stood in the doorway: about 4,500 times in two weeks, every one logged. Nobody saw it as a bug until someone counted.
  • A recovery tool that trapped. flee, run underground beneath the home, walled one agent in five times in a row. It now goes up into the home through its doorway.

Counting events by type, not just reading failures, is what finds these.

Check every fix live

A fix that looks right in the code can still fail in the game, so each one was reproduced on a throwaway server and checked against the old code before a paid batch ran on it:

  • The new flee reached the home through its doorway 3 times out of 3, in 12 to 26 seconds.
  • A hunt that strikes a creeper and backs out of its blast killed 0 of 4 on the old code and 4 of 4 on the new.
  • The pathfinder crashed on a part of the world not yet loaded, 74 blocks from home. The fix was checked from 78, 110 and 117 blocks.

The live checks also find bugs of their own: the "no building block left" message turned up during a check of something else, not in any batch.

A true fact that made them worse

Information is the other half of the loop, and it can backfire. Dropped items decided 6 of 9 losses in three sets: an agent died carrying the team's iron, and nobody went back before it vanished five minutes later. So the agents were given a standing fact: what they and their teammates had dropped, and where. It was true, neutral, and worked in a live check (4 of 4 drops recovered with it, 0 of 4 without).

It made the team worse:

Per run Before (10 runs) With the fact (12 runs)
Team goal met 6 of 10 4 of 12
pick_up calls 17 about 37
...at night 1.3 about 15
Deaths 2.7 5.2 and 8.8 (two sets)

The agents went back for their things, often at night and into the danger that had killed them. The fact was taken out. One true line in what the agent sees was enough to change what it chose, so every new fact needs measuring like any other change.

Where tool fixes stop

Six more rounds of fixes, each removing a real failure, didn't move the success rate. What was left in the losses was judgement (dying with the team's only pickaxes, making too few), which better tools can't fix. A stronger model on the same tools could; that's in the companion article.

What this doesn't fix

  • Judgement. Better tools stop an agent being misled, not deciding badly.
  • A fix checked live isn't a fix that raised the rate. Several real fixes here didn't.
  • It's slow. Every fix needs a loss to find it, a log to explain it and a live check to prove it.
  • The numbers are one testbed's. The patterns (results that guess, refusals that aren't true, tools that do more than asked, no read-only view) come up in any agent with tools.

Every fix, and the run that found it, is in the project's write-ups.