{"by":"noddybear","descendants":209,"id":43331582,"kids":[43333045,43334576,43338731,43335404,43334618,43332539,43342548,43334233,43335980,43331679,43335216,43332121,43331931,43332931,43332331,43334194,43331920,43334839,43332245,43331980,43332346,43334329,43331962,43337129,43334620,43343680,43346300,43335590,43331881,43331903,43331994,43336510,43332479,43332218,43331782,43336487,43332962,43331833,43337878,43332022,43335537,43335768,43331894,43332084,43334138,43333312,43332483,43333333,43341652],"score":749,"text":"I&#x27;m Jack, and I&#x27;m excited to share a project that has channeled my Factorio addiction recently: the Factorio Learning Environment (FLE).<p>FLE is an open-source framework for developing and evaluating LLM agents in Factorio. It provides a controlled environment where AI models can attempt complex automation, resource management, and optimisation tasks in a grounded world with meaningful constraints.<p>A critical advantage of Factorio as a benchmark is its unbounded nature. Unlike many evals that are quickly saturated by newer models, Factorio&#x27;s geometric complexity scaling means it won&#x27;t be &quot;solved&quot; in the next 6 months (or possibly even years). This allows us to meaningfully compare models by the order-of-magnitude of resources they can produce - creating a benchmark with longevity.<p>The project began 18 months ago after years of playing Factorio, recognising its potential as an AI research testbed. A few months ago, our team (myself, Akbir, and Mart) came together to create a benchmark that tests agent capabilities in spatial reasoning and long-term planning.<p>Two technical innovations drove this project forward: First, we discovered that piping Lua into the Factorio console over TCP enables running (almost) arbitrary code without directly modding the game. Second, we developed a first-class Python API that wraps these Lua programs to provide a clean, type-hinted interface for AI agents to interact with Factorio through familiar programming paradigms.<p>Agents interact with FLE through a REPL pattern:\n1. They observe the world (seeing the output of their last action)\n2. Generate Python code to perform their next action\n3. Receive detailed feedback (including exceptions and stdout)<p>We provide two main evaluation settings:\n- Lab-play: 24 structured tasks with fixed resources\n- Open-play: An unbounded task of building the largest possible factory on a procedurally generated map<p>We found that while LLMs show promising short-horizon skills, they struggle with spatial reasoning in constrained environments. They can discover basic automation strategies (like electric-powered drilling) but fail to achieve more complex automation (like electronic circuit manufacturing). Claude Sonnet 3.5 is currently the best model (by a significant margin).<p>The code is available at <a href=\"https:&#x2F;&#x2F;github.com&#x2F;JackHopkins&#x2F;factorio-learning-environment\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;JackHopkins&#x2F;factorio-learning-environment</a>.<p>You&#x27;ll need:\n- Factorio (version 1.1.110)\n- Docker\n- Python 3.10+<p>The README contains detailed installation instructions and examples of how to run evaluations with different LLM agents.<p>We would love to hear your thoughts and see what others can do with this framework!","time":1741694522,"title":"Show HN: Factorio Learning Environment – Agents Build Factories","type":"story","url":"https://jackhopkins.github.io/factorio-learning-environment/"}