Maestro: Joint Graph & Config Optimization for Reliable AI Agents

Wenxiao Wang, Priyatham Kattakinda, Soheil FeiziarXiv 2025 · DOI

Introduction

Building reliable AI agents is currently more of an art than a science. Developers often find themselves stuck in a cycle of "prompt engineering"—tweaking words to improve results—only to discover that the agent's underlying logic is fundamentally flawed. Maestro, a new framework-agnostic optimizer, argues for a shift from simple prompt tuning to a holistic optimization of the agent's entire architecture, encompassing both its logical flow and its configuration.

The Problem of Architectural Fragility

Current Large Language Model (LLM) agents suffer from "architectural fragility." Even with optimized prompts, an agent may fail if it lacks a necessary memory module, fails to validate its own output, or doesn't decompose a complex task correctly. Existing optimizers like DSPy’s MIPROv2 or GEPA focus almost exclusively on configuration—tuning instructions or few-shot examples—while keeping the agent's "graph" (the sequence of steps) fixed. Maestro addresses this gap by treating the agent's topology and its parameters as a joint optimization problem.

Methodology: Joint Optimization

Maestro employs a block-coordinate optimization scheme that alternates between two main phases: the C-step (Configuration) and the G-step (Graph).

Maestro's block-coordinate optimization loop alternating between configuration and graph edits.

In the C-step, the agent's graph is held constant while the system searches for the best prompts, model choices, and hyperparameters. In the G-step, the configuration is fixed while Maestro proposes structural edits, such as adding, removing, or rewiring nodes (modules) and edges (information flow). This process is guided by Reflective Guidance: instead of relying on numeric scores alone, Maestro uses an LLM to generate textual critiques of execution traces. These critiques identify why an agent failed, providing actionable feedback to inform specific edits to the graph or prompts.

Key Results and Efficiency

The authors evaluated Maestro across several benchmarks, including HotpotQA, IFBench, and custom RAG agents. A key insight was that structural changes often provide the most dramatic improvements. For instance, in an Interviewer Agent task, prompt tuning alone reached a 66% success rate, but adding a state variable via a graph change boosted it to 92%.

Maestro achieves higher evaluation scores with significantly fewer rollouts compared to baselines like GEPA and MIPROv2.

On the HotpotQA benchmark, Maestro achieved a state-of-the-art score of 72.33%, outperforming GEPA (69.00%) and MIPROv2 (58.00%). Crucially, Maestro is highly sample-efficient; it surpassed GEPA's performance using roughly 4% of the total rollouts. This efficiency is attributed to its use of rich textual feedback to "understand" failures rather than relying on simple trial-and-error based on numeric scores.

Conclusion

Maestro demonstrates that "config-only" optimization often hits a performance ceiling. By jointly optimizing both the logical flow (graph) and the specific instructions (configuration), developers can build more robust and efficient AI agents. While the search space for such joint optimization is complex, the use of reflective textual feedback provides a scalable path toward reliable, high-performance agentic systems.

Summary updated

Abstract

Building reliable LLM agents requires decisions at two levels: the graph (which modules exist and how information flows) and the configuration of each node (models, prompts, tools, control knobs). Most existing optimizers tune configurations while holding the graph fixed, leaving structural failure modes unaddressed. We introduce Maestro, a framework-agnostic holistic optimizer for LLM agents that jointly searches over graphs and configurations to maximize agent quality, subject to explicit rollout/token budgets. Beyond numeric metrics, Maestro leverages reflective textual feedback from traces to prioritize edits, improving sample efficiency and targeting specific failure modes. On the IFBench and HotpotQA benchmarks, Maestro consistently surpasses leading prompt optimizers--MIPROv2, GEPA, and GEPA+Merge--by an average of 12%, 4.9%, and 4.86%, respectively; even when restricted to prompt-only optimization, it still leads by 9.65%, 2.37%, and 2.41%. Maestro achieves these results with far fewer rollouts than GEPA. We further show large gains on two applications (interviewer & RAG agents), highlighting that joint graph & configuration search addresses structural failure modes that prompt tuning alone cannot fix.
BibTeX
@misc{wang2025maestro,
  author = {Wenxiao Wang and Priyatham Kattakinda and Soheil Feizi},
  title = {{Maestro: Joint Graph \& Config Optimization for Reliable AI Agents}},
  year = {2025},
  eprint = {2509.04642},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.04642},
}
Figure