Integration Overview
Pass the Asymptote tracer into AI SDK telemetry so model calls and tool loops stay in the same trace.Overview
AI SDK exposes OpenTelemetry hooks throughexperimental_telemetry. Asymptote Observe is OpenTelemetry-first, so you can trace generateText, streamText, tool loops, and custom orchestration by passing Observe.getTracer() to each AI SDK call you want captured.
This page covers Node.js usage. For framework placement and serverless flushing, see Next.js and serverless.
What Asymptote Captures
- AI SDK spans emitted when
experimental_telemetry.isEnabledistrue. - Model call spans for supported
generate*andstream*operations. - Tool call spans emitted by AI SDK telemetry.
- Provider and model metadata where AI SDK and provider adapters emit it.
- Parent spans you add with
Observe.observe()for route or workflow grouping.
Prerequisites
- Node.js 20 or newer.
@asymptote/sdkinstalled.aiand an AI SDK model provider package installed.ASYMPTOTE_API_KEYset for Asymptote Managed hosted Observe, orOTEL_EXPORTER_OTLP_ENDPOINTset for customer-managed OTLP export. To get an Asymptote Managed API key, reach out for a demo.
Install the SDK and Vercel AI SDK
Set Asymptote Managed and OpenAI environment variables
Getting Started
InitializeObserve once at application startup, then pass the tracer to AI SDK calls.
Trace an AI SDK generateText call
experimental_telemetry.
Reuse The Tracer
UseObserve.getTracer() anywhere AI SDK accepts an OpenTelemetry tracer. This lets generated spans share the same exporter, resource attributes, and Beacon compatibility path as the rest of your application.
Reuse the Observe tracer
Trace A Tool Loop
Pass the tracer into tool-calling AI SDK flows as well.Trace an AI SDK tool loop
Group Calls With Custom Steps
Wrap orchestration code around AI SDK calls when you need spans for planning, policy checks, retrieval, or handoffs that are not covered by model telemetry.Group AI SDK calls with a parent span
Observe.flush() before returning if the invocation may terminate immediately after the model call.
Troubleshooting
- Confirm
ASYMPTOTE_API_KEYorOTEL_EXPORTER_OTLP_ENDPOINTis set in the runtime process. - Make sure every AI SDK call you want traced has
experimental_telemetry.isEnabled=true. - Pass
tracer: Observe.getTracer()on each traced AI SDK call. - In short-lived scripts or jobs, call
Observe.flush()before exit. - In Next.js, initialize from
instrumentation.tsin the Node.js runtime.
What’s Next
Next.js And Serverless
Place initialization correctly in Next.js and flush traces in short-lived runtimes.
Observe
Group AI SDK calls under custom parent spans.

