linhh29/Skill_MAS

Code for "Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems"

Python

56

15 commits

updated Oct 9, 2026

See the code

README

πŸš€ Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems

One SKILL.md β†’ Three-Stage MAS Build β†’ Multi-Benchmark Evolution

Paper Daily Paper Code Blog

Gallery Demo Run Locally


πŸ₯³ News

  • [2026-10-09] Skill-MAS now supports Codex and Claude Code! After installation, it automatically selects the appropriate optimized skill for the current task and orchestrates the workflow alongside your existing agent skills. Quick start.
  • [2026-08-21] πŸŽ‰ Skill-MAS has been accepted to EMNLP 2026!
  • [2026-06-17] We release the code and paper: Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems.

Table of Contents


1. Overview

Skill-MAS evolves a single meta-agent skill file (SKILL.md) that instructs an LLM to design and orchestrate a Multi-Agent System (MAS) in three stages:

StageNameOutput
1Task DecompositionSub-task graph & constraints
2Agent EngineeringSub-agent roles, tools, prompts
3Workflow OrchestrationExecutable MAS Python code

Trajectories from each evolution round drive contrastive reflection and skill rewriting; the best skill snapshot is selected across rounds.

Three ways to use this repo

PathWhen to use
🧩 Codex / Claude Code skillImport evolved orchestration strategies into your everyday agent workflow
πŸš€ Demo InferenceOne question + existing skill β†’ build & run MAS immediately
πŸ”„ EvolutionMulti-round skill optimization on benchmark validation sets

Repository Layout

Skill_MAS/
β”œβ”€β”€ assert/               # README figures (background.png, Method.png)
β”œβ”€β”€ core/                 # CLI entry, evolution pipeline, resume, task selection
β”œβ”€β”€ evolution/            # Rollout, contrastive reflection, skill optimizer, bench adapters
β”œβ”€β”€ skill_mas/            # 3-stage MAS builder, async LLM client, model_config.json
β”œβ”€β”€ template/             # Generated MAS code templates and SubAgent runtime
β”œβ”€β”€ utils/                # Paths, cost tracking, logging, redaction
β”œβ”€β”€ init_skill/           # Initial (pre-evolution) SKILL.md
β”œβ”€β”€ optimized_skill/      # Pre-evolved skills per benchmark (ready to test)
β”œβ”€β”€ skills/skill-mas/      # Portable agent skill + four adapted task profiles
β”œβ”€β”€ scripts/              # Skill installer + default startup routing
β”œβ”€β”€ .claude-plugin/       # Claude Code plugin and marketplace manifests
β”œβ”€β”€ hooks/                # Claude plugin session-start routing
β”œβ”€β”€ docs/agent-skills.md   # Installation, profiles, updates, and adaptation notes
β”œβ”€β”€ dataset/              # Bundled benchmark code + data
β”‚   β”œβ”€β”€ vitabench/        # VitaBench (src/vita, data/)
β”‚   β”œβ”€β”€ deep_research_bench/
β”‚   β”œβ”€β”€ hlemath/
β”‚   └── BrowseComp-Plus/
β”œβ”€β”€ run_*.sh              # Evolution wrappers (run from parent of Skill_MAS/)
β”œβ”€β”€ demo_inference.py     # Single-question build + inference demo
β”œβ”€β”€ demo_inference.sh     # Shell wrapper for demo_inference.py
└── results/              # Generated at runtime (not shipped)

How an evolution round works

  1. Multi-trajectory rollout (evolution/rollout_multi.py) β€” run k trajectories per validation task; the agent reads the current round's SKILL.md, generates MAS code via three build stages (skill_mas/build.py), executes it, and records scores plus phase-level traces.

  2. Contrastive reflection (evolution/contrastive_reflect.py) β€” compare high- vs low-scoring trajectories and synthesize structured improvement signals.

  3. Skill bank optimization (evolution/bank_optimizer.py) β€” an optimizer LLM rewrites the single SKILL.md using reflection reports and round statistics.

  4. Round selection (evolution/assemble_select.py) β€” track per-round scores; after all rounds, select the best skill snapshot.

Benchmark backends

BackendCLI flagValidation data (default)Evolution scriptPer-bench eval script
VitaBench--bench-backend vitabenchdataset/vitabench/data/vita_validate.jsonrun_vita.shdataset/vitabench/run_skill_mas.sh
Deep Research Bench--bench-backend drbdataset/deep_research_bench/data/drb_validate.jsonlrun_drb.shdataset/deep_research_bench/run_skill_mas.sh
HLEMath--bench-backend hlemathdataset/hlemath/data/hlemath_validate.jsonlrun_hlemath.shdataset/hlemath/run_skill_mas.sh
BrowseComp-Plus--bench-backend bcpdataset/BrowseComp-Plus/data/browsecomp_plus_validate.jsonlrun_bcp.shdataset/BrowseComp-Plus/run_skill_mas.sh

Where results land

Skill_MAS/results/{backend}_{model_tag}/
β”œβ”€β”€ artifacts/
β”‚   β”œβ”€β”€ skills/{bench_id}/{run_id}/round_XX/SKILL.md   # skill snapshots per round
β”‚   └── runs/{bench_id}/{run_id}/summary_rXX.json      # round metrics
└── log/{bench_id}/{run_id}/round_XX/                  # traces, exports

Each round also saves:

round_r/
  β”œβ”€β”€ trajectories/     # per-task, per-trajectory records
  β”œβ”€β”€ aspects/          # phase-level snapshots
  └── contrastive/      # reflection reports

skills/.../round_r/
  β”œβ”€β”€ SKILL.md          # skill used in this round (rewritten after r-1)
  β”œβ”€β”€ bank_meta.json    # optimization history
  └── knee_images/      # task-priority elbow plots

Use in Codex or Claude Code

Bring Skill-MAS's task decomposition β†’ agent engineering β†’ workflow orchestration into your everyday agent workflow. After installation, Skill-MAS automatically selects the appropriate optimized skill for the current task and orchestrates the workflow alongside your existing skills. The portable skill-mas adapts optimized_skill/ to native agent tools and coordinates delegation and verification as needed. Simple questions and small edits stay lightweight. No benchmark datasets, Python packages, or separate model API keys are needed; your agent's existing tools and access apply.

Install

Clone the repo and run the installer with Python 3.9+:

git clone --depth 1 https://github.com/linhh29/Skill_MAS.git
cd Skill_MAS

# Install for both agents, or choose --agent codex / --agent claude.
python3 scripts/install_agent_skill.py --agent both

This installs the self-contained skill and enables default startup routing. Codex receives a managed block in its AGENTS.md; Claude Code receives a dedicated rules/skill-mas.md. Existing instructions are preserved and changed instruction files are backed up. See the exact paths and controls. For installation in just one project:

python3 scripts/install_agent_skill.py --agent both --scope project --project /path/to/your-project

Use your agent normally

Open a new Codex or Claude Code session in the target project and describe your task:

Compare these three retrieval approaches and recommend one for our project.
Solve this combinatorics problem and explain the proof: [your problem]
Find the project matching these clues and verify the sources: [your clues]
Implement this feature, integrate the changes, and check that it works.

Skill-MAS selects the relevant strategy internally:

ProfileAdapted fromUseful for
drbDeep Research BenchParallel research and report synthesis
hlemathHLEMathShared assumptions, independent reasoning, small-case checks
bcpBrowseComp-PlusMulti-clue search, candidate comparison, relationship verification
vitabenchVitaBenchTool workflows, structured decisions, dependency-aware execution

Specialist skills handle their own domains. If an existing orchestration skill already coordinates a task, Skill-MAS adds handoff and verification guidance to that workflow, keeping one plan and avoiding duplicate agent teams.

Claude Code plugin alternative

Instead of the copy installer, run these commands inside Claude Code and complete the installation in its plugin interface:

/plugin marketplace add linhh29/Skill_MAS
/plugin install skill-mas@skill-mas-marketplace

Start a new session and use the same ordinary prompts above. The plugin's SessionStart hook loads the routing guidance so the agent can select an optimized skill for the current task. Existing plugin users should update to the latest version.

Choose either the plugin or the copy installation for Claude Code to avoid duplicate entries. Default routing is implemented through the hosts' instruction and hook mechanisms; Skill-MAS is an installed extension, not an official bundled component. The skill uses available native delegation; when subagents are unavailable, it follows the same workflow sequentially and says so. These are adapted orchestration instructions; benchmark results do not establish their performance in Codex or Claude Code.

See the installation and adaptation guide for manual installation, updates, removal, source mapping, and troubleshooting. The research runtime setup below is only needed for the demo and benchmark workflows.


2. Setup

Repository layout

Check out this repo so that Skill_MAS/ lives under a parent directory (e.g. demo/ or arxiv_code/). All benchmarks are vendored under Skill_MAS/dataset/; you do not need sibling copies of vitabench_single/, hlemath/, etc.

Python environment

Install dependencies for Skill-MAS and the benchmark you use (see dataset/vitabench/requirements.txt and each benchmark's README).

conda create -n skill_mas python=3.11 -y
conda activate skill_mas
pip install openai pydantic loguru  # plus benchmark-specific deps

Model & API configuration

Edit skill_mas/model_config.json β€” model ids, pricing, base_url, and ${OPENAI_API_KEY} placeholders. Shell scripts resolve credentials via environment variables:


3. Demo Inference (Custom Question)

Use this when you want to try Skill-MAS on your own task without running multi-round evolution.

We ship ready-to-use skill files β€” no evolution required:

PathRole
init_skill/SKILL.mdInitial meta-agent skill (pre-evolution baseline)
optimized_skill/vitabench.mdEvolved skill for VitaBench
optimized_skill/drb.mdEvolved skill for Deep Research Bench
optimized_skill/hlemath.mdEvolved skill for HLEMath
optimized_skill/bcp.mdEvolved skill for BrowseComp-Plus

demo_inference.py loads any of these paths, runs the three-stage build, prints Stage-3 MAS code, executes the generated workflow, and prints the answer.

Supported standalone datasets in the demo: hlemath, drb, bcp. VitaBench needs the full simulator (run_vita.sh or dataset/vitabench/run_skill_mas.sh).

cd /path/to/parent-of-Skill_MAS

# Usage: bash Skill_MAS/demo_inference.sh <model_id> <skill_path> "<question>"

bash Skill_MAS/demo_inference.sh qwen3.5-plus \
  Skill_MAS/init_skill/SKILL.md \
  "What is 17 + 28? Give the final answer in \\boxed{...} form."

bash Skill_MAS/demo_inference.sh qwen3.5-plus \
  Skill_MAS/optimized_skill/hlemath.md \
  "Find the number of positive integers n such that n^2 + 3n + 2 is divisible by n + 1."

Option B β€” Python directly

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"
export PYTHONPATH="$(pwd):$(pwd)/Skill_MAS/dataset:$(pwd)/Skill_MAS/dataset/vitabench/src"

python Skill_MAS/demo_inference.py \
  --model qwen3.5-plus \
  --skill Skill_MAS/optimized_skill/drb.md \
  --question "Summarize recent progress in retrieval-augmented generation." \
  --verbose

python Skill_MAS/demo_inference.py \
  --model qwen3.5-plus \
  --skill Skill_MAS/init_skill/SKILL.md \
  --question "Your task prompt here." \
  --dataset hlemath \
  --save-mas-code /tmp/demo_mas.py

CLI flags

FlagDescription
--skillPath to SKILL.md or optimized_skill/*.md (required)
--questionInput task / question (required)
--modelAgent model id from model_config.json (default: qwen3.5-plus)
--datasethlemath | drb | bcp | vita; auto-inferred from skill filename when omitted
--save-mas-codeOptional path to save generated MAS Python code
--verbosePrint parsed JSON from each build stage

BrowseComp-Plus skills (bcp) additionally accept --bcp-index-path, --bcp-retrieval-topk, --bcp-doc-max-tokens, and --bcp-max-retrieval-rounds. The BM25 index under dataset/BrowseComp-Plus/scripts_build_index/indexes/bm25 must be available (see that benchmark's README).

For BrowseComp-Plus, refer to the official repo for data preprocessing. We do not ship a plain-text data file used in our paper, to reduce data contamination risk.


4. Running Evolution

Quick start (shell scripts)

Run from the directory above Skill_MAS/. Each run_*.sh takes two positional arguments: agent model id and max concurrency.

cd /path/to/parent-of-Skill_MAS

# VitaBench (cross-domain: delivery, instore, ota)
bash Skill_MAS/run_vita.sh <model_id> <max_concurrency>

# Deep Research Bench
bash Skill_MAS/run_drb.sh <model_id> <max_concurrency>

# HLEMath
bash Skill_MAS/run_hlemath.sh <model_id> <max_concurrency>

# BrowseComp-Plus
bash Skill_MAS/run_bcp.sh <model_id> <max_concurrency>

Default evolution settings in the scripts:

ParameterDefaultMeaning
ROUNDS10Number of evolve rounds
K_TRAJ5Trajectories sampled per task per round
MAX_PROBLEMS0Validation subset size (0 = all tasks)
RUN_IDexp1Logical run name under results/

Tweak the variables at the top of each script to change rounds, task limits, evaluator/judge models, etc.

CLI (direct invocation)

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"
export PYTHONPATH="$(pwd):$(pwd)/Skill_MAS/dataset:$(pwd)/Skill_MAS/dataset/vitabench/src"

python -m Skill_MAS evolve \
  --bench-backend vitabench \
  --bench-id skill_mas_agent \
  --run-id exp1 \
  --domain "delivery,instore,ota" \
  --jsonl Skill_MAS/dataset/vitabench/data/vita_validate.json \
  --rounds 10 \
  --k-trajectories 5 \
  --agent-llm <model_id> \
  --user-llm <model_id> \
  --evaluator-llm <evaluator_model_id> \
  --optimizer-llm <model_id> \
  --max-concurrency 16 \
  --max-steps 300 \
  --language chinese

Resume and fresh runs

ModeHow
ResumeRe-run the same command with the same --run-id. Completed rounds are detected via summary_rXX.json.
Fresh runAdd --fresh to allocate a new run directory (exp1_2, exp1_3, …) and restart from round_00.

5. Evaluating a Fixed Skill

Run a benchmark with an existing skill β€” no multi-round evolution. The first argument is a path relative to Skill_MAS/ (e.g. init_skill/SKILL.md or optimized_skill/hlemath.md).

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"

bash Skill_MAS/dataset/hlemath/run_skill_mas.sh init_skill/SKILL.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/deep_research_bench/run_skill_mas.sh optimized_skill/drb.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/BrowseComp-Plus/run_skill_mas.sh optimized_skill/bcp.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/vitabench/run_skill_mas.sh optimized_skill/vitabench.md <model_id> <max_concurrency>

6. Tips

  • Start with demo_inference.sh on one HLEMath question before launching a full evolution run β€” it is the fastest way to validate API config and skill quality.
  • Use --verbose in demo_inference.py to inspect Stage 1–2 JSON; Stage 3 MAS code is always printed before execution.
  • Begin with smaller MAX_PROBLEMS, fewer ROUNDS, or lower K_TRAJ in the shell scripts.
  • --fresh vs resume: same --run-id resumes; add --fresh when you want a clean experiment directory.
  • BrowseComp-Plus requires the BM25 index and official data pipeline β€” see dataset/BrowseComp-Plus/README.md.
  • Cached trajectories and skills live under results/; add that path to .gitignore if you fork the repo.

🌟 If you find Skill-MAS helpful, please consider citing our paper and giving us a star!


7. BibTeX

@article{lin2026skill,
  title   = {Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems},
  author  = {Lin, Hehai and Yang, Qi and Qin, Chengwei},
  journal = {arXiv preprint arXiv:2606.18837},
  year    = {2026}
}

linhh29/Skill_MAS

Code for "Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems"

Python

56

15 commits

updated Oct 9, 2026

See the code

README

πŸš€ Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems

One SKILL.md β†’ Three-Stage MAS Build β†’ Multi-Benchmark Evolution

Paper Daily Paper Code Blog

Gallery Demo Run Locally


πŸ₯³ News

  • [2026-10-09] Skill-MAS now supports Codex and Claude Code! After installation, it automatically selects the appropriate optimized skill for the current task and orchestrates the workflow alongside your existing agent skills. Quick start.
  • [2026-08-21] πŸŽ‰ Skill-MAS has been accepted to EMNLP 2026!
  • [2026-06-17] We release the code and paper: Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems.

Table of Contents


1. Overview

Skill-MAS evolves a single meta-agent skill file (SKILL.md) that instructs an LLM to design and orchestrate a Multi-Agent System (MAS) in three stages:

StageNameOutput
1Task DecompositionSub-task graph & constraints
2Agent EngineeringSub-agent roles, tools, prompts
3Workflow OrchestrationExecutable MAS Python code

Trajectories from each evolution round drive contrastive reflection and skill rewriting; the best skill snapshot is selected across rounds.

Three ways to use this repo

PathWhen to use
🧩 Codex / Claude Code skillImport evolved orchestration strategies into your everyday agent workflow
πŸš€ Demo InferenceOne question + existing skill β†’ build & run MAS immediately
πŸ”„ EvolutionMulti-round skill optimization on benchmark validation sets

Repository Layout

Skill_MAS/
β”œβ”€β”€ assert/               # README figures (background.png, Method.png)
β”œβ”€β”€ core/                 # CLI entry, evolution pipeline, resume, task selection
β”œβ”€β”€ evolution/            # Rollout, contrastive reflection, skill optimizer, bench adapters
β”œβ”€β”€ skill_mas/            # 3-stage MAS builder, async LLM client, model_config.json
β”œβ”€β”€ template/             # Generated MAS code templates and SubAgent runtime
β”œβ”€β”€ utils/                # Paths, cost tracking, logging, redaction
β”œβ”€β”€ init_skill/           # Initial (pre-evolution) SKILL.md
β”œβ”€β”€ optimized_skill/      # Pre-evolved skills per benchmark (ready to test)
β”œβ”€β”€ skills/skill-mas/      # Portable agent skill + four adapted task profiles
β”œβ”€β”€ scripts/              # Skill installer + default startup routing
β”œβ”€β”€ .claude-plugin/       # Claude Code plugin and marketplace manifests
β”œβ”€β”€ hooks/                # Claude plugin session-start routing
β”œβ”€β”€ docs/agent-skills.md   # Installation, profiles, updates, and adaptation notes
β”œβ”€β”€ dataset/              # Bundled benchmark code + data
β”‚   β”œβ”€β”€ vitabench/        # VitaBench (src/vita, data/)
β”‚   β”œβ”€β”€ deep_research_bench/
β”‚   β”œβ”€β”€ hlemath/
β”‚   └── BrowseComp-Plus/
β”œβ”€β”€ run_*.sh              # Evolution wrappers (run from parent of Skill_MAS/)
β”œβ”€β”€ demo_inference.py     # Single-question build + inference demo
β”œβ”€β”€ demo_inference.sh     # Shell wrapper for demo_inference.py
└── results/              # Generated at runtime (not shipped)

How an evolution round works

  1. Multi-trajectory rollout (evolution/rollout_multi.py) β€” run k trajectories per validation task; the agent reads the current round's SKILL.md, generates MAS code via three build stages (skill_mas/build.py), executes it, and records scores plus phase-level traces.

  2. Contrastive reflection (evolution/contrastive_reflect.py) β€” compare high- vs low-scoring trajectories and synthesize structured improvement signals.

  3. Skill bank optimization (evolution/bank_optimizer.py) β€” an optimizer LLM rewrites the single SKILL.md using reflection reports and round statistics.

  4. Round selection (evolution/assemble_select.py) β€” track per-round scores; after all rounds, select the best skill snapshot.

Benchmark backends

BackendCLI flagValidation data (default)Evolution scriptPer-bench eval script
VitaBench--bench-backend vitabenchdataset/vitabench/data/vita_validate.jsonrun_vita.shdataset/vitabench/run_skill_mas.sh
Deep Research Bench--bench-backend drbdataset/deep_research_bench/data/drb_validate.jsonlrun_drb.shdataset/deep_research_bench/run_skill_mas.sh
HLEMath--bench-backend hlemathdataset/hlemath/data/hlemath_validate.jsonlrun_hlemath.shdataset/hlemath/run_skill_mas.sh
BrowseComp-Plus--bench-backend bcpdataset/BrowseComp-Plus/data/browsecomp_plus_validate.jsonlrun_bcp.shdataset/BrowseComp-Plus/run_skill_mas.sh

Where results land

Skill_MAS/results/{backend}_{model_tag}/
β”œβ”€β”€ artifacts/
β”‚   β”œβ”€β”€ skills/{bench_id}/{run_id}/round_XX/SKILL.md   # skill snapshots per round
β”‚   └── runs/{bench_id}/{run_id}/summary_rXX.json      # round metrics
└── log/{bench_id}/{run_id}/round_XX/                  # traces, exports

Each round also saves:

round_r/
  β”œβ”€β”€ trajectories/     # per-task, per-trajectory records
  β”œβ”€β”€ aspects/          # phase-level snapshots
  └── contrastive/      # reflection reports

skills/.../round_r/
  β”œβ”€β”€ SKILL.md          # skill used in this round (rewritten after r-1)
  β”œβ”€β”€ bank_meta.json    # optimization history
  └── knee_images/      # task-priority elbow plots

Use in Codex or Claude Code

Bring Skill-MAS's task decomposition β†’ agent engineering β†’ workflow orchestration into your everyday agent workflow. After installation, Skill-MAS automatically selects the appropriate optimized skill for the current task and orchestrates the workflow alongside your existing skills. The portable skill-mas adapts optimized_skill/ to native agent tools and coordinates delegation and verification as needed. Simple questions and small edits stay lightweight. No benchmark datasets, Python packages, or separate model API keys are needed; your agent's existing tools and access apply.

Install

Clone the repo and run the installer with Python 3.9+:

git clone --depth 1 https://github.com/linhh29/Skill_MAS.git
cd Skill_MAS

# Install for both agents, or choose --agent codex / --agent claude.
python3 scripts/install_agent_skill.py --agent both

This installs the self-contained skill and enables default startup routing. Codex receives a managed block in its AGENTS.md; Claude Code receives a dedicated rules/skill-mas.md. Existing instructions are preserved and changed instruction files are backed up. See the exact paths and controls. For installation in just one project:

python3 scripts/install_agent_skill.py --agent both --scope project --project /path/to/your-project

Use your agent normally

Open a new Codex or Claude Code session in the target project and describe your task:

Compare these three retrieval approaches and recommend one for our project.
Solve this combinatorics problem and explain the proof: [your problem]
Find the project matching these clues and verify the sources: [your clues]
Implement this feature, integrate the changes, and check that it works.

Skill-MAS selects the relevant strategy internally:

ProfileAdapted fromUseful for
drbDeep Research BenchParallel research and report synthesis
hlemathHLEMathShared assumptions, independent reasoning, small-case checks
bcpBrowseComp-PlusMulti-clue search, candidate comparison, relationship verification
vitabenchVitaBenchTool workflows, structured decisions, dependency-aware execution

Specialist skills handle their own domains. If an existing orchestration skill already coordinates a task, Skill-MAS adds handoff and verification guidance to that workflow, keeping one plan and avoiding duplicate agent teams.

Claude Code plugin alternative

Instead of the copy installer, run these commands inside Claude Code and complete the installation in its plugin interface:

/plugin marketplace add linhh29/Skill_MAS
/plugin install skill-mas@skill-mas-marketplace

Start a new session and use the same ordinary prompts above. The plugin's SessionStart hook loads the routing guidance so the agent can select an optimized skill for the current task. Existing plugin users should update to the latest version.

Choose either the plugin or the copy installation for Claude Code to avoid duplicate entries. Default routing is implemented through the hosts' instruction and hook mechanisms; Skill-MAS is an installed extension, not an official bundled component. The skill uses available native delegation; when subagents are unavailable, it follows the same workflow sequentially and says so. These are adapted orchestration instructions; benchmark results do not establish their performance in Codex or Claude Code.

See the installation and adaptation guide for manual installation, updates, removal, source mapping, and troubleshooting. The research runtime setup below is only needed for the demo and benchmark workflows.


2. Setup

Repository layout

Check out this repo so that Skill_MAS/ lives under a parent directory (e.g. demo/ or arxiv_code/). All benchmarks are vendored under Skill_MAS/dataset/; you do not need sibling copies of vitabench_single/, hlemath/, etc.

Python environment

Install dependencies for Skill-MAS and the benchmark you use (see dataset/vitabench/requirements.txt and each benchmark's README).

conda create -n skill_mas python=3.11 -y
conda activate skill_mas
pip install openai pydantic loguru  # plus benchmark-specific deps

Model & API configuration

Edit skill_mas/model_config.json β€” model ids, pricing, base_url, and ${OPENAI_API_KEY} placeholders. Shell scripts resolve credentials via environment variables:


3. Demo Inference (Custom Question)

Use this when you want to try Skill-MAS on your own task without running multi-round evolution.

We ship ready-to-use skill files β€” no evolution required:

PathRole
init_skill/SKILL.mdInitial meta-agent skill (pre-evolution baseline)
optimized_skill/vitabench.mdEvolved skill for VitaBench
optimized_skill/drb.mdEvolved skill for Deep Research Bench
optimized_skill/hlemath.mdEvolved skill for HLEMath
optimized_skill/bcp.mdEvolved skill for BrowseComp-Plus

demo_inference.py loads any of these paths, runs the three-stage build, prints Stage-3 MAS code, executes the generated workflow, and prints the answer.

Supported standalone datasets in the demo: hlemath, drb, bcp. VitaBench needs the full simulator (run_vita.sh or dataset/vitabench/run_skill_mas.sh).

cd /path/to/parent-of-Skill_MAS

# Usage: bash Skill_MAS/demo_inference.sh <model_id> <skill_path> "<question>"

bash Skill_MAS/demo_inference.sh qwen3.5-plus \
  Skill_MAS/init_skill/SKILL.md \
  "What is 17 + 28? Give the final answer in \\boxed{...} form."

bash Skill_MAS/demo_inference.sh qwen3.5-plus \
  Skill_MAS/optimized_skill/hlemath.md \
  "Find the number of positive integers n such that n^2 + 3n + 2 is divisible by n + 1."

Option B β€” Python directly

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"
export PYTHONPATH="$(pwd):$(pwd)/Skill_MAS/dataset:$(pwd)/Skill_MAS/dataset/vitabench/src"

python Skill_MAS/demo_inference.py \
  --model qwen3.5-plus \
  --skill Skill_MAS/optimized_skill/drb.md \
  --question "Summarize recent progress in retrieval-augmented generation." \
  --verbose

python Skill_MAS/demo_inference.py \
  --model qwen3.5-plus \
  --skill Skill_MAS/init_skill/SKILL.md \
  --question "Your task prompt here." \
  --dataset hlemath \
  --save-mas-code /tmp/demo_mas.py

CLI flags

FlagDescription
--skillPath to SKILL.md or optimized_skill/*.md (required)
--questionInput task / question (required)
--modelAgent model id from model_config.json (default: qwen3.5-plus)
--datasethlemath | drb | bcp | vita; auto-inferred from skill filename when omitted
--save-mas-codeOptional path to save generated MAS Python code
--verbosePrint parsed JSON from each build stage

BrowseComp-Plus skills (bcp) additionally accept --bcp-index-path, --bcp-retrieval-topk, --bcp-doc-max-tokens, and --bcp-max-retrieval-rounds. The BM25 index under dataset/BrowseComp-Plus/scripts_build_index/indexes/bm25 must be available (see that benchmark's README).

For BrowseComp-Plus, refer to the official repo for data preprocessing. We do not ship a plain-text data file used in our paper, to reduce data contamination risk.


4. Running Evolution

Quick start (shell scripts)

Run from the directory above Skill_MAS/. Each run_*.sh takes two positional arguments: agent model id and max concurrency.

cd /path/to/parent-of-Skill_MAS

# VitaBench (cross-domain: delivery, instore, ota)
bash Skill_MAS/run_vita.sh <model_id> <max_concurrency>

# Deep Research Bench
bash Skill_MAS/run_drb.sh <model_id> <max_concurrency>

# HLEMath
bash Skill_MAS/run_hlemath.sh <model_id> <max_concurrency>

# BrowseComp-Plus
bash Skill_MAS/run_bcp.sh <model_id> <max_concurrency>

Default evolution settings in the scripts:

ParameterDefaultMeaning
ROUNDS10Number of evolve rounds
K_TRAJ5Trajectories sampled per task per round
MAX_PROBLEMS0Validation subset size (0 = all tasks)
RUN_IDexp1Logical run name under results/

Tweak the variables at the top of each script to change rounds, task limits, evaluator/judge models, etc.

CLI (direct invocation)

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"
export PYTHONPATH="$(pwd):$(pwd)/Skill_MAS/dataset:$(pwd)/Skill_MAS/dataset/vitabench/src"

python -m Skill_MAS evolve \
  --bench-backend vitabench \
  --bench-id skill_mas_agent \
  --run-id exp1 \
  --domain "delivery,instore,ota" \
  --jsonl Skill_MAS/dataset/vitabench/data/vita_validate.json \
  --rounds 10 \
  --k-trajectories 5 \
  --agent-llm <model_id> \
  --user-llm <model_id> \
  --evaluator-llm <evaluator_model_id> \
  --optimizer-llm <model_id> \
  --max-concurrency 16 \
  --max-steps 300 \
  --language chinese

Resume and fresh runs

ModeHow
ResumeRe-run the same command with the same --run-id. Completed rounds are detected via summary_rXX.json.
Fresh runAdd --fresh to allocate a new run directory (exp1_2, exp1_3, …) and restart from round_00.

5. Evaluating a Fixed Skill

Run a benchmark with an existing skill β€” no multi-round evolution. The first argument is a path relative to Skill_MAS/ (e.g. init_skill/SKILL.md or optimized_skill/hlemath.md).

cd /path/to/parent-of-Skill_MAS
export OPENAI_API_KEY="your-key"

bash Skill_MAS/dataset/hlemath/run_skill_mas.sh init_skill/SKILL.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/deep_research_bench/run_skill_mas.sh optimized_skill/drb.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/BrowseComp-Plus/run_skill_mas.sh optimized_skill/bcp.md <model_id> <max_concurrency>
bash Skill_MAS/dataset/vitabench/run_skill_mas.sh optimized_skill/vitabench.md <model_id> <max_concurrency>

6. Tips

  • Start with demo_inference.sh on one HLEMath question before launching a full evolution run β€” it is the fastest way to validate API config and skill quality.
  • Use --verbose in demo_inference.py to inspect Stage 1–2 JSON; Stage 3 MAS code is always printed before execution.
  • Begin with smaller MAX_PROBLEMS, fewer ROUNDS, or lower K_TRAJ in the shell scripts.
  • --fresh vs resume: same --run-id resumes; add --fresh when you want a clean experiment directory.
  • BrowseComp-Plus requires the BM25 index and official data pipeline β€” see dataset/BrowseComp-Plus/README.md.
  • Cached trajectories and skills live under results/; add that path to .gitignore if you fork the repo.

🌟 If you find Skill-MAS helpful, please consider citing our paper and giving us a star!


7. BibTeX

@article{lin2026skill,
  title   = {Skill-MAS: Evolving Meta-Skill for Automatic Multi-Agent Systems},
  author  = {Lin, Hehai and Yang, Qi and Qin, Chengwei},
  journal = {arXiv preprint arXiv:2606.18837},
  year    = {2026}
}