MAS-squared
Most multi-agent systems are designed by hand for one kind of task. MAS-squared designs them automatically. A meta-team of three agents, a generator, an implementer, and a rectifier, composes a target multi-agent system to fit the task at hand and corrects it as it runs. It is a multi-agent system that builds multi-agent systems, and its meta-agents are trained with a method called collaborative tree optimization.
*These are learning tools, not prompts. They teach you to write your own, think of them as training wheels that guide you while you learn, then fall away once you can ride on your own.
A System That Builds the System
Designing a good multi-agent system is hard, and the design that works for one task often fails for another. Picking the agents, their roles, and how they connect usually falls to a human engineer, once, in advance. MAS-squared asks whether that design work could itself be done by agents, tuned to each task in real time.
Its answer is a meta-team with three roles. A generator proposes the structure of a target multi-agent system suited to the task. An implementer instantiates that design into a working system. A rectifier watches the system run and adaptively corrects it when it misbehaves. Together, this meta-team generates, configures, and repairs the actual system that does the user's work, hence a multi-agent system operating on multi-agent systems.
To make the meta-agents good at these jobs, MAS-squared trains them with a technique the authors call collaborative tree optimization. This is a training step, so the meta-team is specialized rather than purely prompted, but once trained it composes and rectifies target systems on the fly, adapting the design to each task instead of relying on a single fixed architecture.
MAS-squared's meta-team is generator, implementer, rectifier. It composes a target multi-agent system per task and repairs it as it runs. Note that the meta-agents are trained via collaborative tree optimization, so this is more than a prompting pattern: it specializes the meta-team, which then builds systems automatically.
The MAS-squared Process
Generate the system, implement it, and rectify it as it runs
Generate a Target System
The generator meta-agent reads the task and proposes the design of a multi-agent system to solve it: which agents to include, their roles, and how they should interact. The design is tailored to the task rather than drawn from a fixed template.
For a data-analysis task, the generator proposes a system with a data-cleaning agent, an analysis agent, and a reporting agent.
Implement the Design
The implementer meta-agent turns the proposed design into a working configuration: instantiating the agents with their prompts and wiring their interactions. The abstract design becomes a running system.
Each proposed role is set up with its instructions and connected in the intended order, ready to process the data.
Rectify as It Runs
The rectifier meta-agent monitors the target system in operation and corrects it when something goes wrong, adjusting roles, prompts, or connections in response to real-time task demands. The system is not just built once but repaired as needed.
Noticing the analysis agent is fed unclean data, the rectifier strengthens the cleaning step before analysis continues.
Deliver the Task Result
The composed, self-corrected target system carries out the task and returns the result. Because the meta-team designed the system for this task and fixed it along the way, the outcome reflects a fit-for-purpose architecture rather than a one-size-fits-all one.
The reporting agent produces the analysis, built on cleaned data thanks to the rectifier's mid-run correction.
See the Difference
A hand-designed system versus a self-composing one
Hand-Designed System
An engineer designs the agents, roles, and connections in advance. The same architecture is reused across tasks, whether or not it fits each one.
When a task needs a different structure, the fixed design underperforms, and fixing it means human redesign.
MAS-squared
A trained meta-team generates a system for the task, implements it, and rectifies it as it runs, adapting the design in real time.
Each task gets a fit-for-purpose architecture that repairs itself, without a human redesigning the system for every case.
Practice Responsible AI
Always verify AI-generated content before use. AI systems can produce confident but incorrect responses. When using AI professionally, transparent disclosure is both best practice and increasingly a legal requirement.
Most US states are actively legislating AI transparency and accountability. Critical thinking remains your strongest tool against misinformation.
MAS-squared in Action
See how the meta-team composes and repairs a system
A request that does not match any existing multi-agent template: summarize research and draft an outreach plan.
Generate: the generator designs a system with a research-summarizer agent and an outreach-planner agent.
Implement: the implementer instantiates both with suitable prompts and connects them.
Result: a bespoke system is stood up for a task no fixed architecture anticipated.
The outreach-planner keeps producing generic plans because it lacks the summary's key points.
The rectifier detects the gap and adjusts the wiring so the summarizer's key points are passed explicitly to the planner.
Result: the plans become specific and grounded, corrected without a human intervening.
Partway through, the task grows to require a compliance check that was not in the original design.
The meta-team revises the target system, adding a compliance-review agent and routing outputs through it.
Result: the system reconfigures itself to meet the new demand rather than failing or needing a manual rebuild.
When to Use MAS-squared
Best when tasks vary and a fixed multi-agent design will not do
Perfect For
When the ideal multi-agent structure changes from task to task, generating a fresh system per task beats reusing one fixed design.
Where an agent system will hit problems mid-run, a rectifier that repairs it in place avoids manual intervention.
When you want to remove the human from designing each multi-agent system, a trained meta-team can compose them automatically.
When task demands can shift partway through, a self-configuring system that adds or rewires agents adapts without a rebuild.
Skip It When
If a single, well-understood architecture handles all your tasks, a hand-designed system is simpler than a meta-team that composes one each time.
MAS-squared specializes its meta-team through training; where that training is not feasible, a purely prompted approach may fit better.
If one agent solves the task, composing a whole multi-agent system, let alone a meta-team to design it, is unwarranted overhead.
Use Cases
Where MAS-squared delivers the most value
Automated Agent Platforms
Let a platform compose a fit-for-purpose multi-agent system for each incoming task, instead of asking engineers to design one per use case.
Self-Healing Workflows
Run agent systems that detect and repair their own failures mid-task, keeping long or critical jobs on track without a human stepping in.
Diverse Task Queues
Handle a stream of very different requests, generating a tailored agent system for each rather than forcing them all through one design.
Adaptive Pipelines
Support pipelines whose requirements evolve while running, letting the meta-team add or rewire agents to meet new demands.
Rapid Prototyping of Agent Teams
Explore many candidate multi-agent designs quickly, letting the generator propose structures a human might not have tried.
Research on Agent Architectures
Study how automatically composed and corrected systems compare to hand-designed ones across a range of tasks.
Where MAS-squared Fits
Self-composing systems in the multi-agent family
Where HALO designs a team within a run, MAS-squared trains a meta-team that generates, configures, and repairs whole target systems per task. Reach for it when tasks vary enough that a single hand-designed architecture will not serve, and self-correction matters.
Related Techniques
Explore complementary multi-agent techniques
Let the System Design Itself
Explore how agents can compose and correct other agent systems in the Prompt Builder, or see related multi-agent techniques.