Mastra 于 2026-09-24 发布 @mastra/core 1.71.0:agent.stream 默认在单步工具参数齐备后立即执行(eagerToolExecution),多工具步骤可省下数秒空闲;新增 planTraceAggregate、观测存储 getFeatures discovery/feedback 声明,以及数据集 schema 的 RE2 线性匹配以防 DoS。
核心要点速览 (Key Takeaways)
- ✓默认行为:`agent.stream` 在工具参数流式齐备后立即执行,可用 `eagerToolExecution: false` 恢复旧调度(#25005)
- ✓观测:`getFeatures()` 可声明 entity/service/environment/tag/metric discovery 与 feedback;内存 store 已声明 metrics/logs/discovery(#25008、#25020)
- ✓聚合查询:新增 `planTraceAggregate()`,校验后输出 TrustedTraceAggregatePlan;时间窗最长 **365** 天,`interval` 最多 **1000** bucket,`limit×buckets` ≤ **10,000** 行(#24868)
- ✓安全:数据集 input/ground-truth 的 `pattern`/`patternProperties` 改走 RE2,消除灾难性回溯;不支持 lookaround/反向引用时抛 `DATASET_SCHEMA_PATTERN_UNSUPPORTED`(#25044)
- ✓升级:`npm i @mastra/[email protected]`;对照 CHANGELOG 1.71.0
相关资源与官方项目出处
免代理直达深度技术解析与实战评估
核心背景与行业痛点
TypeScript Agent 框架在多工具同一步里常见「模型还在吐字、工具空转等待」:参数其实早已齐备,却要等到整步流结束才调度,白白丢掉数秒延迟。观测面则缺少统一的能力发现协议,Studio/自定义存储容易对不支持的 API 盲目探测。Mastra 在 @mastra/core 1.71.0 把调度与观测声明一并推进一步。
架构亮点与底层机制
[agent.stream](https://mastra.ai/reference/streaming/agents/stream) 默认开启 eager tool execution:单个 tool-call 参数完整即启动,不必等模型结束整步流;需审批、suspend schema、provider/client 侧或 background 工具,以及 called 并发策略与流后 output processor,仍会等模型结束。可用 eagerToolExecution: false 恢复旧行为。观测存储通过 getFeatures() 声明 discovery(entity-type/name、service、environment、tag、metric)与 feedback,内存 store 已声明 metrics/logs/discovery。新增 [planTraceAggregate()](https://github.com/mastra-ai/mastra/pull/24868):在 parseTraceAggregateRequest 之后产出后端可直接执行的 TrustedTraceAggregatePlan。
权威 Benchmark 与实测跑分对比
官方未给出独立 coding/SWE 跑分;可核对约束来自 changelog:时间范围最长 365 天、interval 至多 1000 个 UTC 对齐 bucket、limit × buckets ≤ 10,000 行。相对 1.70.0 的公开 compare 约 57 个 commits(含 connect channels、auth 适配与 evals 等周边包)。数据集正则改走 RE2(#25044)属于安全硬化,非吞吐 benchmark。
开发者实战落地与开箱指南
npm i @mastra/[email protected],阅读 packages/core CHANGELOG。eagerToolExecution: false 的首个 tool 启动时点。getFeatures() 只声明真实实现的能力,避免 Studio 误调。
讨论与评论
0登录后即可参与深度讨论
与广大 AI 开发者、工程师交流评测心得与前沿洞察