Privacy and redaction
What a span contains by default (ids, timings, the model, token counts), how to record prompts and tool data, ask the person first, and why redaction always runs last.
Telemetry leaves your app: it is data about the person’s conversation, sent to a third party. So the defaults record as little as is useful, and every value passes through the redactor on its way out. Read this page before you turn on content recording, and before you ship to people who have to agree to analytics.
By default a span records ids (conversation, run, step, tool call), timings, the agent and the model, token counts, how each run and tool call ended, error codes, and the page’s URL with every query value redacted. It does not record the person’s messages, the model’s prompts and answers, tool inputs or tool results.
Example
Turn content on separately on each side. On the server, recordInputs records prompts and tool definitions on the
model spans, and recordOutputs the model’s answers; redact adds your own rules for this layer:
import { defineObservability } from "@webmcp-agents/telemetry/server";
export const observability = defineObservability({
// Off by default. On, every value is still redacted, last.
recordInputs: true,
recordOutputs: false,
// Your rules, merged over the defaults for this layer only.
redact: { keys: (defaults) => [...defaults, "loyaltyId"] },
});
In the browser, the same two options of observeAgents record tool inputs and results on execute_tool spans.
Options
recordInputs?boolean
Record prompts and tool definitions on model spans, redacted. The handler's own telemetry.recordInputs wins.
booleanfalserecordOutputs?boolean
Record the model's output on model spans, redacted. The handler's own telemetry.recordOutputs wins.
booleanfalseredact?false | RedactOptions | Redactor
Redaction of everything exported, server spans and relayed browser spans. false only for local debugging.
false | RedactOptions | Redactorthe process's redactorEvery other option is on defineObservability.
Your backend
Nothing differs: what you turn on is recorded, redacted, and exported as is.
New Relic keeps attribute values up to 4095 characters: with recordInputs or recordOutputs on, long prompts and
answers are cut there.
Through Sentry’s provider, the layer redacts the attributes it sets before each span exists. Sentry’s own
instrumentations, such as its vercelAIIntegration (on by default when tracing is on, with its own recordInputs
and recordOutputs), are Sentry’s to configure. Source:
Vercel AI integration.
Ask the person first
Where you need consent for analytics, gate the page’s spans on it. enabled is read when each run starts: a run the
person did not agree to produces no span, makes no request, and does not even load the span builder.
import { ObserveAgents } from "@webmcp-agents/telemetry/react";
import { consent } from "@/lib/consent";
// Render it once, inside <WebAgentsProvider>. Each run the person
// agreed to becomes spans, posted to /api/telemetry.
export function ObserveRuns() {
return <ObserveAgents enabled={() => consent.analytics} />;
}
The server’s spans do not know about the page’s consent. If the model steps must not be exported either, decide it on
the server with a custom sampler that reads a consent cookie, or keep the layer off with
WEB_AGENTS_OTEL_ENABLED=false.
Notes
Redaction runs last, always
Every attribute is redacted after your span processors, after metadataMapping, and before the span filter and
the exporters, with recording on or off. The rules are the page’s on the page and the process’s on the server
(Redaction); redact replaces them for this layer. The relay redacts what a page sends a
second time, since it cannot trust the browser. Your own
custom events and spans pass through the same redaction and span filter.
Through an app's own provider
Through Sentry’s or @vercel/otel’s provider, the layer cannot own the pipeline. It then redacts every attribute
it sets before the span exists. What the app’s own processors or instrumentations add is theirs to handle.
The app's own AI SDK integrations
The chat handler’s own telemetry.recordInputs and recordOutputs, when set, win over the layer’s. An AI SDK
integration your app registered itself (registerTelemetry) still runs on each step but never records content:
it cannot redact, so only this layer’s spans carry prompts and answers. When it is the app’s own @ai-sdk/otel
one, recording into the same provider, it is left out of the chat’s calls
(appIntegrations), so each step is one span, redacted.