The post has been translated automatically. Original language: Russian
In September 2026, version 1.66.0 of the Mastra core was released, a TypeScript framework for building AI agents and workflows around them. The release is almost entirely about exploitation: the observability of agents, the deletion of accumulated data, and the typing of what previously had to be disassembled manually.
Traces can now be requested rather than viewed.
The main change is a set of trace filters: the span selection can be built by span name, model supplier, time characteristics, execution outcome, caller identity, and version origin. """ Portable" predicates have been added for string fields of top—level metadata with recursive Boolean expressions, meaning that conditions are added to a tree of "and", "or", "not", rather than a flat list of equalities.
"There is "at least one suitable" and "there is not a single suitable" predicates have been expanded separately, taking into account the version of the evaluator, the source of the assessment, the timestamp and the binding to the span. Predicates are declared portable between repositories — the release lists adapters for PostgreSQL, LibSQL, MS SQL, MySQL, Oracle, Aurora DSQL and Spanner.
Observability data is finally able to be deleted
In 1.66.0, batch deletion methods for reviews and ratings were added: they accept a list of identifiers and optional organization and resource limits, meaning that in a multi-tenant installation, you can delete strictly within a single tenant. Deletion is described as idempotent: a repeat call with the same IDs does not crash.
A similar logic came to datasets. Deleting an experiment now cascades related traces, spans, ratings, reviews, metrics, and logs; there is a separate call to clean up orphaned experiments and a method for renaming the experiment. Another method depersonalizes the contents of the dataset element, saving the version history.
Typing spans and fixing leaks
The main types of spans — agent run, model generation, model step, and inference—received typed input and output payloads. They are accompanied by an auxiliary function for safely narrowing the span type without casts and a set of functions that return a marked-up description of the input, output, and error. There are new types of spans for skill actions and agent signals, and handlers can declare their own types, names, and attributes.
Among the fixes, it is worth highlighting the leakage of open spans: when the agent's run was terminated by an error, interruption, or suspension, the spans remained unclosed. We also fixed the restart of stable runs by generalized recovery of workflows at startup and the loss of evaluation data when the evaluator results are returned. Streaming output has a timeout waiting for the first meaningful fragment, so as not to hang on a silent model.
What does this mean in practice?
The first thing when updating was the code that read the span payload as an arbitrary object. Typing is not cosmetic here: the places where the type was previously given in silence are now either compiled or honestly shown that they read the wrong field.
The second is filters and storage. Extended span sampling and estimates easily turn into heavy database queries, so it's worth looking at execution plans in advance for your trace volume and checking indexes, especially if span tables are already measured in tens of millions of rows.
The third is cascading deletion. Deleting an experiment now takes with it traces, spans, and logs, and this is the behavior that is checked on a copy of the data, not on a combat installation. Idempotence of deletion is convenient for repetitions, but it also forgives errors in parameters.
Finally, fixing the leak of open spans changes the monitoring picture. If you have dashboards or alerts for the proportion of incomplete spins, their thresholds will have to be recalculated: some of the "hung up" runs were not a problem of agents, but an artifact of accounting.
The draft text was prepared with the participation of AI, the facts were checked against the original source — the official notes for the release of the Mastra kernel version 1.66.0 on GitHub.
В сентябре 2026 года вышла версия 1.66.0 ядра Mastra — фреймворка на TypeScript для сборки ИИ-агентов и рабочих процессов вокруг них. Релиз почти целиком про эксплуатацию: наблюдаемость агентов, удаление накопленных данных и типизацию того, что раньше приходилось разбирать вручную.
Трассировки стало можно запрашивать, а не просматривать
Главное изменение — набор фильтров по трассировкам: выборку спанов можно строить по имени спана, поставщику модели, временным характеристикам, исходу выполнения, идентичности вызывающей стороны и происхождению версии. Добавлены переносимые предикаты по строковым полям метаданных верхнего уровня с рекурсивными булевыми выражениями — то есть условия складываются в дерево из «и», «или», «не», а не в плоский список равенств.
Отдельно расширены предикаты по оценкам: появились варианты «есть хотя бы один подходящий» и «нет ни одного подходящего», учитывающие версию оценщика, источник оценки, отметку времени и привязку к спану. Предикаты заявлены как переносимые между хранилищами — в релизе перечислены адаптеры для PostgreSQL, LibSQL, MS SQL, MySQL, Oracle, Aurora DSQL и Spanner.
Данные наблюдаемости наконец умеют удаляться
В 1.66.0 добавлены методы пакетного удаления отзывов и оценок: они принимают список идентификаторов и необязательные рамки по организации и ресурсу, то есть в многоарендной установке можно удалять строго в пределах одного арендатора. Удаление описано как идемпотентное: повторный вызов с теми же идентификаторами не падает.
Похожая логика пришла в датасеты. Удаление эксперимента теперь каскадно убирает связанные трассировки, спаны, оценки, отзывы, метрики и логи; появились отдельный вызов для зачистки осиротевших экспериментов и метод переименования эксперимента. Ещё один метод обезличивает содержимое элемента датасета, сохраняя историю версий.
Типизация спанов и починка утечки
Основные типы спанов — прогон агента, генерация модели, шаг модели и инференс — получили типизированные входные и выходные полезные нагрузки. К ним прилагается вспомогательная функция для безопасного сужения типа спана без приведений и набор функций, возвращающих размеченное описание входа, выхода и ошибки. Появились новые типы спанов для действий навыка и сигналов агента, а обработчики могут объявлять собственные типы, имена и атрибуты.
Среди исправлений стоит выделить утечку открытых спанов: при аварийном завершении прогона агента — ошибке, прерывании или приостановке — спаны оставались незакрытыми. Также поправлены перезапуск устойчивых прогонов обобщённым восстановлением рабочих процессов при старте и потеря данных оценивания при включённом возврате результатов оценщика. У потоковой выдачи появился тайм-аут ожидания первого содержательного фрагмента, чтобы не висеть на молчащей модели.
Что это значит на практике
Первое при обновлении — код, который читал полезную нагрузку спанов как произвольный объект. Типизация здесь не косметика: места, где раньше молча приводили тип, теперь либо компилируются, либо честно показывают, что читали не то поле.
Второе — фильтры и хранилище. Расширенная выборка по спанам и оценкам легко превращается в тяжёлые запросы к базе, поэтому стоит заранее посмотреть планы выполнения на своём объёме трассировок и проверить индексы, особенно если таблицы спанов уже измеряются десятками миллионов строк.
Третье — каскадное удаление. Удаление эксперимента теперь уносит с собой трассировки, спаны и логи, и это то поведение, которое проверяют на копии данных, а не на боевой инсталляции. Идемпотентность удаления удобна для повторов, но она же прощает ошибку в параметрах.
Наконец, исправление утечки открытых спанов меняет картину в мониторинге. Если у вас есть дашборды или алерты по доле незавершённых спанов, их пороги придётся пересчитать: часть «зависших» прогонов была не проблемой агентов, а артефактом учёта.
Черновик текста подготовлен с участием ИИ, факты сверены с первоисточником — официальные заметки к выпуску ядра Mastra версии 1.66.0 на GitHub.