AdaptAgent: A Multi-agent, Domain-Guided Reasoning Framework for Code Adaptation
On the map: LLM reasoning → Reasoning for agents, planning and code
also in 1 more
Abstract (arXiv)
Developers often need to adapt into their projects the code generated from LLMs or code snippets from online forums. However, integrating them into an existing repository remains challenging in a manual process. A successful integration typically requires more than copying code as a user must produce correct adapting changes at a designated location in the target repository. We formalize this as the code adaptation problem: given a snippet, functional intent, a target repository, and an adaptation location, generate a patch that adapts the snippet into the repository. We present AdaptAgent, a multi-agent, domain-guided reasoning framework for code adaptation. Rather than relying on single-shot prompting, AdaptAgent decomposes adaptation into specialized agents that communicate via typed artifacts: an Intent Summarizer extracts adaptation goals from Q&A text; a Policy Agent derives domain policies from six adaptation categories; a Domain Planner generates a self-ordered plan; a Context Miner distills sibling-method semantics from the target codebase; and a Code Adapter realizes the plan as a minimal unified diff, iteratively refined using a compiler-based Verifier. This division of labor enables robust, policy-aligned adaptations and supports adapting code snippets into a project. On a real-world dataset, AdaptAgent outperforms strong baselines in semantic correctness and produces patches that mirror developers' actual adaptation patterns. Our ablation study shows each agent's necessity, especially planning for code-hardening and exception-handling, and intent for logic customization.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 19 of its 30 references that are in the map. First posted on arXiv 5 Aug 2026.
Builds on
19 of 30 references.
References · 19
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2023ChatGPT as a Factual Inconsistency Evaluator for Text Summarizationcited by 75
- 2025Injecting Domain-Specific Knowledge into Large Language Models: A Comprehensive Surveycited by 47
- 2023Empower Large Language Model to Perform Better on Industrial Domain-Specific Question Answeringcited by 41
- 2017ARJA: Automated Repair of Java Programs via Multi-Objective Genetic Programmingcited by 26
- 2024Hybrid Automated Program Repair by Combining Large Language Models and Program Analysiscited by 22
- 2024Aligning the Objective of LLM-based Program Repaircited by 12
- 2017Stack Overflow Considered Harmful? The Impact of Copy&Paste on Android Application Securitycited by 11
- 2018Toxic Code Snippets on Stack Overflowcited by 9
- 2020Recommending Stack Overflow Posts for Fixing Runtime Exceptions using Failure Scenario Matchingcited by 9
- 2019Analyzing and Supporting Adaptation of Online Code Examplescited by 8
7 more
- 2023Automated Code Editing with Search-Generate-Modifycited by 8
- 2019An Empirical Study of C++ Vulnerabilities in Crowd-Sourced Code Examplescited by 7
- 2024Integrating Planning into Single-Turn Long-Form Text Generationcited by 7
- 2022Prompt-tuned Code Language Model as a Neural Knowledge Base for Type Inference in Statically-Typed Partial Codecited by 6
- 2025Developer-LLM Conversations: An Empirical Study of Interactions and Generated Code Qualitycited by 6
- 2020Optimising the Fit of Stack Overflow Code Snippets into Existing Codecited by 5
- 2022Answer Summarization for Technical Queries: Benchmark and New Approachcited by 4
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Multi-Agent Systems for Dataset Adaptation in Software Engineering: Capabilities, Limitations, and Future Directions
- 2025Wired for Reuse: Automating Context-Aware Code Adaptation in IDEs via LLM-Based Agent
- 2026CodeTeam: An LLM-Powered Multi-Agent Framework for Repository-Level Code Generation
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoring
- 2025Context Engineering for Multi-Agent LLM Code Assistants Using Elicit, NotebookLM, ChatGPT, and Claude Code
- 2025Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks
- 2025Prometheus: Towards Long-Horizon Codebase Navigation for Repository-Level Problem Solving
- 2026CRANE: Constrained Reasoning Injection for Code Agents via Nullspace Editing