arXiv:2610.07787cs.AIOct 2026

Manuscript Offprint

arXiv:2610.07787

OOPMAS: Object-Oriented Multi-Agent Systems for Query-Level Workflow Generation

Qi Cheng, Shengyu Chen, Wei Cheng, Yiqun Xie, Xiaowei Jia, Haoyu Wang, Haifeng Chen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Qi Cheng

Rutgers University

New Brunswick, NJ

q.cheng@rutgers.edu

Yiqun Xie

University of Maryland

College Park, MD

xie@umd.edu

Shengyu Chen

University of Pittsburgh

Pittsburgh, PA

shc160@pitt.edu

Xiaowei Jia

Rutgers University

New Brunswick, NJ

xj159@cs.rutgers.edu

Wei Cheng

NEC Labs America

Princeton, NJ

weicheng@nec-labs.com

Haoyu Wang

NEC Labs America

Princeton, NJ

haoyu@nec-labs.com

Haifeng Chen

NEC Labs America

Princeton, NJ

haifeng@nec-labs.com

Abstract

Multi-agent systems (MAS) powered by large language models have shown strong performance across code generation, mathematical reasoning, and question answering. However, existing methods for automating MAS design mostly operate at the task level, producing a single fixed workflow per benchmark that is applied uniformly to all queries. This assumption fails under realistic conditions. Query difficulty varies widely within a task, and real-world workloads mix heterogeneous task types. We introduce OOPMAS, a training-free framework that generates both the agent set and the coordination workflow at the granularity of individual queries. Agents are represented as object-oriented class definitions with dedicated roles, tools, and persistent state, and workflows are expressed as executable main functions over these agent objects. A dynamic skill library accumulates structured lessons from execution feedback across optimization rounds, enabling in-context improvement without any gradient updates or fine-tuning. On a mixed-task benchmark of queries spanning code, math, and QA, OOPMAS achieves 89.6% accuracy, outperforming the strongest baseline by 18.1 percentage points. A model-swap study across four LLM backbones shows consistent scaling, reaching 92.4% with the strongest model.

1 Introduction

Multi-agent systems (MAS) powered by large language models have emerged as a leading paradigm for solving complex tasks across code generation, mathematical reasoning, question answering, and scientific analysis [Hong et al., 2024, Wu et al., 2023, Wang et al., 2024a, Li et al., 2023] Designing these systems, however, remains a largely manual process [Nori et al., 2023, Wei et al., 2023, Madaan et al., 2023, Wang et al., 2024b]. Each new task requires developers to decide which agents to create, what roles and tools to assign, and how agents should coordinate. This manual effort limits both scalability and adaptability.

39th Conference on Neural Information Processing Systems (NeurIPS 2025).

Figure

Figure 1: Task-level workflows fail on real-world query streams. Each fixed workflow catches only its native domain; queries from other domains and multi-domain queries (gray) are missed. No single workflow handles the full mixed distribution.

Recent works are moving to automate the generation and optimization of multi-agent workflows [Zhang et al., 2025a, Hu et al., 2025, Zhang et al., 2025b,c]. These methods have shown strong results on individual benchmarks including HumanEval [Chen et al., 2021], GSM8k [Cobbe et al., 2021], MATH [Hendrycks et al., 2021], and HotpotQA [Yang et al., 2018] by optimizing a single agentic workflow for each of the benchmarks. This one workflow per task approach share a common assumption that a single fixed workflow is the optimal solution uniformly to all queries within that benchmark. We argue that this task-level assumption breaks down in realistic deployment settings for two reasons (illustrated in Figure 1). First, within a single task category, the optimal MAS structure varies with query difficulty. An easy coding problem can be solved by a straightforward workflow, while a repository-level coding task benefits from a substantially more complex workflow. A single task-level workflow must commit to one topology and cannot adapt. Second, real-world query streams are heterogeneous mixtures of task types with unpredictable distribution. A workflow optimized for code generation provides no benefit when a math reasoning or question answering query arrives while supporting mixed workloads under the task-level paradigm would require maintaining a separate optimized system per domain plus a routing mechanism. Our argument is supported by the evaluation of these task-level methods on a mixed-task benchmark containing code, math, and QA queries, where the single optimized workflow often performs well on one task but poorly on others.

A second structural limitation for both task-level and query-level methods. Existing approaches search for workflow while holding the agent pool fixed [Zhang et al., 2025b, Hu et al., 2025, Gao et al., 2025]. We argue that constraining the agent set limits the reachable solution space. If no agent in the pool possesses the domain expertise required by a particular query, no workflow in the search space over that pool can produce an optimal solution. The agents themselves must also be generated dynamically.

In this paper, we introduce OOPMAS (Object-Oriented Programming Multi-Agent Systems), a training-free framework that generates both the agent set and the workflow for individual queries. Given a query, a frozen LLM acting as a meta-agent first generates a pool of specialist agents with tailored role prompts, tool bindings, and model configurations, then produces an executable workflow program that orchestrates these agents to solve the query. Agents are represented as object-oriented class definitions, a choice that naturally encapsulates each agent's role, tools, and persistent state, and that aligns with code patterns prevalent in LLM pretraining data, leading to more reliable generation. The workflow is iteratively refined across multiple optimization rounds using a dynamic skill library that accumulates structured lessons from past successes and failures, enabling in-context improvement without any gradient updates, distillation, or fine-tuning.

We evaluate OOPMAS on two benchmarks. The standard Mixed benchmark draws 120 queries from six standard sources (HumanEval, MBPP, MATH, GSM8K, HotpotQA, DROP); the Hard Mixed benchmark draws 180 competition-level queries (AIME 2025/2026, LiveCodeBench, CodeContests,

GPQA Diamond) with diverse output formats. OOPMAS achieves 89.6% on Mixed (vs. 71.5% for ADAS, +18.1 points) and 90.8% on Hard Mixed (vs. 72.3% for ADAS, +18.5 points). The same gap is preserved despite the much harder problem distribution, showing that per-query generation generalises rather than relying on benchmark-specific memorisation. A model-swap study across four LLM backbones (GPT-4.1 through GPT-5.2) shows that OOPMAS scales consistently with model capability, reaching 92.4% with GPT-5.2 without any system-level changes.

Our contributions are as follows:

  1. Problem formulation. We formalise MAS generation as a query-level optimisation problem over a joint agent-and-workflow search space, and argue that both query-level adaptation and dynamic agent generation are necessary for handling heterogeneous task distributions.

  2. OOPMAS framework. We propose a training-free, two-phase pipeline consisting of dynamic OOP-style agent generation and iterative workflow optimisation with a structured skill library. The system requires no reinforcement learning, distillation, or fine-tuning and is immediately deployable on arbitrary task distributions.

  3. Mixed and Hard Mixed benchmarks. We introduce two benchmarks that test MAS generation under realistic heterogeneous workloads, including a competition-difficulty Hard Mixed benchmark spanning AIME, LiveCodeBench, CodeContests, and GPQA. OOPMAS substantially outperforms existing task-level and query-level baselines across both benchmarks and all domains, with the gap preserved as task difficulty grows.

References (1)