Player not loading? Watch on YouTube
Alex Booker and Tony Kovanen explain how to build an AI agent with Mastra, an open source TypeScript framework. A weather example introduces model selection, tools and system instructions, followed by a local development server and Studio interface for testing. The demonstrated inference calls OpenAI's API; running the development server locally does not make this an offline setup.
The talk distinguishes autonomous tool selection from workflows that combine model calls with deterministic code. Traces expose model requests and tool activity, while scorers check behavior such as whether the weather agent fetched fresh data. Tony then connects a Next.js frontend through Mastra's TypeScript client, showing streamed responses, tool approval and a workflow that pauses for user input. A client-side tool changes the chat's colors based on the weather.
A trip-planning simulation explains observational memory. Its observer rewrites message history after a configured threshold, reducing one example from 3.1K tokens to 480. The speakers describe reflections that further condense observations and an ordering strategy intended to support prompt caching. These are demonstration results, not a guarantee of complete recall.
The closing Q&A covers security and self-hosted deployment. The speakers say Mastra's cloud service is optional and that developers can connect a local LLM. They recommend narrower agent permissions, guardrails and human review for critical actions.