Mastra
Learn how to integrate Mastra, a TypeScript agent framework, with LangWatch.
Observability for Mastra With LangWatch
This guide shows you how to integrate Mastra with LangWatch for observability and tracing. By following these steps, you’ll be able to monitor and debug your Mastra agents in the LangWatch dashboard.
Integration
Create a Mastra project
Create a Mastra project using the Mastra CLI:
Move into the project directory:
For more information, view Mastra installation instructions here
Set up LangWatch project
Create a project in LangWatch and get your API keys from the project settings page.
Add environment variables
Create or update your .env
file with the following variables:
Install the langwatch package
Add the langwatch
package to your project:
Add LangWatch to your Mastra instance
Add LangWatch to your Mastra instance via the telemetry exporter.
Run mastra dev server
Start the Mastra development server:
Head over to the developer playground with the provided URL and start chatting with your agent.
View traces in LangWatch
Visit your LangWatch dashboard to explore detailed insights into your agent interactions. Monitor and analyze every aspect of your AI conversations, from prompt engineering to response quality, helping you optimize your AI applications.