Mastra published @mastra/[email protected] on 2026-09-24 with `ModelSelectionProcessor` for classifier-backed per-request model routing (#24865), `closeOnSuspend` on durable agent streams so AG-UI-style loops can finish on tool suspend, plus `createClassifierScorer()`, optional tool `title`s, and trace aggregate dimension/measure helpers with tag predicates. Docs warn routing is not always cheaper because models do not share prompt caches.

Key Takeaways

  • ✓`ModelSelectionProcessor` routes simple vs hard requests (#24865); `scope: 'first-step'` optional
  • ✓Durable `closeOnSuspend: true` ends streams at tool suspend (#24894)
  • ✓`createClassifierScorer()` maps Classifier questions to 0–1 scores (#24792)
  • ✓Trace aggregate descriptors + tag predicates for advanced queries
  • ✓Upgrade: `npm i @mastra/[email protected]`; see CHANGELOG + processors docs
🔬

In-Depth Technical Analysis

Background

One-size-fits-all frontier models waste spend on trivial turns. Mastra 1.70.0 packages classifier-backed model routing as ModelSelectionProcessor and fixes durable stream hang-on-suspend for UI integrations.

Architecture

ModelSelectionProcessor builds or reuses a Classifier to pick per-request models; failures fall back to the agent default/fallbacks. closeOnSuspend: true closes durable streams at tool suspend. Also: tool display title, createClassifierScorer(), trace aggregate helpers, tag predicates, and stricter client-echo history filtering (retainFullInput opt-out).

Benchmarks

No public cost/quality board—Mastra warns prompt caches are not shared across models; measure on your traffic. Verify via PRs #24865 and #24894 plus the 1.70.0 CHANGELOG.

Get started

npm i @mastra/[email protected]; read the core CHANGELOG and https://mastra.ai/docs/agents/processors.

⚡
Evaluating this AI coding model or solution?
Check live multi-benchmark rankings or compare plan costs & promo credits.
ADSponsored