Mastra
Instrument a Mastra agent so its model calls, tool calls, and agent steps appear in the Astro AI dashboard. The @astropods/adapter-mastra package — the same one that connects a Mastra agent to Astro AI messaging — auto-wires OpenTelemetry tracing when OTEL_EXPORTER_OTLP_ENDPOINT is set on the deployed container.
Before you start
- A deployable Astro AI agent project built with Mastra.
- Astro AI sets
OTEL_EXPORTER_OTLP_ENDPOINTonly on deployed containers, so traces appear once the agent runs on the platform — not during local development.
Set up
Serve the agent
Calling serve() registers the agent with the messaging service and configures observability in the same step. The agent’s name is sent as the OpenTelemetry service.name, and the platform-injected OTEL_EXPORTER_OTLP_ENDPOINT is used for export.
If your project constructs its own Mastra instance (for example, for multi-agent workflows), serve() registers Astro AI’s observability alongside any existing observability instances on that Mastra.
Traces capture each turn’s model calls, tool calls, and agent steps, attributed to the deployed agent.
Troubleshooting
If nothing shows up:
- Confirm
OTEL_EXPORTER_OTLP_ENDPOINTis present in the deployed container. - Check the agent container logs for OpenTelemetry export errors.