npm.io
0.1.4 • Published 2d ago

@bryel/vercel

Licence
MIT
Version
0.1.4
Deps
3
Size
23 kB
Vulns
0
Weekly
0

@bryel/vercel

bryel tracing for the Vercel AI SDK. One span processor + a per-call flag — no wrapping of your model calls.

npm i @bryel/vercel @vercel/otel

1. Register the processor once — instrumentation.ts

import { registerOTel } from "@vercel/otel";
import { bryelVercelProcessor } from "@bryel/vercel";

export function register() {
  registerOTel({
    serviceName: "my-app",
    spanProcessors: [bryelVercelProcessor({ apiKey: process.env.BRYEL_KEY! })],
  });
}

2. Flip telemetry per call

const result = streamText({
  model: openai("gpt-4o"),
  prompt,
  experimental_telemetry: {
    isEnabled: true,
    metadata: { sessionId, userId }, // groups a conversation in bryel
  },
});

The AI SDK's OpenTelemetry spans are mapped to OpenInference and shipped to bryel — models, tokens, cost, tool calls, the whole multi-step trajectory. To attach user feedback to a turn, mint a messageId, pass it in metadata, and use @bryel/feedback.

A streamed span finalizes only once the stream is fully consumed — always drain it.

MIT bryel