Skip to main content

Choose a setup method

Start with one method for a call path. Combining SDK tracking with framework OpenTelemetry on the same call can create duplicate interactions.
Recommended. Choose this path when you want your coding agent to inspect the project, select a supported transport, make the smallest instrumentation change, send a test event, and verify that it reached Agnost AI.
Install the skill once in your coding-agent environment:
Run the framework-specific prompt below from the application root. Review the resulting diff before deploying it.

Manual setup: Agnost AI SDK

Manual setup: OpenTelemetry

Mastra ships an OtelExporter that targets any OTLP endpoint. Wire it into your Mastra instance, then pass userId / conversationId per call.

1. Install

Already have @mastra/observability and @mastra/otel-exporter? Skip. No Observability set up yet?

2. Wire the OtelExporter pointing at Agnost AI

Already have Mastra Observability? Append Agnost AI to the existing exporters array: Mastra fans traces out to every exporter in the list:
No Observability yet? Full setup:

3. Pass userId / conversationId per call

Reserved keys userId, conversationId, and threadId in tracingOptions.metadata are read by Agnost AI for user / session grouping.

What appears in Agnost AI

  • Conversations grouped by conversationId or threadId.
  • User-level analytics grouped by userId.
  • Events for spans exported by Mastra.

Verify

Run one agent.generate call, then open Events in Agnost AI. Confirm the span has your userId and conversationId.

Troubleshooting

  • Confirm the OtelExporter is included in the active Mastra observability config.
  • Confirm protocol: 'http/protobuf' and /v1/traces are used.
  • Confirm metadata keys are spelled userId, conversationId, or threadId.

References

Next steps

  • Conversations: review the complete Mastra interaction.
  • Events: inspect agent and model activity.
  • Intents: organize production conversations by what users wanted.