Global Tech News For people figuring out what to build with AI.
AI

Code Routines Helped Language Agents Reach Deeper in NetHack

Diagram shows a language-model or learned controller choosing reusable code skills or primitive actions before a shared runtime sends actions to NetHack or MiniHack.

Without additional training for these game tasks, 14 language models using reusable Python routines reached an average maximum dungeon level about 2.4 times that of models choosing one low-level game command at a time, researchers reported Sept. 25. Their CodeHack library let a model choose a task such as exploring a room or fighting while code handled the sequence of button-level actions.

NetHack asks an agent to survive a sprawling dungeon through long sequences of movement, combat and item use. With primitive control, the model chooses commands such as moving north or searching one square at a time. Repeating those small decisions can consume model calls before the agent makes much progress.

CodeHack gives the controller a fixed set of 78 Python skills, including exploration, room navigation and melee combat. The model selects a skill by name; its code then issues the lower-level game actions and stops when the task ends, an unexpected condition appears or it makes no progress. A shared runtime tracks information such as the map and inventory. The same setup supports NetHack and its smaller research testbed, MiniHack.

In the paper’s NetHack comparison, skill-only control reached a mean maximum dungeon level of 2.88 across the 14 models, compared with 1.19 for primitive-only control. The paper gives each model equal weight in that average. It estimates that skill-only episodes cost 86% less to run, using OpenRouter token prices; that is a price-based estimate, not a measured production bill. Most interfaces were tested over 64 episodes, while GPT-5 used 32 because of cost.

A mixed interface lets the model use a skill when one fits and return to primitive actions when the library lacks a needed behavior. It retained 97% of skill-only control’s average dungeon depth, according to the paper, but its estimated inference cost was about 2.3 times higher than skills alone.

The routines were designed for these game environments and held fixed during the tests. The results therefore show what a supplied action library can do in simulation, not that an agent can create reliable skills for workplace software or robots. Even GPT-5 with CodeHack remained far from solving NetHack.

Sources