cs.AIApr 7, 2026

CODESTRUCT: Code Agents over Structured Action Spaces

Authors: Myeongsoo Kim, Joe Hsu, Dingmin Wang, Shweta Garg, Varun Kumar, Murali Krishna Ramanathan

Organizations: AWS AI Labs

Abstract

LLM-based code agents treat repositories as unstructured text, applying edits through brittle string matching that frequently fails due to formatting drift or ambiguous patterns. We propose reframing the codebase as a structured action space where agents operate on named AST entities rather than text spans. Our framework, CODESTRUCT, provides readCode for retrieving complete syntactic units and editCode for applying syntax-validated transformations to semantic program elements. Evaluated on SWE-Bench Verified across six LLMs, CODESTRUCT improves Pass@1 accuracy by 1.2-5.0% while reducing token consumption by 12-38% for most models. Models that frequently fail to produce valid patches under text-based interfaces benefit most: GPT-5-nano improves by 20.8% as empty-patch failures drop from 46.6% to 7.2%. On CodeAssistBench, we observe consistent accuracy gains (+0.8-4.4%) with cost reductions up to 33%. Our results show that structure-aware interfaces offer a more reliable foundation for code agents.

Figures & tables

Appendix figures & tables4 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Agentic Code Reasoning

    Mar 2, 2026Shubham Ugare, Satish ChandraAI Coding Agents

  2. FormulaCode: Evaluating Agentic Optimization on Large Codebases

    Mar 16, 2026Atharva Sehgal, James Hou, Akanksha Sarkar +4Coding Agent BenchmarksCode Optimization

  3. Code Isn't Memory: A Structural Codebase Index Inside a Coding Agent

    Jun 21, 2026Ishaan Bhola, Adithyan Krishnan, Sravanth Kurmala +1Software Engineering AgentsCode Generation Evaluation