Skip to main content
Mastra is an agentic framework that simplifies building complex AI applications with multi-agent workflows, tool integrations, and memory management.

Install

Configure Environment

First, start Phoenix:
Run Phoenix on your own infrastructure, backed by PostgreSQL so traces persist beyond a single process. This is the option to reach for once Phoenix is shared across a team or environment.The self-hosting guide covers Kubernetes, Helm, Railway, AWS CloudFormation, Google Cloud Run, Azure, and Render, plus authentication and configuration.
Phoenix serves its UI and OTLP HTTP on port 6006, and OTLP gRPC on port 4317. For a local instance that’s http://localhost:6006 — leave it running while you work.
Then create a .env file that points Mastra at it:
PHOENIX_COLLECTOR_ENDPOINT is the exact URL traces are sent to. ArizeExporter POSTs to it verbatim, so it carries the OTLP /v1/traces path and the setup below passes it straight through.

Setup

Initialize the Arize exporter inside your Mastra project:
The /v1/traces path matters. ArizeExporter — unlike Phoenix’s own SDKs — does not append the OTLP path itself: handed a bare server URL such as http://localhost:6006, every span goes to the wrong path, Mastra’s batching exporter swallows the delivery error, and traces simply never appear. Phoenix’s own tools accept the suffixed value, stripping the path when they need a base URL (see environment variables).One exception to keep in mind: arize-phoenix-otel (Python) defaults to OTLP/gRPC for self-hosted servers and does not strip the path, so if a Python service reads this same variable give it the bare server URL instead.

Create Agents and Tools

From here you can use Mastra as normal. Create agents with tools and run them:

Running Your Application

To test your application with Phoenix tracing:
This will:
  1. Initialize the tracing SDK with your observability configuration
  2. Start the Mastra playground at http://localhost:4111
  3. Enable trace export to Phoenix at http://localhost:6006
Interact with your agents:
  • Via Playground: Navigate to http://localhost:4111/playground to chat with agents
  • Via API: Make requests to the generated API endpoints
  • Programmatically: Create test scripts that run within the Mastra dev environment

Observe

Now that you have tracing setup, all agent runs, tool calls, and model interactions will be streamed to your running Phoenix for observability and evaluation.
Mastra traces in Phoenix

Resources