---
slug: reference/telemetry
description: "@webmcp-agents/telemetry sends agent runs to any OpenTelemetry backend. Each API has one page, in Observability: this is the index."
---

# `@webmcp-agents/telemetry`

`@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](/docs/observability), where the options come from the source and the backend you
picked carries from page to page. Start with [Installation](/docs/observability/installation).

Experimental: new in 0.5.0. Span and attribute names follow the OpenTelemetry GenAI conventions, which are not stable
yet.

```sh
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`](/docs/observability/define-observability): the layer the chat handler takes as
  `observability`.
- [`otlp`](/docs/observability/otlp): one OTLP destination in code.
- [`observability.relay`](/docs/observability/relay): the `/api/telemetry` handler for the page's spans.
- [`observability.event`, `observability.span`](/docs/observability/custom-events): your own events and spans
  in a chat request's trace.
- [`resolveTarget`](/docs/observability/where-spans-go#check-a-deployment-resolvetarget): what the environment
  resolves to, without sending anything.

## `@webmcp-agents/telemetry`

- [`observeAgents`](/docs/observability/observe-agents): the page's runs and tool calls as spans.
- [`recordAgentEvent`, `withAgentSpan`](/docs/observability/custom-events): your own events and spans in a
  run's trace.
- [`consoleExporter`](/docs/observability/observe-agents#returns): print spans instead of sending them.

## `@webmcp-agents/telemetry/react`

- [`<ObserveAgents>`](/docs/observability/observe-agents): `observeAgents` as a component.

## Both entries

- [Span names and attributes](/docs/observability/spans#names): every name as a constant.
- [The OpenTelemetry types](/docs/observability/spans#types): the shapes the options take.

## See also

- [`createChatHandler`](/docs/reference/chat/create-chat-handler#telemetry): the handler's own `telemetry` option and the
  `ChatObservability` interface this package implements
- [`onAgentRun`](/docs/reference/chat/on-agent-run): the run events the browser spans are built from
- [`configureRedaction`](/docs/reference/core/configure-redaction): the redactor every span passes through
- [Testing spans](/docs/reference/testing/telemetry): `memoryExporter`, `toHaveSpan`, `toBeOneTrace`
