Observability is opt-in per call and only covers Vercel AI SDK functions (
generateText, streamText, generateObject). Calls you make with a raw fetch, a provider’s own SDK, or any other HTTP client are not captured automatically.Turn it on
Setexperimental_telemetry: { isEnabled: true } on the AI SDK call. There is nothing to install for AI SDK 6, and nothing to configure on the Trigger.dev side.
/trigger/summarize.ts
generateText call appears as a span in the trace. streamText and generateObject work the same way: add the same experimental_telemetry flag to each call you want captured.
AI SDK 7 moved span emission out of A
ai core into the @ai-sdk/otel adapter. In a task, install @ai-sdk/otel and register it once yourself, for example at the top of your task file:/trigger/summarize.ts
chat.agent() run registers the adapter for you at run start, so chat agents need only the install. On AI SDK 5 and 6, ai core emits spans directly and no adapter is needed.What each span shows
Open an AI generation span in the run trace to get a dedicated inspector with three tabs:- Overview: model, provider, token usage, cost, and a preview of the input and output.
- Messages: the full message thread, including the system prompt and any tool results.
- Tools: the tool definitions passed to the model, plus every tool call the model made with its arguments.
Link a call to its prompt
If you manage prompts with AI Prompts, resolve the prompt and spreadtoAISDKTelemetry() into the call. This sets experimental_telemetry for you and links the span back to the exact prompt version that produced it.
/trigger/support.ts
toAISDKTelemetry() to tag the span with your own metadata:
metadata, so you can filter or group by them in TRQL, for example metadata['task.type'].
When you build an agent with
chat.agent() and store a prompt with chat.prompt.set(), chat.toStreamTextOptions() sets experimental_telemetry for you, so those generations are captured without adding the flag by hand. Without a stored prompt, set experimental_telemetry on the call yourself. See Prompts.Query usage across runs
Every captured generation is also written to thellm_metrics table, which you can query with TRQL. This lets you aggregate token usage, cost, and latency across many runs rather than inspecting one span at a time.
Cost and token usage by model:
query.execute(), or the REST API. llm_metrics also exposes ms_to_first_chunk and tokens_per_second for latency and throughput, plus finish_reason, request_model, cached_read_tokens, reasoning_tokens, and per-direction input_cost / output_cost for finer breakdowns.
Next steps
Prompts
Version prompts as code and link generations to the exact prompt version that produced them.
Query (TRQL)
Write custom queries against your runs, metrics, and LLM usage.

