CMU Open Source Motus: Multi-Model Orchestration Halves Agent Costs

The Carnegie Mellon team open-sourced the Agent framework **Motus**, which automatically routes tasks to the optimal model. It achieved **79% accuracy** on SWE-bench, at **less than half the cost** of using Claude Opus alone.
CMU Open-Sources Motus: Multi-Model Orchestration Cuts Agent Cost by Half, SWE-bench Hits 79%
Lithos AI, founded by Dimitrios Skarlatos and Zhihao Jia, professors in the Computer Science Department at Carnegie Mellon University, has just open-sourced the Agent service framework Motus under the Apache 2.0 license. The problem this framework addresses is quite practical: current Agent deployments are static in configuration—prompting, model selection, and context strategies are all hardcoded. Motus, on the other hand, learns from every run and automatically routes different subtasks to the most suitable model.
The data is straightforward: on SWE-bench Verified, Motus’ multi-model orchestration achieved 79% accuracy, outperforming Claude Opus 4.6 at 75.8% and GPT-5.3-Codex at 72.6%, while costing less than half of using Opus alone. On Terminal-Bench 2.0, accuracy rose from 64% to 80.1%, again at half the cost.

Why Dynamic Routing Is Needed
Current mainstream Agent frameworks—be it LangChain or AutoGPT—essentially run with a fixed configuration after deployment. If you choose Claude Opus, every step uses Opus; if you set a 32K context window, every call consumes that many tokens. This static configuration is fine during development, but in production, problems show up:
- Using Opus for simple file-read tasks is a waste; GPT-4o-mini would suffice
- Complex architectural design benefits from Opus’s reasoning ability, but your budget is already consumed by trivial tasks
- Some steps could be executed in parallel, but the framework runs them sequentially, increasing latency
Motus takes a different approach: don’t hardcode all decisions before deployment—let the system learn from real runs. Every time an Agent executes a task, Motus records which model performs best on which subtask, how much it costs, what latency it incurs, and uses these data to continuously optimize routing strategies.
The team background is notable. Skarlatos and Jia are CMU computer science faculty members, with team members from CMU and Stanford, and production infrastructure experience from AWS, Google, Meta, and NVIDIA. This isn’t an academic demo—it’s built to solve real production problems.
Core Mechanism: Learning from Trajectories
Motus centers on a trajectory analysis system. When an Agent performs a programming task—for example, fixing a GitHub issue—Motus breaks down the process into multiple subtasks:
- Understanding the issue description
- Locating relevant code files
- Analyzing the existing implementation
- Generating a fix plan
- Writing test cases
- Verifying the fix
Each subtask records:
- The model and parameter configuration used
- Whether the task succeeded
- Tokens consumed and cost
- Execution latency
- Output quality score
The system may find that for tasks like understanding issues and locating files, GPT-4o performs well enough, making Opus unnecessary. But for generating fix plans, Opus clearly has a higher success rate. Motus learns this pattern and will automatically choose the optimal model next time it encounters a similar task.
This approach is fundamentally different from today’s multi-Agent frameworks like CrewAI or MetaGPT, which advocate a “role-playing” mode—different Agents act as product manager, architect, or testing engineer, passing documents like departments on a production line. Yet, according to documentation from Anthropic, OpenAI, and Google, none actually operate that way.
Anthropic’s method aligns more closely with Motus: treating each session as a “shift engineer” with a progress.txt file as the handover log. The first session, handled by a dedicated Initializer Agent, sets up the environment and writes operational notes; subsequent sessions read them and continue the work. Multi-Agent setups follow an orchestrator–worker pattern, where a main Agent decomposes tasks, multiple sub-Agents explore in parallel, and results are aggregated—not executed sequentially.
Dynamic Optimization of Context Management
Another crucial optimization in Motus is context window management. Most existing frameworks either keep the full conversation history or use a fixed sliding window strategy. Full retention is costly, while fixed windows risk losing key info.
Motus dynamically adjusts its strategy based on workload. For long-term projects needing frequent references to early decisions, it retains more context; for shorter, independent tasks, it keeps only recent dialogues. The system learns this from trajectory data: it identifies what historical information is actually reused and what merely wastes tokens.
For instance, in SWE-bench tasks, the Agent must first grasp codebase structure, then locate a bug, and finally generate a fix. Motus learns that codebase structure info gets reused throughout, so it keeps that in context. On the other hand, failed exploratory attempts are discarded, freeing token space for later steps.
Parallel Execution Detection
Latency optimization is another Motus strength. Traditional frameworks execute serially—one step completes before the next begins—but many tasks can be parallelized: e.g., analyzing multiple potentially relevant files or generating multiple candidate solutions simultaneously.
Motus automatically detects which steps are independent and thus parallelizable. This detection isn’t based on manual labeling—it’s inferred from trajectory data: if two steps historically never reference each other’s outputs, they’re likely parallelizable.
In Terminal-Bench 2.0, this significantly reduced latency. Terminal-Bench simulates command-line tasks requiring the Agent to interpret user intent, plan command sequences, execute, and validate results. Motus found that multiple candidate plans could be generated in parallel, screened quickly by a lightweight model, and only the best passed to a larger model for final verification—maintaining quality while cutting end-to-end delay.
Real-World Impact: Beyond Benchmark Numbers
While the SWE-bench and Terminal-Bench numbers impress, Motus’s performance in practical applications stands out even more. The Lithos AI team shared several case studies:
Case 1: Large-Scale Code Refactoring
A client needed to migrate a legacy system from Python 2 to 3, spanning hundreds of files. Using a single model meant choosing between cheap-but-error-prone or expensive-but-accurate. Motus used this strategy:
- GPT-4o for initial scanning and identifying files/patterns needing changes
- GPT-4o-mini for simple syntactic updates (e.g.,
printstatement to function call) - Claude Opus for complex logic changes (e.g., string encoding handling)
- GPT-4o for global consistency checking
The result: similar accuracy to using Opus alone, but cost reduced to 40%.
Case 2: API Documentation Generation
Another client needed internal-service API documentation. Understanding code logic required strong reasoning, but documentation writing was mechanical. Motus’s routing plan:
- Claude Opus analyzes each API endpoint’s functionality, parameters, and return values
- GPT-4o generates standard-format documentation text
- GPT-4o-mini performs format and link checks
This combination ensured quality while keeping costs reasonable.
Integration with OpenAI Hub
Motus’ multi-model routing pairs naturally with API aggregation platforms like OpenAI Hub. The Hub provides unified access to multiple models, while Motus decides when to use which one.
If you’re using OpenAI Hub, integration is straightforward. Motus supports standard OpenAI API format—just specify the base_url and available models:
from motus import Agent, ModelRouter
# Configure OpenAI Hub as model provider
router = ModelRouter(
base_url="https://api.openai-hub.com/v1",
api_key="your-openai-hub-key",
available_models=[
"gpt-4o",
"gpt-4o-mini",
"claude-opus-4-6",
"claude-sonnet-4",
"deepseek-chat"
]
)
# Create Agent with Motus auto-routing
agent = Agent(
router=router,
task_type="code_generation",
optimize_for="cost" # or "latency" or "quality"
)
# Run task — Motus auto-routes subtasks
result = agent.run(
"Fix the bug in user_service.py where login fails for users with special characters in username"
)
Motus will dynamically select models during execution—for example, GPT-4o for understanding the issue, Claude Sonnet for locating code, Claude Opus for producing the fix, and GPT-4o-mini for generating test cases—all automatically based on learned trajectory data.
You can also add constraints for finer control:
router = ModelRouter(
base_url="https://api.openai-hub.com/v1",
api_key="your-openai-hub-key",
available_models=["gpt-4o", "claude-opus-4-6", "deepseek-chat"],
constraints={
"max_cost_per_task": 0.50, # Max cost per task $0.50
"max_latency": 30.0, # Max latency 30 seconds
"min_quality_score": 0.85 # Minimum quality score 0.85
}
)
Motus will optimize routing while respecting constraints. With tight budgets, it’ll prefer DeepSeek and GPT-4o-mini; when latency-critical, it’ll favor faster models and higher parallelism.
What Open-Source Means
Motus’s Apache 2.0 license means you can freely use, modify, and commercialize it without open-sourcing your changes. By contrast, many academic projects use GPL or restrictive licenses, which pose legal risks for commercial use.
Open-sourcing also brings transparency: you can inspect how routing decisions are made—crucial in production environments where you need to understand and trace decisions if something goes wrong. Motus provides detailed decision logs and visualization tools showing each routing decision’s basis, alternatives, expected cost, and actual outcome.
From a code-quality perspective, Motus is highly engineered: its core routing logic is only a few thousand lines of Python, with minimal dependencies and no heavy frameworks, making it easy to integrate and customize.
For example, you might want to add custom evaluation metrics or use your own routing strategy for specific tasks. Motus’s modular design allows this; you can replace the default trajectory analyzer or router:
from motus import Agent, TrajectoryAnalyzer, ModelRouter
class CustomAnalyzer(TrajectoryAnalyzer):
def analyze(self, trajectory):
# Your custom analysis logic
# e.g., add domain-specific quality metrics
pass
class CustomRouter(ModelRouter):
def route(self, task, context):
# Your custom routing logic
# e.g., prefer internally deployed models
pass
agent = Agent(
analyzer=CustomAnalyzer(),
router=CustomRouter()
)
Limitations and Future Directions
Currently, Motus is most optimized for code-related tasks, performing best on SWE-bench and Terminal-Bench. For other domains—long-form writing, multimodal generation—routing strategies need retraining. The team notes on GitHub that they’re collecting trajectory data from other domains to support more task types.
Another limitation is the cold start problem. Motus learns from live usage, meaning routing isn’t optimal at the beginning. The team provides pre-trained strategies based on SWE-bench and similar datasets, but if your task distribution differs significantly, expect some learning time.
Cost estimates also aren’t perfect. Motus predicts per-route costs from history, but actual costs vary with input/output length, model load, etc. The team suggests setting production cost caps and alerts to avoid overruns.
From a broader perspective, Motus reflects an important direction for Agent frameworks: shifting from static configuration to dynamic optimization. Most frameworks today are still “Lego-style,” where developers manually design workflows, select models, and tune parameters. Motus’s approach learns from data, freeing developers from tedious tuning.
This parallels the evolution of large language models themselves. Early models required carefully crafted prompts; now their instruction-following ability is strong enough that plain requests often suffice. Agent frameworks are undergoing a similar shift—from manual orchestration to automated optimization.
Practical Implications for Developers
If you’re building LLM-based applications, Motus is worth trying—especially in these scenarios:
- Cost-sensitive production environments: balancing quality and cost, avoiding overusing expensive models
- Complex multi-step tasks: decomposable tasks where subtasks vary in model needs
- Continuous optimization required: long-running applications that benefit from self-learning improvements
For simple one-shot cases—like chatbots or text classification—Motus may be overkill. But for code generation, automated testing, or document processing, Motus’s multi-model orchestration provides tangible benefits.
Given the team’s background and open-source approach, Motus is unlikely to be a short-lived project. CMU academic rigor ensures technical depth, industry experience ensures engineering quality, and the Apache 2.0 license ensures commercial friendliness. This project is one to watch.
References
- CMU professors open-source Agent framework Motus – Discussion on Linux.do – Design concepts and performance data
- Motus GitHub Repository – Source code and technical documentation



