Mastra Adds TTFC and TTFT Latency Metrics for AI Agents
Mastra Blog says the platform now records time to first chunk (TTFC) and time to first token (TTFT) across every span from model calls to complete agent runs. Users can filter and sort traces, spans, and threads, and query the fields through Mastra CLI, the platform and Studio, the Client SDK, and observability endpoints. The metrics also support self-hosted projects using DuckDB, PostgreSQL, or ClickHouse.
Mastra Blog says separating user-perceived first-response latency from model startup latency gives AI-agent developers more specific visibility into slow spans and supports diagnosis with tools such as Mastra Code.
You can now track latency metrics for every agent and model call in Mastra platform and Studio. Filter and sort traces, spans, and threads by TTFC (time to first chunk) and TTFT (time to first token) to see where your agents are slow. Or hand off to your coding agent to find and fix issues.
We've spent years optimizing websites with metrics like Time to First Byte and First Contentful Paint, and agents deserve the same attention. TTFC tells you how long a user waits before seeing anything. TTFT tells you how long the model takes to start responding. Together, they show you where your agents are slow and give you a meaningful metric to improve.
Your browser does not support the video tag.Mastra platform's Traces view with the time to first chunk and time to first token columns turned on, then Mastra Code querying the same data, tracing the gap to a slow input processor, and suggesting three fixes.
Previously, you could use durationMs to see how long a run took, but not how long a user waited for the first response, or whether that wait came from the model or your own code. Mastra now records both metrics on every span, from the model call up to the agent run.
#Mastra#Mastra Studio#Mastra Code#Mastra CLI#Mastra Client SDK#DuckDB#PostgreSQL#ClickHouse