TL;DR
OOPMAS is a training-free framework that dynamically generates custom multi-agent systems—both the agents themselves and their coordination workflows—for every individual query. By representing agents as object-oriented Python classes and using a dynamic "skill library" for iterative refinement, it achieves a massive 18.1 percentage point lead over state-of-the-art baselines on heterogeneous task benchmarks.
What Problem Does This Paper Address?
Building effective Multi-Agent Systems (MAS) for LLMs is currently a manual, labor-intensive process. While recent research has tried to automate this, most methods operate at the task level. They optimize a single, fixed workflow for an entire benchmark (e.g., one workflow for all math problems).
The authors argue this approach fails in the real world for two reasons:
- Query Heterogeneity: Real-world workloads are messy. A system might receive a Python coding challenge followed immediately by a complex graduate-level physics question. A fixed workflow optimized for code is useless for physics.
- Difficulty Variance: Even within one task, an "easy" query might only need a single LLM call, while a "hard" one requires a multi-step pipeline with planners and reviewers. Fixed topologies cannot adapt to this spectrum.
Methods
OOPMAS (Object-Oriented Programming Multi-Agent Systems) shifts the optimization target from the task to the individual query.
Key technical innovations include:
- Object-Oriented Agent Representation: Agents are defined as Python classes. This naturally encapsulates their role prompts, specific tool bindings, and persistent internal state (like conversation history). Because LLMs are pre-trained on vast amounts of code, they are much more reliable at generating these standard OOP patterns than custom domain-specific languages.
- Two-Phase Generation:
- Agent Generation: A "meta-agent" creates a pool of specialist agents tailored to the query. It performs a "coverage check" to ensure the agents have the necessary expertise.
- Workflow Generation: The meta-agent writes an executable
main()Python function that orchestrates these agents. - Dynamic Skill Library ($K$): The system doesn't just "guess" the best workflow. It runs the generated code, evaluates the output, and if it fails, a diagnosis agent distills the failure into a "skill" (a structured lesson). These skills are injected back into the meta-agent's prompt for the next optimization round, enabling in-context improvement without any gradient updates or fine-tuning.
Datasets
The authors introduced two new benchmarks to test MAS under realistic, heterogeneous conditions:
- Mixed Benchmark: 120 queries spanning code (HumanEval, MBPP), math (MATH, GSM8K), and QA (HotpotQA, DROP).
- Hard Mixed Benchmark: 180 competition-level queries designed to stress-test adaptation. This includes AIME (math), LiveCodeBench/CodeContests (code), and GPQA Diamond (science QA). These tasks have diverse output formats (integers, full programs, multiple-choice), making fixed templates nearly impossible to use.
Key Insights and Ideas
- The "Agent Pool" is a Bottleneck: Previous methods kept the agent pool fixed and only searched for workflows. OOPMAS shows that dynamically synthesizing the agents themselves—giving them the exact tools and personas needed for a specific niche—is a primary driver of accuracy.
- Code as the Universal Coordinator: By treating MAS design as a code generation problem rather than a graph-search problem, the system leverages the LLM's inherent programming strengths.
- Robustness to Difficulty: While baselines often "collapsed" on hard tasks (e.g., AFlow dropping to 0% on competitive coding because its fixed template didn't match the required I/O format), OOPMAS maintained high performance by simply writing a new, compatible workflow for those specific queries.
Key Results
OOPMAS demonstrates significant performance gains across the board, particularly as task difficulty increases.
- Superior Accuracy: On the Mixed benchmark, OOPMAS achieved 89.6% accuracy, outperforming the strongest baseline (ADAS) by 18.1 points.
- Generalization to Hard Tasks: On the Hard Mixed benchmark, it reached 90.8%, maintaining a similar 18.5-point lead over baselines.
- Scaling with Backbones: A model-swap study showed that as the underlying LLM gets stronger (from GPT-4.1 to GPT-5.2), OOPMAS scales smoothly, reaching a peak of 92.4%.
Limitations and Future Work
- Meta-Agent Strength: The system's success depends heavily on the meta-agent's ability to write bug-free Python. With weaker models (like GPT-5-nano), fixed scaffolds like AFlow can actually be more robust.
- Inference Cost: Generating a custom MAS per query and running iterative repair rounds is significantly more expensive in terms of tokens and time than using a fixed workflow. The authors suggest "selective deployment"—routing easy queries to simple agents and saving the full OOPMAS pipeline for high-value, difficult queries.
- Skill Persistence: Currently, the skill library is "run-local," meaning it helps within a single optimization session but doesn't yet persist across different deployments or long-term query streams. Expanding this into a global, persistent memory is a clear next step.
Summary updated