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

Call await agnost.shutdown() once when the application exits, not after each request.

Manual setup: OpenTelemetry

The Vercel AI SDK emits ai.* 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 the spanProcessors array when constructing the existing NodeSDK or NodeTracerProvider.
No OTel yet? Boot a NodeSDK at startup (e.g. Next.js instrumentation.ts):

3. Pass userId / sessionId per call

AI SDK 7 excludes runtime context from telemetry unless each safe field is listed in 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 one generateText 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.isEnabled is true and the grouping fields appear in includeRuntimeContext.
  • Confirm the OTLP exporter is initialized before the first AI SDK call.
  • Confirm X-Agnost-Org-ID is 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.