Search papers, labs, and topics across Lattice.
This paper introduces AgentExecutor, a multi-agent framework designed for partial code execution that addresses limitations in existing methods like LExecutor and Treefix. By employing a three-phase design that includes environment preparation, dynamic exploration, and prefix evolution, AgentExecutor enhances the action space and optimizes execution quality through adaptive strategies. The framework achieves up to 94% code coverage and significantly reduces execution time and cost compared to state-of-the-art approaches, showcasing its effectiveness in dynamic program analysis.
AgentExecutor outperforms existing methods by achieving up to 94% code coverage while slashing execution time by over 80%.
Executing code snippets is essential for dynamic program analysis, but it remains challenging to execute an arbitrary code snippet due to issues like missing context and incomplete dependencies. Existing approaches to partial code execution, such as LExecutor and Treefix, leverage the power of language models to infer missing information and enable execution. However, they suffer from (i) limited action spaces and feedback, and (ii) rigid optimization strategies, which restrict their effectiveness and efficiency. In this paper, we propose AgentExecutor, a novel multi-agent framework for partial code execution. Our approach introduces a three-phase design: execution environment preparation, dynamic exploration with iterative refinement, and prefix evolution via program synthesis. Supported by the power of LLM agents who can think, act, and get feedback iteratively, AgentExecutor is able to autonomously explore a richer action space, enabling diverse operations such as creating resource files and resolving environment configuration. Furthermore, it adopts adaptive optimization strategies, including coverage-guided context pruning and prefix evolution via program synthesis, to systematically improve the execution quality of partial code. We evaluate AgentExecutor on two widely used datasets comprising Stack Overflow snippets and open-source project code. The results show that AgentExecutor achieves up to 94% and 90% code coverage, outperforming the state-of-the-art approach Treefix by 19.9% and 13.8%, respectively. In addition, AgentExecutor significantly reduces execution time (by up to 80.3%) and cost (by up to 56.6%). These findings demonstrate that AgentExecutor provides an effective and efficient solution for partial code execution.