Monitor, evaluate and debug your AI SDK application with Patronus
Patronus AI provides an end-to-end system to evaluate, monitor and improve performance of an LLM system, enabling developers to ship AI products safely and confidently. Learn more here.
When you build with the AI SDK, you can stream OpenTelemetry (OTEL) traces straight into Patronus and pair every generation with rich automatic evaluations.
Patronus exposes a fully‑managed OTEL endpoint. Configure an OTLP exporter to point at it, pass your API key, and you’re done—Patronus will automatically convert LLM spans into prompt/response records you can explore and evaluate.
Once you've installed @ai-sdk/otel and added registerTelemetry to your instrumentation.ts, telemetry is captured automatically. Pass telemetry to attach metadata:
import { generateText } from 'ai';import { openai } from '@ai-sdk/openai';const result = await generateText({ model: openai('gpt-6-astra'), prompt: 'Write a haiku about spring.', telemetry: { functionId: 'spring-haiku', // span name metadata: { userId: 'user-123', // custom attrs surface in Patronus UI }, },});
Every attribute inside metadata becomes an OTEL attribute and is indexed by Patronus for filtering.
Result: a single trace containing the root HTTP request, the LLM generation span, and your evaluation span—all visible in Patronus with the hallucination score attached.