Graph guided method improves software environment setup success

Graph-Guided Repository Environment Construction

Software EngineeringArtificial Intelligence

Summary

Getting software project environments ready to run code properly is hard because requirements are spread across different files and may only show up when testing the code. The authors created Graph2Env, a tool that maps out all the needed parts and their connections in a clear graph to help build these environments step-by-step. By learning from errors during execution and keeping track of what works, Graph2Env builds setups that can be repeated reliably. When tested on many Python projects, it did better than existing methods at preparing working environments.

What this means in practice

  • For python developers: Automatically build and verify the software environment needed to run diverse Python repositories without manual setup.
  • For devops teams: Improve continuous integration processes by reliably reproducing execution environments from complex dependency relations in code repositories.

Authors

Jianying Pan, John Zhang, Hongyu Zhang

Abstract

Coding agents now increasingly rely on execution to validate their solutions, making the construction of reliable execution environments a critical enabling capability. However, repository environment construction is challenging because execution requirements are fragmented across repository artifacts and may only become apparent during execution. Existing agent-based approaches address this problem through iterative interaction, but information about the current construction state, including discovered requirements, satisfied and unresolved prerequisites, and their dependencies, can remain distributed across the interaction history. We present Graph2Env, an agent-based approach centered on DepGraph, a typed dependency graph that explicitly represents the environment requirements needed for repository execution, their dependency relations, and their states. Graph2Env uses DepGraph to guide environment construction and continuously refines it with execution feedback, while persisting successful repairs into a replayable construction procedure. The resulting artifacts are then applied in a fresh environment to verify that the constructed environment can be reproduced. We evaluate Graph2Env on a benchmark of 200 Python repositories drawn from RATBench and EnvBench, against a static dependency-inference baseline (pipreqs), three specialized environment-construction systems (Repo2Run, RAT, and SetupX), and two general-purpose coding agents (SWE-agent and Claude Code). Graph2Env achieves an 81.0% Environment Build Success Rate (EBSR) and a 59.3% Environment Setup Success Rate (ESSR), outperforming the strongest baseline by 9.5 and 9.0 percentage points, respectively.