@webmcp-agents/telemetry
@webmcp-agents/telemetry sends agent runs to any OpenTelemetry backend. Each API has one page, in Observability: this is the index.
@webmcp-agents/telemetry sends what your agents do to any backend that speaks OpenTelemetry: every model step from
the chat handler, and each run and tool call from the page, through your own relay. Each API is documented once, on
its page in Observability, where the options come from the source and the backend you
picked carries from page to page. Start with Installation.
Experimental: new in 0.5.0. Span and attribute names follow the OpenTelemetry GenAI conventions, which are not stable yet.
pnpm add @webmcp-agents/telemetry @opentelemetry/api @opentelemetry/sdk-trace @ai-sdk/otel
The three OpenTelemetry packages are optional peers, loaded on the first request: without them the layer is off and says which to install.
@webmcp-agents/telemetry/server
defineObservability: the layer the chat handler takes asobservability.otlp: one OTLP destination in code.observability.relay: the/api/telemetryhandler for the page’s spans.observability.event,observability.span: your own events and spans in a chat request’s trace.resolveTarget: what the environment resolves to, without sending anything.
@webmcp-agents/telemetry
observeAgents: the page’s runs and tool calls as spans.recordAgentEvent,withAgentSpan: your own events and spans in a run’s trace.consoleExporter: print spans instead of sending them.
@webmcp-agents/telemetry/react
<ObserveAgents>:observeAgentsas a component.
Both entries
- Span names and attributes: every name as a constant.
- The OpenTelemetry types: the shapes the options take.
See also
createChatHandler: the handler’s owntelemetryoption and theChatObservabilityinterface this package implementsonAgentRun: the run events the browser spans are built fromconfigureRedaction: the redactor every span passes through- Testing spans:
memoryExporter,toHaveSpan,toBeOneTrace