Abstract
This paper introduces an automated pipeline to optimize role-based multi-agent systems (MAS) for complex software development. By employing an LLM "Locator" to identify failing agents and an "Optimizer" to refine their prompts based on textual feedback, the system achieves significant performance gains in code functionality, robustness, and documentation. Our findings suggest that group-level optimization of interconnected agent roles is superior to individual agent tuning.
Introduction
While Large Language Models (LLMs) are increasingly deployed in multi-agent frameworks to solve complex tasks, their performance is heavily dependent on manual prompt engineering—the tedious process of crafting instructions for each agent role (e.g., Programmer, Reviewer). Existing optimization frameworks often focus on simpler, single-agent benchmarks. There is a significant gap in understanding how to automatically optimize a collaborative system where agents have distinct roles and must work together on open-ended tasks like software development. This research addresses the challenge of identifying "the weak link" in a complex workflow and using natural language feedback to fix specific agent instructions.
Methodology
The authors propose a two-step Agent Prompt Optimization Pipeline designed to iteratively improve agent performance through feedback loops.
- Locating: An LLM-based "Locator" acts as a detective. It reviews the software task, the final output, the global feedback from a critic, and the entire communication trajectory. It then pinpoints which agents underperformed and generates fine-grained "failure explanations."
- Optimizing: An LLM-based "Optimizer" takes the original system prompt of the failing agent, its specific input-output history, and the failure explanation to generate a revised, more effective system prompt.
The study explores several settings, including Online vs. Offline optimization and Individual vs. Group optimization. Group optimization involves updating the entire team simultaneously, acknowledging that agent roles are deeply interconnected.
Experimental Setup
The study utilizes the SRDD (Software Requirement Description Dataset), containing 1,200 software task prompts. Performance is evaluated across five dimensions:
- Functionality, Robustness, and Test Case Coverage: Scored 0–10 by a GPT-4 judge.
- Documentation: Measured by the quantity of comments and docstrings.
- Code Style Violation: Measured using
pycodestyle(adherence to PEP 8).
Key Results and Insights
The proposed method consistently outperformed unoptimized baselines and direct optimization methods. As shown in the evaluation trends, metrics like functionality and documentation improved significantly over optimization steps.
- Functionality & Robustness: The "Online Group" setting improved functionality scores from 6.90 to 7.26 and robustness from 6.75 to 7.74.
- Documentation: The most dramatic improvement was seen here, jumping from a baseline of 3.80 to 20.33.
- Group Optimization is Essential: Results indicate that optimizing all agents at each step is more effective than optimizing them individually. This suggests that changing one agent's behavior often requires a corresponding shift in its collaborators.
- Efficiency via One-Pass: There was no significant performance difference between optimizing agents in separate calls versus a single "one-pass" LLM call, offering a path to save on API costs.
Conclusion
This work demonstrates that textual feedback can be effectively used to "surgically" improve multi-agent systems. While the framework shows great promise, the authors note limitations such as "prompt leakage," where optimized prompts occasionally include instance-specific content from training data. Future work will explore more complex agent architectures and the integration of numerical constraints into the feedback loop.
Summary updated