Skip to main content
W&B Weave agent observability is built on OpenTelemetry (OTel). Weave provides a dedicated OTLP endpoint that ingests spans into the Agents view. If your agent already emits OTel spans, you can send them to Weave by pointing your existing OTel pipeline at the endpoint without installing the Weave SDK. This page covers how to authenticate with and send spans to the endpoint.

Authentication

You can send spans to the following endpoint:
  • Path: /agents/otel/v1/traces
  • Method: POST
  • Content-Type: application/x-protobuf
  • Base URL: https://trace.wandb.ai for Multi-tenant Cloud.
The endpoint accepts OTLP protobuf payloads only. Use a protobuf HTTP exporter such as opentelemetry-exporter-otlp-proto-http (Python) or @opentelemetry/exporter-trace-otlp-proto (TypeScript). The endpoint also accepts gzip and deflate content encoding. To authenticate with the endpoint, set your W&B API key in your OTLPSpanExporter configuration using one of the following values:
  • wandb-api-key: Your W&B API key as the value.
  • Authorization: HTTP Basic authentication with api as the user and your W&B API key as the password. This form is useful when your exporter or collector only supports standard authorization headers.

Project routing

Weave routes spans to a project using either OTel resource attributes or a request header:
  • Resource attributes (recommended): Set wandb.entity to your W&B team or user name and wandb.project to the project name on your TracerProvider resource.
  • project_id header: Set the value to [YOUR-TEAM]/[YOUR-PROJECT].
If both are present, the resource attributes take precedence. Spans that arrive with no entity and project are dropped.

Shape spans for the Agents view

Weave accepts any OTel span and stores all of its attributes, but the Agents view renders spans that follow the OTel GenAI semantic conventions. Set gen_ai.operation.name on each span to tell Weave what the span represents: Two more attributes control grouping:
  • gen_ai.conversation.id: Groups turns into a conversation. Use a stable ID for the lifetime of the conversation.
  • gen_ai.agent.name: Groups conversations under a named agent in the Agents tab.
Other GenAI semantic-convention attributes, such as gen_ai.request.model, gen_ai.usage.input_tokens, and gen_ai.usage.output_tokens, enrich the rendering with model names and token counts but are optional. For the agent data model that these spans map onto, see Trace your agents.

Configure with environment variables only

If your application or collector reads the standard OTel exporter environment variables, you can set the following variables and route spans to Weave without changing any code:

Example: emit agent spans without the Weave SDK

The following example instruments a minimal agent turn using only OTel packages. It emits an invoke_agent span for the turn, a chat span for the LLM call, and an execute_tool span for a tool call, then exports them to the Weave agents endpoint. First, install the required dependencies:
Then set the WANDB_API_KEY, ENTITY, and PROJECT values in the following code, and then run it:
To add more turns to the same conversation, emit more invoke_agent spans with the same gen_ai.conversation.id. Each turn is the root span of its own trace, so turns don’t need to share a parent span. After your application exports spans, open the Agents tab of your Weave project.