Overview
SkillOrchestra is a skill-aware agent orchestration system based on the paper “SkillOrchestra: Learning to Route Agents via Skill Transfer”. Instead of end-to-end RL routing, it maintains a Skill Handbook that profiles each agent on fine-grained skills, infers which skills a task requires via LLM, and matches agents to tasks via explicit competence-cost scoring.
Installation
How It Works
SkillOrchestra routes tasks through a 5-step pipeline:- Skill Inference — An LLM analyzes the incoming task and identifies which fine-grained skills are required (e.g.,
python_coding,data_analysis,technical_writing), each with an importance weight. - Agent Scoring — Each agent is scored using a weighted competence-cost formula against the required skills. This step is pure math — no LLM calls.
- Agent Selection — The top-k agents with the highest scores are selected.
- Execution — Selected agents execute the task. Multiple agents run concurrently via
ThreadPoolExecutor. - Learning (optional) — An LLM evaluates the output quality, and agent skill profiles are updated via exponential moving average (EMA).
Scoring Formula
For each agent, the score is computed as:competence_iis the agent’s estimated probability of success on skillinormalized_cost_iis1 - (cost - min_cost) / (max_cost - min_cost)(lower cost = higher score)importance_iis how important the skill is for the task
Key Components
Data Models
Attributes
str
default:"SkillOrchestra"
Name identifier for the orchestrator.
str
default:"Skill-aware agent orchestration..."
Description of the orchestrator’s purpose.
List[Union[Agent, Callable]]
required
List of agents to orchestrate (at least 1 required).
int
default:"1"
Maximum execution-feedback loops per task.
OutputType
default:"dict"
Output format:
"dict", "str", "json", "final", etc.str
default:"gpt-5.4"
LLM model for skill inference and evaluation.
float
default:"0.1"
LLM temperature for inference calls.
Optional[SkillHandbook]
default:"None"
Pre-built skill handbook. If
None, auto-generated from agent descriptions.bool
default:"True"
Whether to auto-generate handbook when none is provided.
float
default:"0.3"
Weight for cost component in scoring (0-1).
float
default:"0.7"
Weight for competence component in scoring (0-1).
int
default:"1"
Number of agents to select per task.
bool
default:"True"
Whether to update skill profiles after execution via EMA.
float
default:"0.1"
EMA learning rate for profile updates.
bool
default:"True"
Whether to save conversation history and handbook to disk.
bool
default:"False"
Whether to log detailed information.
bool
default:"True"
Whether to print panels to console.
Methods
run()
Run the full pipeline on a single task.task(str): The task to executeimg(Optional[str]): Optional image inputimgs(Optional[List[str]]): Optional list of image inputs
output_type format
__call__()
Callable interface that delegates torun().
task(str): The task to execute
run()
batch_run()
Run multiple tasks sequentially.tasks(List[str]): List of tasks to execute
List[Any] - List of results, one per task
concurrent_batch_run()
Run multiple tasks concurrently.tasks(List[str]): List of tasks to execute
List[Any] - List of results from concurrent execution
get_handbook()
Return the current skill handbook as a dictionary.dict - The skill handbook data
update_handbook()
Replace the skill handbook.handbook(SkillHandbook): The new skill handbook
Architecture
Pipeline Flow
Scoring and Selection
Execution Modes
Best Practices
Agent Design
- Write descriptive agent descriptions — The auto-generated skill handbook is only as good as your agent descriptions. Be specific about what each agent can do.
- Use distinct specializations — Agents with overlapping skills reduce the effectiveness of skill-based routing. Make each agent clearly specialized.
- Keep system prompts focused — System prompts should reinforce the agent’s specialization, not try to make the agent a generalist.
Tuning Weights
- Default (0.7 competence / 0.3 cost) — Good for most use cases where quality matters more than cost.
- High competence weight (0.9 / 0.1) — Use when quality is critical and cost is not a concern.
- Balanced (0.5 / 0.5) — Use when you want a balance between quality and cost efficiency.
- High cost weight (0.3 / 0.7) — Use for high-volume, cost-sensitive workloads where “good enough” is acceptable.
Learning Configuration
learning_rate=0.1(default) — Slow adaptation, stable profiles. Good for production.learning_rate=0.3— Faster adaptation. Good for initial calibration of a new team.max_loops=1— Single pass, no refinement. Best for simple tasks.max_loops=2-3— Execute, evaluate, refine. Good for complex tasks that benefit from iterative improvement.
Error Handling
Inspecting Routing Decisions
Enableverbose=True and print_on=True to see detailed routing information:
Saving and Loading Handbooks
SkillHandbook is not exported from the top-level swarms package — import it directly from swarms.structs.skill_orchestra.