Agentic & Tool-Use

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.

The Core Insight

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.

Trained Meta-Agents, Built Systems

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

1

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.

Example

For a data-analysis task, the generator proposes a system with a data-cleaning agent, an analysis agent, and a reporting agent.

2

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.

Example

Each proposed role is set up with its instructions and connected in the intended order, ready to process the data.

3

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.

Example

Noticing the analysis agent is fed unclean data, the rectifier strengthens the cleaning step before analysis continues.

4

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.

Example

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

One Fixed Architecture

An engineer designs the agents, roles, and connections in advance. The same architecture is reused across tasks, whether or not it fits each one.

Effect

When a task needs a different structure, the fixed design underperforms, and fixing it means human redesign.

Static design, manual to change
VS

MAS-squared

Composed and Corrected per Task

A trained meta-team generates a system for the task, implements it, and rectifies it as it runs, adapting the design in real time.

Effect

Each task gets a fit-for-purpose architecture that repairs itself, without a human redesigning the system for every case.

Task-fit design, self-correcting

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

Task

A request that does not match any existing multi-agent template: summarize research and draft an outreach plan.

Meta-Team

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.

Mid-Run Problem

The outreach-planner keeps producing generic plans because it lacks the summary's key points.

Rectifier

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.

Shift

Partway through, the task grows to require a compliance check that was not in the original design.

Self-Configuring

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

Highly Varied Tasks

When the ideal multi-agent structure changes from task to task, generating a fresh system per task beats reusing one fixed design.

Systems That Must Self-Correct

Where an agent system will hit problems mid-run, a rectifier that repairs it in place avoids manual intervention.

Automating System Design

When you want to remove the human from designing each multi-agent system, a trained meta-team can compose them automatically.

Evolving Requirements

When task demands can shift partway through, a self-configuring system that adds or rewires agents adapts without a rebuild.

Skip It When

One Stable Task Type

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.

No Room to Train Meta-Agents

MAS-squared specializes its meta-team through training; where that training is not feasible, a purely prompted approach may fit better.

Simple Single-Agent Work

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

Agentic Prompting Agents That Act Reason, act, observe
AgentFlow Coordinate a Flow Trained agent workflow
MAS-squared Systems Build Systems Generate, configure, rectify
HALO Tiered Orchestration Plan, design roles, execute
Chain These

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.

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.