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: Agnost AI skill
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.
Manual setup: Agnost AI SDK
await agnost.shutdown() once when the application exits, not after each request.
Manual setup: OpenTelemetry
The Vercel AI SDK emitsai.* and GenAI semantic-convention spans through its
OpenTelemetry integration. Wire an OTel exporter pointing at Agnost AI, register
the integration once, then explicitly include userId / sessionId from the
call’s runtime context.
1. Install
Already have@opentelemetry/sdk-node (or another OTel SDK) and an OTLP exporter? Install only @ai-sdk/otel if it is missing.
No OTel set up yet?
2. Wire the OTel exporter pointing at Agnost AI
Already exporting OTel? Include the Agnost processor in thespanProcessors
array when constructing the existing NodeSDK or NodeTracerProvider.
instrumentation.ts):
3. Pass userId / sessionId per call
includeRuntimeContext. Keep secrets and sensitive request context
out of that allowlist.
What appears in Agnost AI
- Conversations grouped by
sessionId. - User-level analytics grouped by
userId. - Events for every generated span.
Verify
Run onegenerateText call, then open Events in Agnost AI. If the event is present, check Conversations for session grouping.
Troubleshooting
- Confirm
registerTelemetry(new OpenTelemetry(...))runs once at startup. - Confirm
telemetry.isEnabledistrueand the grouping fields appear inincludeRuntimeContext. - Confirm the OTLP exporter is initialized before the first AI SDK call.
- Confirm
X-Agnost-Org-IDis set on the exporter.
References
Next steps
- Conversations: review the complete Vercel AI SDK interaction.
- Events: inspect generated model and tool spans.
- Intents: organize production conversations by what users wanted.