Follow Discord
Sweep 27 Oct 2026 · 19:04Z Build v2.1.312 531 read Stable v2.1.308 Latest v2.1.312 Next v2.1.312 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

spans changedapi/opentelemetry/spans

Nearest release: v2.1.312, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+104added
Lines−104removed
From line 10 where the diff opens
First seen 14 Oct 2026 this site's first read of the page
Recorded edits8to this page, all time

The whole hunk

from line 10, old and new numbered
/
lines
from line 10
1010---
1111 
1212<Note>
13 OpenTelemetry export is in beta. It's provided under your agreement with Anthropic, including the Beta Services section of the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Span names and attributes can change during the beta.
13 OpenTelemetry export is in beta. It’s provided under your agreement with Anthropic, including the Beta Services section of the [Service Specific Terms](https://www.anthropic.com/legal/service-specific-terms). Span names and attributes can change during the beta.
1414</Note>
1515 
1616To get spans, see [Set up OpenTelemetry with the Claude SDK](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk) and [Set up OpenTelemetry with the Claude API](https://platform.claude.com/docs/en/manage-claude/opentelemetry/api).
from line 19
1919 
2020| Property | SDK spans | API spans |
2121| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
22| `service.name` | The application's `service.name` | `claude-platform` |
23| Instrumentation scope | `com.anthropic.sdk.<language>` or `com.anthropic.sdk.cli`, plus `.<platform>` on a cloud platform's client, with the package's version | `com.anthropic.claude-platform` |
22| `service.name` | The application’s `service.name` | `claude-platform` |
23| Instrumentation scope | `com.anthropic.sdk.<language>` or `com.anthropic.sdk.cli`, plus `.<platform>` on a cloud platform’s client, with the package’s version | `com.anthropic.claude-platform` |
2424| Span kind | `CLIENT` on the span for a request, `INTERNAL` otherwise | `SERVER` on the span for a request, `INTERNAL` otherwise |
2525 
26* **Spans for requests** have the name of the request's API method: `anthropic.` followed by the method's path in the API reference, with dots instead of slashes and without `beta`. For example, `client.beta.sessions.events.send()` (csharp, go: `client.Beta.Sessions.Events.Send()`; java: `client.beta().sessions().events().send()`; php: `$client->beta->sessions->events->send()`; ruby: `client.beta.sessions.events.send_()`) sends a request to [send session events](https://platform.claude.com/docs/en/api/beta/sessions/events/send), and its spans have the name [`anthropic.sessions.events.send`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-events-send).
26* **Spans for requests** have the name of the request’s API method: `anthropic.` followed by the method’s path in the API reference, with dots instead of slashes and without `beta`. For example, `client.beta.sessions.events.send()` (csharp, go: `client.Beta.Sessions.Events.Send()`; java: `client.beta().sessions().events().send()`; php: `$client->beta->sessions->events->send()`; ruby: `client.beta.sessions.events.send_()`) sends a request to [send session events](https://platform.claude.com/docs/en/api/beta/sessions/events/send), and its spans have the name [`anthropic.sessions.events.send`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-events-send).
2727* **Tool spans** have a fixed name, a space, and the tool name, for example [`anthropic.tool_use bash`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use).
2828 
2929## Span status
from line 32
3232* **`ERROR`:** The step failed.
3333* **Unset:** The application canceled the step, for example when it sent a [`user.interrupt`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_user_interrupt_event) event.
3434 
35A stream's span ends when the stream ends. If the application closes the stream early, the SDK span has the status unset, so the SDK span for a stream that never completes, such as [`anthropic.sessions.events.stream`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), has the status unset or `ERROR`.
35A stream’s span ends when the stream ends. If the application closes the stream early, the SDK span has the status unset, so the SDK span for a stream that never completes, such as [`anthropic.sessions.events.stream`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), has the status unset or `ERROR`.
3636 
3737## Attributes
3838 
from line 44
4444 
4545| Attribute | Type | Description |
4646| --------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
47| `gen_ai.provider.name` | `string` | `anthropic`. On every span.<br />**SDK:** `aws.bedrock` on the Amazon Bedrock clients (Mantle included), and `gcp.vertex_ai` on the client for Google Cloud's Agent Platform. |
47| `gen_ai.provider.name` | `string` | `anthropic`. On every span.<br />**SDK:** `aws.bedrock` on the Amazon Bedrock clients (Mantle included), and `gcp.vertex_ai` on the client for Google Cloud’s Agent Platform. |
4848| `anthropic.organization.id` | `string` | The organization ID. |
4949| `anthropic.workspace.id` | `string` | The ID of the workspace that the work runs in. |
5050| `anthropic.request.id` | `string` | The value of the `request-id` response header. |
51| `http.request.method` | `string` | The request's HTTP method, for example `POST`. |
52| `http.route` | `string` | The endpoint's path, with placeholders for its path parameters, for example `/v1/sessions/{session_id}`. |
53| `http.response.status_code` | `int` | The final response's HTTP status code. For a stream, the status code sent with the headers. Absent when there was no response. |
51| `http.request.method` | `string` | The request’s HTTP method, for example `POST`. |
52| `http.route` | `string` | The endpoint’s path, with placeholders for its path parameters, for example `/v1/sessions/{session_id}`. |
53| `http.response.status_code` | `int` | The final response’s HTTP status code. For a stream, the status code sent with the headers. Absent when there was no response. |
5454| `server.address` | `string` | The host that the request was sent to, for example `api.anthropic.com`. |
55| `server.port` | `int` | The request URL's port, or the default port of its scheme when the URL doesn't have one. |
56| `url.scheme` | `string` | The URL's scheme, for example `https`. |
57| `url.path` | `string` | The URL's path, for example `/v1/messages`. |
58| `url.query` | `string` | The URL's query string, with only the query parameters that the endpoint defines. Absent when there are none. |
59| `url.full` | `string` | The request's URL. |
55| `server.port` | `int` | The request URL’s port, or the default port of its scheme when the URL doesn’t have one. |
56| `url.scheme` | `string` | The URL’s scheme, for example `https`. |
57| `url.path` | `string` | The URL’s path, for example `/v1/messages`. |
58| `url.query` | `string` | The URL’s query string, with only the query parameters that the endpoint defines. Absent when there are none. |
59| `url.full` | `string` | The request’s URL. |
6060 
61On Claude Platform on AWS, API spans don't have `server.address`, `server.port`, or `url.full`.
61On Claude Platform on AWS, API spans don’t have `server.address`, `server.port`, or `url.full`.
6262 
6363### Session attributes
6464 
65In a Managed Agents session, spans have the following attributes. A session's spans can be in more than one trace, so to assemble a view of the session, such as a transcript, [group its spans by these IDs](https://platform.claude.com/docs/en/manage-claude/opentelemetry#a-managed-agents-session).
65In a Managed Agents session, spans have the following attributes. A session’s spans can be in more than one trace, so to assemble a view of the session, such as a transcript, [group its spans by these IDs](https://platform.claude.com/docs/en/manage-claude/opentelemetry#a-managed-agents-session).
6666 
6767| Attribute | Type | Description |
6868| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69| `anthropic.session.id` | `string` | The session ID. Absent on the spans for methods that don't act on one session, such as [`anthropic.sessions.list`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method). |
70| `gen_ai.conversation.id` | `string` | The ID of the session thread that the span belongs to. The SDK's [`conversation_id` (typescript, java, php: `conversationId`; csharp: `ConversationId`; go: `option.WithOpenTelemetryConversationID()`) option](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#configure-the-sdk) replaces it with your own conversation ID. Absent on SDK spans with no thread unless you set the option, and on API spans for Sessions API requests other than requests to one thread. |
69| `anthropic.session.id` | `string` | The session ID. Absent on the spans for methods that don’t act on one session, such as [`anthropic.sessions.list`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method). |
70| `gen_ai.conversation.id` | `string` | The ID of the session thread that the span belongs to. The SDK’s [`conversation_id` (typescript, java, php: `conversationId`; csharp: `ConversationId`; go: `option.WithOpenTelemetryConversationID()`) option](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#configure-the-sdk) replaces it with your own conversation ID. Absent on SDK spans with no thread unless you set the option, and on API spans for Sessions API requests other than requests to one thread. |
7171 
7272### Content attributes
7373 
74Attributes tagged with <Badge>Content</Badge> are only on spans in content mode, from the SDK and the API alike. See [how the content modes differ in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#choose-a-content-mode). When this content is too large, the SDK and the API shorten it to fit the [content limits](https://platform.claude.com/docs/en/manage-claude/opentelemetry#content-limits) and set `anthropic.content.truncated` to `true`. If Anthropic's safeguards withhold content from a response, the API's spans don't include that content either.
74Attributes tagged with <Badge>Content</Badge> are only on spans in content mode, from the SDK and the API alike. See [how the content modes differ in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#choose-a-content-mode). When this content is too large, the SDK and the API shorten it to fit the [content limits](https://platform.claude.com/docs/en/manage-claude/opentelemetry#content-limits) and set `anthropic.content.truncated` to `true`. If Anthropic’s safeguards withhold content from a response, the API’s spans don’t include that content either.
7575 
7676The message attributes are JSON strings in the message format of the OpenTelemetry GenAI conventions. Each Anthropic content block becomes one GenAI conventions message part, on the Messages API and in Managed Agents message events such as `agent.message`:
7777 
from line 80
8080| `text` | `text` |
8181| `tool_use`, `server_tool_use` | `tool_call`, with `anthropic_toolset_name` for a `tool_use` block that has a `toolset_name`, such as `computer` |
8282| `mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |
83| `tool_result`, `mcp_tool_result`, a server tool's result block such as `web_search_tool_result` | `tool_call_response` |
84| `thinking` | `reasoning`, without the `thinking` block's signature. Not in Managed Agents spans, because the `agent.thinking` event doesn't include the thinking content. |
85| Any other block, such as `image` | The block's `type` with the prefix `anthropic_`, such as `anthropic_image`. The part has no other fields. |
83| `tool_result`, `mcp_tool_result`, a server tool’s result block such as `web_search_tool_result` | `tool_call_response` |
84| `thinking` | `reasoning`, without the `thinking` block’s signature. Not in Managed Agents spans, because the `agent.thinking` event doesn’t include the thinking content. |
85| Any other block, such as `image` | The block’s `type` with the prefix `anthropic_`, such as `anthropic_image`. The part has no other fields. |
8686 
8787Each Managed Agents tool use or tool result event also becomes one GenAI conventions message part:
8888 
from line 94
9494 
9595### Token usage
9696 
97The following spans have token usage attributes: [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request), [`anthropic.compaction`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-compaction), and [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation). The values are for each span's step, for example the request, the model request, or the compaction. To count each token once, see [how to count tokens in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#count-tokens).
97The following spans have token usage attributes: [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request), [`anthropic.compaction`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-compaction), and [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation). The values are for each span’s step, for example the request, the model request, or the compaction. To count each token once, see [how to count tokens in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#count-tokens).
9898 
9999| Attribute | Type | Description |
100100| ---------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
from line 101
101101| `gen_ai.usage.input_tokens` | `int` | The input tokens, cache reads and writes included. |
102102| `gen_ai.usage.output_tokens` | `int` | The output tokens. |
103103| `gen_ai.usage.cache_write.input_tokens` | `int` | The tokens written to the prompt cache. Absent on [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation) spans. |
104| `anthropic.usage.cache_creation.ephemeral_5m_input_tokens` | `int` | The tokens written to the 5-minute cache. Only on the spans for Messages API requests. On a streaming response's SDK span, only the tokens written before the first output token. |
105| `anthropic.usage.cache_creation.ephemeral_1h_input_tokens` | `int` | The tokens written to the 1-hour cache. Only on the spans for Messages API requests. On a streaming response's SDK span, only the tokens written before the first output token. |
104| `anthropic.usage.cache_creation.ephemeral_5m_input_tokens` | `int` | The tokens written to the 5-minute cache. Only on the spans for Messages API requests. On a streaming response’s SDK span, only the tokens written before the first output token. |
105| `anthropic.usage.cache_creation.ephemeral_1h_input_tokens` | `int` | The tokens written to the 1-hour cache. Only on the spans for Messages API requests. On a streaming response’s SDK span, only the tokens written before the first output token. |
106106| `gen_ai.usage.cache_read.input_tokens` | `int` | The tokens read from the prompt cache. Absent on [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation) spans. |
107107 
108108## Spans
109109 
110A span can come from the SDK in the application or from the API, so each span in this reference lists its sources. Descriptions that start with **Messages API:** or **Managed Agents:** are for that product's spans. Attribute descriptions that start with a source, such as **SDK:** or **API:**, are for that source's spans.
110A span can come from the SDK in the application or from the API, so each span in this reference lists its sources. Descriptions that start with **Messages API:** or **Managed Agents:** are for that product’s spans. Attribute descriptions that start with a source, such as **SDK:** or **API:**, are for that source’s spans.
111111 
112112### `anthropic.messages.create`
113113 
114114* **Source:** The SDK and the API.
115115* **Kind:** `CLIENT` from the SDK, `SERVER` from the API.
116* **Parent of the SDK span:** The span that is current in the application when it calls the method. If no span is current, there's no parent.
117* **Parent of the API span:** The span in the request's `traceparent` header, which is the SDK span when the request comes from the SDK. Without the header, the API span has no parent. See [how to send the `traceparent` header](https://platform.claude.com/docs/en/manage-claude/opentelemetry/api#connect-api-spans-to-your-own-traces).
116* **Parent of the SDK span:** The span that is current in the application when it calls the method. If no span is current, there’s no parent.
117* **Parent of the API span:** The span in the request’s `traceparent` header, which is the SDK span when the request comes from the SDK. Without the header, the API span has no parent. See [how to send the `traceparent` header](https://platform.claude.com/docs/en/manage-claude/opentelemetry/api#connect-api-spans-to-your-own-traces).
118118* **Children of the SDK span:** The API span for that request.
119119* **Children of the API span:** An [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request) span for each model request, a [tool span](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use) for each use of a server tool or an MCP connector tool that the API runs in the request, and an [`anthropic.compaction`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-compaction) span for each compaction.
120120 
121121The SDK emits this span for each Messages request, streamed or not.
122122 
123The API emits this span for each [`POST /v1/messages`](https://platform.claude.com/docs/en/api/messages/create) request that it authenticates. It doesn't emit the span for a request to the [OpenAI-compatible endpoint](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/openai-sdk), `POST /v1/chat/completions`.
123The API emits this span for each [`POST /v1/messages`](https://platform.claude.com/docs/en/api/messages/create) request that it authenticates. It doesn’t emit the span for a request to the [OpenAI-compatible endpoint](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/openai-sdk), `POST /v1/chat/completions`.
124124 
125125The API emits one span for a request, even when a [fallback model](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) serves it.
126126 
from line 129
129129| Attribute | Type | Description |
130130| ------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
131131| `gen_ai.operation.name` | `string` | `chat` |
132| `gen_ai.request.model` | `string` | The request's [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
133| `gen_ai.response.id` | `string` | The response's [`id`](https://platform.claude.com/docs/en/api/messages/create#message). |
132| `gen_ai.request.model` | `string` | The request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
133| `gen_ai.response.id` | `string` | The response’s [`id`](https://platform.claude.com/docs/en/api/messages/create#message). |
134134| `gen_ai.response.model` | `string` | The model that served the request. It differs from the requested model when the request uses a model alias, or when a [fallback model](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) served the request. |
135| `anthropic.message.stop_reason` | `string` | The response's [`stop_reason`](https://platform.claude.com/docs/en/api/messages#stop_reason), for example `end_turn`. |
136| `anthropic.response.service_tier` | `string` | The service tier that served the request: the response's [`usage.service_tier`](https://platform.claude.com/docs/en/api/messages#usage). See [how requests get assigned tiers](https://platform.claude.com/docs/en/api/service-tiers#how-requests-get-assigned-tiers). |
137| `error.type` | `string` | A failed request's [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`.<br />**SDK:** Also the other values in [SDK spans for requests](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).<br />**API:** `api_error` when the API ends the request without an error response. |
138| `gen_ai.response.time_to_first_chunk` | `double` | Only on a streaming response's spans. The seconds to the stream's first `content_block_delta` event, if it has one. |
139| `gen_ai.usage.reasoning.output_tokens` | `int` | The response's thinking tokens. They are part of the output tokens. Absent when the response's usage doesn't have details for the output tokens. |
140| `anthropic.usage.compaction.input_tokens` | `int` | Input tokens of the request's [compactions](https://platform.claude.com/docs/en/build-with-claude/compaction), including cache reads and writes. Not part of `gen_ai.usage.input_tokens`. Absent when the response has no compaction. |
141| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request's compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the response has no compaction. |
142| `gen_ai.request.max_tokens` | `int` | The request's [`max_tokens`](https://platform.claude.com/docs/en/api/messages/create#create.max_tokens). |
143| `gen_ai.request.temperature` | `double` | The request's [`temperature`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.temperature). Absent when the request doesn't set it. |
144| `gen_ai.request.top_p` | `double` | The request's [`top_p`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.top_p). Absent when the request doesn't set it. |
145| `gen_ai.request.top_k` | `int` | The request's [`top_k`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.top_k). Absent when the request doesn't set it. |
135| `anthropic.message.stop_reason` | `string` | The response’s [`stop_reason`](https://platform.claude.com/docs/en/api/messages#stop_reason), for example `end_turn`. |
136| `anthropic.response.service_tier` | `string` | The service tier that served the request: the response’s [`usage.service_tier`](https://platform.claude.com/docs/en/api/messages#usage). See [how requests get assigned tiers](https://platform.claude.com/docs/en/api/service-tiers#how-requests-get-assigned-tiers). |
137| `error.type` | `string` | A failed request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`.<br />**SDK:** Also the other values in [SDK spans for requests](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).<br />**API:** `api_error` when the API ends the request without an error response. |
138| `gen_ai.response.time_to_first_chunk` | `double` | Only on a streaming response’s spans. The seconds to the stream’s first `content_block_delta` event, if it has one. |
139| `gen_ai.usage.reasoning.output_tokens` | `int` | The response’s thinking tokens. They are part of the output tokens. Absent when the response’s usage doesn’t have details for the output tokens. |
140| `anthropic.usage.compaction.input_tokens` | `int` | Input tokens of the request’s [compactions](https://platform.claude.com/docs/en/build-with-claude/compaction), including cache reads and writes. Not part of `gen_ai.usage.input_tokens`. Absent when the response has no compaction. |
141| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request’s compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the response has no compaction. |
142| `gen_ai.request.max_tokens` | `int` | The request’s [`max_tokens`](https://platform.claude.com/docs/en/api/messages/create#create.max_tokens). |
143| `gen_ai.request.temperature` | `double` | The request’s [`temperature`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.temperature). Absent when the request doesn’t set it. |
144| `gen_ai.request.top_p` | `double` | The request’s [`top_p`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.top_p). Absent when the request doesn’t set it. |
145| `gen_ai.request.top_k` | `int` | The request’s [`top_k`](https://platform.claude.com/docs/en/api/messages/create?version=2023-06-01#create.top_k). Absent when the request doesn’t set it. |
146146| `gen_ai.request.stream` | `boolean` | `true` when the request sets [`stream: true`](https://platform.claude.com/docs/en/api/messages/create#create.stream). Absent otherwise. |
147| `gen_ai.request.reasoning.level` | `string` | The [`effort`](https://platform.claude.com/docs/en/api/messages/create#create.output_config.effort) in the request's [`output_config`](https://platform.claude.com/docs/en/api/messages/create#create.output_config). Absent when the request doesn't set it. |
147| `gen_ai.request.reasoning.level` | `string` | The [`effort`](https://platform.claude.com/docs/en/api/messages/create#create.output_config.effort) in the request’s [`output_config`](https://platform.claude.com/docs/en/api/messages/create#create.output_config). Absent when the request doesn’t set it. |
148148| `gen_ai.output.type` | `string` | `json` when the request sets the output format to JSON. Absent otherwise. |
149| `anthropic.request.service_tier` | `string` | The request's [`service_tier`](https://platform.claude.com/docs/en/api/messages/create#create.service_tier). Absent when the request doesn't set it. |
150| `anthropic.thinking.type` | `string` | The request's [`thinking.type`](https://platform.claude.com/docs/en/api/messages/create#create.thinking). Absent when the request doesn't set it. |
151| `anthropic.thinking.budget_tokens` | `int` | The [`budget_tokens`](https://platform.claude.com/docs/en/api/messages#thinking_config_enabled.budget_tokens) in the request's [`thinking`](https://platform.claude.com/docs/en/api/messages/create#create.thinking) object. Absent when the request doesn't set it. |
152| `anthropic.beta` | `string[]` | The beta names in the request's [`anthropic-beta`](https://platform.claude.com/docs/en/api/beta/messages/create#create.betas) header. |
153| `gen_ai.system_instructions` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`SystemInstructions`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-system-instructions.json) schema. The request's [`system`](https://platform.claude.com/docs/en/api/messages/create#create.system) prompt. |
154| `gen_ai.input.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`InputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-input-messages.json) schema. The request's [`messages`](https://platform.claude.com/docs/en/api/messages/create#create.messages). |
155| `gen_ai.output.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`OutputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-output-messages.json) schema. The response's [`content`](https://platform.claude.com/docs/en/api/messages/create#message), as one `assistant` message.<br />**SDK:** On a stream, only when the application reads the stream as [Tracing a stream](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#trace-a-stream) describes. |
156| `gen_ai.request.stop_sequences` | `string[]` | <Badge>Content</Badge> The request's [`stop_sequences`](https://platform.claude.com/docs/en/api/messages/create#create.stop_sequences). |
149| `anthropic.request.service_tier` | `string` | The request’s [`service_tier`](https://platform.claude.com/docs/en/api/messages/create#create.service_tier). Absent when the request doesn’t set it. |
150| `anthropic.thinking.type` | `string` | The request’s [`thinking.type`](https://platform.claude.com/docs/en/api/messages/create#create.thinking). Absent when the request doesn’t set it. |
151| `anthropic.thinking.budget_tokens` | `int` | The [`budget_tokens`](https://platform.claude.com/docs/en/api/messages#thinking_config_enabled.budget_tokens) in the request’s [`thinking`](https://platform.claude.com/docs/en/api/messages/create#create.thinking) object. Absent when the request doesn’t set it. |
152| `anthropic.beta` | `string[]` | The beta names in the request’s [`anthropic-beta`](https://platform.claude.com/docs/en/api/beta/messages/create#create.betas) header. |
153| `gen_ai.system_instructions` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`SystemInstructions`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-system-instructions.json) schema. The request’s [`system`](https://platform.claude.com/docs/en/api/messages/create#create.system) prompt. |
154| `gen_ai.input.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`InputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-input-messages.json) schema. The request’s [`messages`](https://platform.claude.com/docs/en/api/messages/create#create.messages). |
155| `gen_ai.output.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`OutputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-output-messages.json) schema. The response’s [`content`](https://platform.claude.com/docs/en/api/messages/create#message), as one `assistant` message.<br />**SDK:** On a stream, only when the application reads the stream as [Tracing a stream](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#trace-a-stream) describes. |
156| `gen_ai.request.stop_sequences` | `string[]` | <Badge>Content</Badge> The request’s [`stop_sequences`](https://platform.claude.com/docs/en/api/messages/create#create.stop_sequences). |
157157 
158A request's spans don't have the response's server tool usage counts, such as `web_search_requests`. Instead, the API emits a [tool span](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use) for each use of a server tool.
158A request’s spans don’t have the response’s server tool usage counts, such as `web_search_requests`. Instead, the API emits a [tool span](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use) for each use of a server tool.
159159 
160160### `anthropic.messages.count_tokens`
161161 
162* **Source:** The SDK. The API doesn't emit a span for [`POST /v1/messages/count_tokens`](https://platform.claude.com/docs/en/api/messages/count_tokens).
162* **Source:** The SDK. The API doesn’t emit a span for [`POST /v1/messages/count_tokens`](https://platform.claude.com/docs/en/api/messages/count_tokens).
163163* **Kind:** `CLIENT`.
164164* **Parent:** The span that is current in the application when it calls the method, or none if no span is current.
165165* **Children:** None.
from line 166
166166 
167167| Attribute | Type | Description |
168168| --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
169| `gen_ai.request.model` | `string` | The request's model. |
170| `anthropic.message.count_tokens.input_tokens` | `int` | The token count in the response. This count isn't usage. Don't include it when you sum token usage. |
169| `gen_ai.request.model` | `string` | The request’s model. |
170| `anthropic.message.count_tokens.input_tokens` | `int` | The token count in the response. This count isn’t usage. Don’t include it when you sum token usage. |
171171 
172172### `anthropic.sessions.create`
173173 
from line 174
174174The same as [`anthropic.sessions.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), except for the following children and attributes:
175175 
176176* **Children of the SDK span:** The API span for that request.
177* **Children of the API span:** The first turn's [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span, when the request has non-empty [`initial_events`](https://platform.claude.com/docs/en/api/beta/sessions/create#create.initial_events).
177* **Children of the API span:** The first turn’s [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span, when the request has non-empty [`initial_events`](https://platform.claude.com/docs/en/api/beta/sessions/create#create.initial_events).
178178 
179179| Attribute | Type | Description |
180180| ---------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
181181| `gen_ai.agent.id` | `string` | The ID of the agent that the session was created from. |
182| `gen_ai.agent.name` | `string` | That agent's name.<br />**SDK:** Absent when the request failed. |
182| `gen_ai.agent.name` | `string` | That agent’s name.<br />**SDK:** Absent when the request failed. |
183183| `gen_ai.request.model` | `string` | The model of that agent, which runs the primary thread.<br />**SDK:** Absent when the request failed. |
184| `anthropic.session.environment.id` | `string` | The ID of the session's environment. |
184| `anthropic.session.environment.id` | `string` | The ID of the session’s environment. |
185185 
186186### `anthropic.sessions.events.send`
187187 
188The same as [`anthropic.sessions.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), except for the API span's children.
188The same as [`anthropic.sessions.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), except for the API span’s children.
189189 
190190* **Children of the SDK span:** The API span for that request.
191* **Children of the API span:** The [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span for each turn that starts because of the request's events.
191* **Children of the API span:** The [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span for each turn that starts because of the request’s events.
192192 
193193### `anthropic.sessions.update`
194194 
195The same as [`anthropic.sessions.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), except for the API span's children.
195The same as [`anthropic.sessions.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-sessions-method), except for the API span’s children.
196196 
197197* **Children of the SDK span:** The API span for that request.
198198* **Children of the API span:** The [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span for each turn that resumes because the request raises or removes the [session budget](https://platform.claude.com/docs/en/managed-agents/budgets#resume-a-session-at-its-budget).
from line 216
216216 
217217 * An [`anthropic.model_request`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-model-request) span for each model request in the turn.
218218 * A tool span each time the API runs a tool in the turn, except in the [cases listed in the tool span section](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use).
219 * An `anthropic.session.turn` span for each turn on another thread that was started during this turn by the agent that the session runs, or by this turn's reply.
219 * An `anthropic.session.turn` span for each turn on another thread that was started during this turn by the agent that the session runs, or by this turn’s reply.
220220 * An [`anthropic.session.outcome_evaluation`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-outcome-evaluation) span for each iteration of an outcome evaluation that this turn starts.
221221 
222222A turn starts when its thread enters the `running` state and ends when the thread leaves it.
from line 224
224224| Attribute | Type | Description |
225225| ------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
226226| `gen_ai.operation.name` | `string` | `invoke_agent` |
227| `gen_ai.agent.id` | `string` | The ID of the agent that runs the turn's thread. Absent on an [advisor](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration#advisor-threads) thread. |
228| `gen_ai.agent.name` | `string` | That agent's name. `anthropic.advisor` on an advisor thread. |
229| `gen_ai.request.model` | `string` | That agent's model. On an advisor thread, the advisor's model. |
230| `anthropic.session.turn.stop_reason` | `string` | Why the turn ended: the [`session.thread_status_idle`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_thread_status_idle_event) event's [`stop_reason.type`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_thread_status_idle_event), for example `requires_action`. Absent when the thread didn't go idle. |
227| `gen_ai.agent.id` | `string` | The ID of the agent that runs the turn’s thread. Absent on an [advisor](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration#advisor-threads) thread. |
228| `gen_ai.agent.name` | `string` | That agent’s name. `anthropic.advisor` on an advisor thread. |
229| `gen_ai.request.model` | `string` | That agent’s model. On an advisor thread, the advisor’s model. |
230| `anthropic.session.turn.stop_reason` | `string` | Why the turn ended: the [`session.thread_status_idle`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_thread_status_idle_event) event’s [`stop_reason.type`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_thread_status_idle_event), for example `requires_action`. Absent when the thread didn’t go idle. |
231231| `error.type` | `string` | The [`error.type`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_error_event) of the [`session.error`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_session_error_event) event that ended the turn, if the turn failed. |
232| `gen_ai.agent.description` | `string` | That agent's description. Absent on an advisor thread or when the agent doesn't have one. |
233| `gen_ai.system_instructions` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`SystemInstructions`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-system-instructions.json) schema. The system prompt in effect for the turn. Only on a thread's first turn. Absent on an advisor thread. |
234| `gen_ai.input.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`InputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-input-messages.json) schema. The turn's input events: user messages and tool results, [`system.message`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_system_message_event_params) events, and messages from other threads. Absent on an advisor thread. |
235| `gen_ai.output.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`OutputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-output-messages.json) schema. The turn's output events: the agent's messages, tool uses, and tool results. |
232| `gen_ai.agent.description` | `string` | That agent’s description. Absent on an advisor thread or when the agent doesn’t have one. |
233| `gen_ai.system_instructions` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`SystemInstructions`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-system-instructions.json) schema. The system prompt in effect for the turn. Only on a thread’s first turn. Absent on an advisor thread. |
234| `gen_ai.input.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`InputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-input-messages.json) schema. The turn’s input events: user messages and tool results, [`system.message`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_system_message_event_params) events, and messages from other threads. Absent on an advisor thread. |
235| `gen_ai.output.messages` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`OutputMessages`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-output-messages.json) schema. The turn’s output events: the agent’s messages, tool uses, and tool results. |
236236 
237237### `anthropic.model_request`
238238 
from line 253
253253 
254254| Attribute | Type | Description |
255255| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
256| `gen_ai.operation.name` | `string` | Only on the spans for Managed Agents sessions, where it's `chat`. On the Messages API, the [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span for the request is the `chat` operation. |
257| `gen_ai.request.model` | `string` | The request's model. |
256| `gen_ai.operation.name` | `string` | Only on the spans for Managed Agents sessions, where it’s `chat`. On the Messages API, the [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span for the request is the `chat` operation. |
257| `gen_ai.request.model` | `string` | The request’s model. |
258258| `gen_ai.response.model` | `string` | Only on the spans for Messages API requests. The model that ran the model request. |
259| `error.type` | `string` | **Messages API:** The [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span's `error.type`, if the request failed during this model request.<br />**Managed Agents:** If the model request failed, its [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`. `api_error` if the model request failed without a response. |
259| `error.type` | `string` | **Messages API:** The [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span’s `error.type`, if the request failed during this model request.<br />**Managed Agents:** If the model request failed, its [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`. `api_error` if the model request failed without a response. |
260260 
261261### `anthropic.tool_use`, `anthropic.mcp_tool_use`, and `anthropic.custom_tool_use`
262262 
263263* **Source:** The SDK and the API.
264264 
265* **Name:** `anthropic.tool_use <tool>`, `anthropic.mcp_tool_use <tool>`, or `anthropic.custom_tool_use <tool>`, where `<tool>` is the tool's name.
265* **Name:** `anthropic.tool_use <tool>`, `anthropic.mcp_tool_use <tool>`, or `anthropic.custom_tool_use <tool>`, where `<tool>` is the tool’s name.
266266 
267267* **Kind:** `INTERNAL`.
268268 
269* **Parent of the SDK span:** The span that is current in the application when the tool starts, which in the Messages tool runner is the [`anthropic.messages.tool_runner`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-tool-runner) span. If no span is current, there's no parent.
269* **Parent of the SDK span:** The span that is current in the application when the tool starts, which in the Messages tool runner is the [`anthropic.messages.tool_runner`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-tool-runner) span. If no span is current, there’s no parent.
270270 
271271* **Parent of the API span:**
272272 
from line 274
274274 * **Managed Agents:** The [`anthropic.session.turn`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-session-turn) span for the turn in which the tool runs. For a tool use that waits for a [`user.tool_confirmation`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_user_tool_confirmation_event) event, that is the turn that starts because of the confirmation.
275275 * For a tool use from code that another tool runs, the tool span for that tool. On the Messages API, that tool is the [code execution tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/code-execution-tool).
276276 
277* **Children of the SDK span:** The spans that the tool's code starts.
277* **Children of the SDK span:** The spans that the tool’s code starts.
278278 
279279* **Children of the API span:** A tool span for each tool use from the code that this tool runs. For example, code that the code execution tool runs might use `web_search`.
280280 
from line 281
281281The span name prefix depends on the type of tool:
282282 
283283* `anthropic.tool_use <tool>` is the span for each use of a [server tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools) on the Messages API or of a tool from the agent toolset of Managed Agents. The API runs the agent toolset tools, except in a [self-hosted sandbox](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#trace-a-self-hosted-sandbox), where the environment worker runs them.
284* `anthropic.mcp_tool_use <tool>` is the span for each use of an MCP tool, in the SDK, on the Messages API, and on Managed Agents. In the SDK, it's a tool from an MCP helper that the [Messages tool runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) or the [session tool runner](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-reference#session-tool-runner) runs. On the Messages API, the tool comes from the [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector). On Managed Agents, if the [connection to the MCP server fails](https://platform.claude.com/docs/en/managed-agents/mcp-connector#handle-connection-and-authentication-failures), the span name doesn't include the tool name.
284* `anthropic.mcp_tool_use <tool>` is the span for each use of an MCP tool, in the SDK, on the Messages API, and on Managed Agents. In the SDK, it’s a tool from an MCP helper that the [Messages tool runner](https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-runner) or the [session tool runner](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-reference#session-tool-runner) runs. On the Messages API, the tool comes from the [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector). On Managed Agents, if the [connection to the MCP server fails](https://platform.claude.com/docs/en/managed-agents/mcp-connector#handle-connection-and-authentication-failures), the span name doesn’t include the tool name.
285285* `anthropic.custom_tool_use <tool>` is the span for each use of a tool that the application defines and a tool runner runs. Only the SDK emits this span.
286286 
287The API doesn't emit a tool span in the following cases:
287The API doesn’t emit a tool span in the following cases:
288288 
289289* The model asks to use a tool that the application runs, such as a [custom tool](https://platform.claude.com/docs/en/managed-agents/tools). If a tool runner in the SDK runs the tool, the tool runner emits its span.
290290* **Managed Agents:** The agent uses a tool that runs in a self-hosted sandbox. The worker in the SDK, which runs the tool, emits its span. See [how to trace a self-hosted sandbox](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#trace-a-self-hosted-sandbox).
from line 294
294294| Attribute | Type | Description |
295295| ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
296296| `gen_ai.operation.name` | `string` | `execute_tool` |
297| `gen_ai.tool.name` | `string` | The tool's name, for example `bash`. On API spans, an MCP tool's name doesn't have the server name. On Managed Agents, if the connection to the MCP server failed, it's the name that the model generated and is only on spans in content mode. |
297| `gen_ai.tool.name` | `string` | The tool’s name, for example `bash`. On API spans, an MCP tool’s name doesn’t have the server name. On Managed Agents, if the connection to the MCP server failed, it’s the name that the model generated and is only on spans in content mode. |
298298| `gen_ai.tool.call.id` | `string` | **Messages API:** The `id` of the block in which the model asked to use the tool: a [`tool_use`](https://platform.claude.com/docs/en/api/messages#tool_use_block), [`server_tool_use`](https://platform.claude.com/docs/en/api/messages#server_tool_use_block), or [`mcp_tool_use`](https://platform.claude.com/docs/en/api/beta/messages#beta_mcp_tool_use_block) block.<br />**Managed Agents:** The ID of the event in which the agent asked to use the tool: an [`agent.tool_use`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_agent_tool_use_event), [`agent.mcp_tool_use`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_agent_mcp_tool_use_event), or [`agent.custom_tool_use`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_agent_custom_tool_use_event) event. |
299| `anthropic.mcp.server.name` | `string` | Only on the API spans for MCP tools. The name of the tool's MCP server. On the Messages API, the [`mcp_tool_use`](https://platform.claude.com/docs/en/api/beta/messages#beta_mcp_tool_use_block) block's [`server_name`](https://platform.claude.com/docs/en/api/beta/messages#beta_mcp_tool_use_block.server_name). |
299| `anthropic.mcp.server.name` | `string` | Only on the API spans for MCP tools. The name of the tool’s MCP server. On the Messages API, the [`mcp_tool_use`](https://platform.claude.com/docs/en/api/beta/messages#beta_mcp_tool_use_block) block’s [`server_name`](https://platform.claude.com/docs/en/api/beta/messages#beta_mcp_tool_use_block.server_name). |
300300| `gen_ai.conversation.id` | `string` | The session thread ID, as [Session attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#session-attributes) describes. In the Messages tool runner, the conversation ID passed with the [`conversation_id` (typescript, java, php: `conversationId`; csharp: `ConversationId`; go: `option.WithOpenTelemetryConversationID()`) option](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#configure-the-sdk), and absent without one. Absent on the API spans for a Messages API request. |
301301| `anthropic.session.id` | `string` | The session ID. Absent for a tool use outside a Managed Agents session, such as on the Messages API or in the Messages tool runner. |
302| `anthropic.session.thread.id` | `string` | Only on the session tool runner's SDK spans. The session thread ID. Absent for a tool use on the primary thread. |
302| `anthropic.session.thread.id` | `string` | Only on the session tool runner’s SDK spans. The session thread ID. Absent for a tool use on the primary thread. |
303303| `anthropic.tool.evaluated_permission` | `string` | Only on the spans that the API emits in Managed Agents sessions. The result of evaluating the [permission policy](https://platform.claude.com/docs/en/managed-agents/permission-policies) for the tool use: `allow` or `ask`. |
304| `error.type` | `string` | The error type, if the tool use failed: `tool_error` when the tool's code raises an error or when the tool returns an error result.<br />**API:** On the Messages API, a server tool's error result instead has its [`error_code`](https://platform.claude.com/docs/en/api/messages#web_search_tool_result_error.error_code), for example `max_uses_exceeded`. On Managed Agents, if the connection to the MCP server failed, `mcp_authentication_failed_error` when authentication failed, otherwise `mcp_connection_failed_error`. If the request failed during the tool use, the request's [error type](https://platform.claude.com/docs/en/api/errors#http-errors). |
304| `error.type` | `string` | The error type, if the tool use failed: `tool_error` when the tool’s code raises an error or when the tool returns an error result.<br />**API:** On the Messages API, a server tool’s error result instead has its [`error_code`](https://platform.claude.com/docs/en/api/messages#web_search_tool_result_error.error_code), for example `max_uses_exceeded`. On Managed Agents, if the connection to the MCP server failed, `mcp_authentication_failed_error` when authentication failed, otherwise `mcp_connection_failed_error`. If the request failed during the tool use, the request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors). |
305305| `gen_ai.tool.description` | `string` | Only on SDK spans. The description in the tool definition. Absent when the description is empty. |
306306| `gen_ai.tool.type` | `string` | Only on SDK spans. `function` |
307| `gen_ai.tool.call.arguments` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`ToolCallArguments`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-tool-call-arguments.json) schema. The tool use's [`input`](https://platform.claude.com/docs/en/api/messages#tool_use_block). |
308| `anthropic.tool_result.content` | `string` | <Badge>Content</Badge> A JSON string with an array of content blocks. The `content` of the tool result that goes back to the model. Also for an error result, except on Managed Agents when the connection to the MCP server failed. A string `content` becomes an array with one [`text`](https://platform.claude.com/docs/en/api/messages#text_block) block.<br />**API:** On the Messages API, when a server tool's result `content` is one object, such as a `code_execution_result`, it becomes an array with that object. |
307| `gen_ai.tool.call.arguments` | `string` | <Badge>Content</Badge> A JSON string that follows the OpenTelemetry [`ToolCallArguments`](https://github.com/open-telemetry/semantic-conventions-genai/blob/e57c543b4889619eb2a05702471937db5119165d/model/gen-ai/gen-ai-tool-call-arguments.json) schema. The tool use’s [`input`](https://platform.claude.com/docs/en/api/messages#tool_use_block). |
308| `anthropic.tool_result.content` | `string` | <Badge>Content</Badge> A JSON string with an array of content blocks. The `content` of the tool result that goes back to the model. Also for an error result, except on Managed Agents when the connection to the MCP server failed. A string `content` becomes an array with one [`text`](https://platform.claude.com/docs/en/api/messages#text_block) block.<br />**API:** On the Messages API, when a server tool’s result `content` is one object, such as a `code_execution_result`, it becomes an array with that object. |
309309 
310310### `anthropic.compaction`
311311 
from line 314
314314* **Parent:** The [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span for the request.
315315* **Children:** None.
316316 
317The span has the compaction's [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage). On [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), a compaction's usage is in the `anthropic.usage.compaction.*` attributes instead of the `gen_ai.usage.*` totals.
317The span has the compaction’s [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage). On [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), a compaction’s usage is in the `anthropic.usage.compaction.*` attributes instead of the `gen_ai.usage.*` totals.
318318 
319319| Attribute | Type | Description |
320320| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
321| `error.type` | `string` | The request's [error type](https://platform.claude.com/docs/en/api/errors#http-errors), if the request failed during the compaction. |
321| `error.type` | `string` | The request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), if the request failed during the compaction. |
322322 
323323### `anthropic.session.outcome_evaluation`
324324 
from line 334
334334| Attribute | Type | Description |
335335| -------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
336336| `anthropic.session.outcome.id` | `string` | The ID of the outcome that the iteration evaluates. |
337| `anthropic.session.outcome_evaluation.result` | `string` | The iteration's result: `satisfied`, `needs_revision`, `max_iterations_reached`, `failed`, or `interrupted`. |
337| `anthropic.session.outcome_evaluation.result` | `string` | The iteration’s result: `satisfied`, `needs_revision`, `max_iterations_reached`, `failed`, or `interrupted`. |
338338| `anthropic.session.outcome_evaluation.iteration` | `int` | The iteration number. |
339| `anthropic.session.outcome_evaluation.explanation` | `string` | <Badge>Content</Badge> The grader's explanation of the result, as plain text. |
339| `anthropic.session.outcome_evaluation.explanation` | `string` | <Badge>Content</Badge> The grader’s explanation of the result, as plain text. |
340340 
341341### `anthropic.messages.tool_runner`
342342 
from line 345
345345* **Parent:** The span that is current in the application when the loop starts, or none if no span is current.
346346* **Children:** The [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) span for each request in the loop and the [tool span](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-tool-use-anthropic-mcp-tool-use-and-anthropic-custom-tool-use) for each tool use that the runner runs.
347347 
348The span ends with the loop. If the application stops the runner, the status is unset. If a tool's code raises an error, its tool span has the status `ERROR` and the loop continues. The span doesn't have usage attributes, so read the usage from its [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) children.
348The span ends with the loop. If the application stops the runner, the status is unset. If a tool’s code raises an error, its tool span has the status `ERROR` and the loop continues. The span doesn’t have usage attributes, so read the usage from its [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create) children.
349349 
350350| Attribute | Type | Description |
351351| ------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
352352| `gen_ai.operation.name` | `string` | `invoke_agent` |
353| `gen_ai.request.model` | `string` | The model of the loop's first request. |
353| `gen_ai.request.model` | `string` | The model of the loop’s first request. |
354354| `gen_ai.conversation.id` | `string` | The conversation ID passed with the [`conversation_id` (typescript, java, php: `conversationId`; csharp: `ConversationId`; go: `option.WithOpenTelemetryConversationID()`) option](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#configure-the-sdk). Absent without one. |
355355| `error.type` | `string` | The [error type](https://platform.claude.com/docs/en/api/errors#http-errors) of the request that ended the loop, if the loop failed. `client_error` when the runner itself failed. |
356356| `gen_ai.output.type` | `string` | `json` when the requests set the output format to JSON. Absent otherwise. |
from line 374
374374* **Source:** The SDK and the API.
375375* **Kind:** `CLIENT` from the SDK, `SERVER` from the API.
376376* **Parent of the SDK span:** The span that is current in the application when it calls the method, or none if no span is current.
377* **Parent of the API span:** The span in the request's [`traceparent` header](https://platform.claude.com/docs/en/manage-claude/opentelemetry/api#connect-api-spans-to-your-own-traces), which is the SDK span when the request comes from the SDK, or none without the header.
377* **Parent of the API span:** The span in the request’s [`traceparent` header](https://platform.claude.com/docs/en/manage-claude/opentelemetry/api#connect-api-spans-to-your-own-traces), which is the SDK span when the request comes from the SDK, or none without the header.
378378* **Children of the SDK span:** The API span for that request.
379379* **Children of the API span:** None.
380380 
381The API emits an `anthropic.sessions.<method>` span for each authenticated request to an endpoint of the [Sessions API](https://platform.claude.com/docs/en/managed-agents/sessions). Requests that the platform sends on a user's behalf, such as a message sent in the Claude Console or a session that a [scheduled deployment](https://platform.claude.com/docs/en/managed-agents/scheduled-deployments) starts, also have one, each in a new trace.
381The API emits an `anthropic.sessions.<method>` span for each authenticated request to an endpoint of the [Sessions API](https://platform.claude.com/docs/en/managed-agents/sessions). Requests that the platform sends on a user’s behalf, such as a message sent in the Claude Console or a session that a [scheduled deployment](https://platform.claude.com/docs/en/managed-agents/scheduled-deployments) starts, also have one, each in a new trace.
382382 
383383<Accordion title="Span names and endpoints">
384384 | Span | Endpoint |
from line 408
408408 
409409| Attribute | Type | Description |
410410| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
411| `error.type` | `string` | A failed request's [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`.<br />**SDK:** Also the other values in [SDK spans for requests](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).<br />**API:** `api_error` when the API closed the connection without an error response, or when a stream ended because of a failure in the API. |
411| `error.type` | `string` | A failed request’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`.<br />**SDK:** Also the other values in [SDK spans for requests](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).<br />**API:** `api_error` when the API closed the connection without an error response, or when a stream ended because of a failure in the API. |
412412 
413413### `anthropic.environment.work`
414414 
from line 433
433433* **Parent:** The span that is current in the application when it calls the method, or none if no span is current.
434434* **Children:** None.
435435 
436Each SDK method that sends a request and doesn't have a section on this page emits an `anthropic.<resources>.<method>` span, for example `anthropic.models.list` or `anthropic.files.upload`. The request for each later page of a list has its own span.
436Each SDK method that sends a request and doesn’t have a section on this page emits an `anthropic.<resources>.<method>` span, for example `anthropic.models.list` or `anthropic.files.upload`. The request for each later page of a list has its own span.
437437 
438438A span covers its whole request, retries included, and has each attribute of the same-named API span when the SDK has the value. The SDK sets `http.request.method` and `http.route` when it starts the span, so a sampler can use them.
439439 
from line 442
442442| Attribute | Type | Description |
443443| --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
444444| `gen_ai.conversation.id` | `string` | The conversation ID passed with the [`conversation_id` (typescript, java, php: `conversationId`; csharp: `ConversationId`; go: `option.WithOpenTelemetryConversationID()`) option](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk#configure-the-sdk). Without one, the ID of the session thread that the span belongs to, as in [Session attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#session-attributes), and absent on spans with no thread. |
445| `anthropic.<resource>.id` | `string` | One attribute for each ID in the request's path and one for the ID of an object that the method creates. The name comes from the path, in the singular, for example `anthropic.session.id` or `anthropic.session.thread.id`. |
445| `anthropic.<resource>.id` | `string` | One attribute for each ID in the request’s path and one for the ID of an object that the method creates. The name comes from the path, in the singular, for example `anthropic.session.id` or `anthropic.session.thread.id`. |
446446| `gen_ai.agent.id` | `string` | The agent ID, on the agent methods. |
447447| `gen_ai.memory.store.id` | `string` | The memory store ID, on the memory store methods. |
448448| `gen_ai.memory.record.id` | `string` | The memory ID, on the memory methods. |
449| `http.request.resend_count` | `int` | The number of times that the SDK resent the request, for any reason, such as a retry. Absent when the SDK didn't resend it. |
450| `error.type` | `string` | A failed call's [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`. The HTTP status code, for example `502`, when the error response doesn't have an error type. `connection_error`, `client_timeout_error`, or `client_error` when the call failed in the SDK. `api_error` when the server ended a stream early. |
451| `server.address` | `string` | The host of the client's base URL, `api.anthropic.com` by default. On a cloud platform's client, that platform's host. |
452| `url.query` | `string` | The URL's query string, with only the query parameters that the endpoint defines. Absent when there are none. In metadata-only mode, absent when the query has a sensitive parameter, such as `email`. |
449| `http.request.resend_count` | `int` | The number of times that the SDK resent the request, for any reason, such as a retry. Absent when the SDK didn’t resend it. |
450| `error.type` | `string` | A failed call’s [error type](https://platform.claude.com/docs/en/api/errors#http-errors), for example `rate_limit_error`. The HTTP status code, for example `502`, when the error response doesn’t have an error type. `connection_error`, `client_timeout_error`, or `client_error` when the call failed in the SDK. `api_error` when the server ended a stream early. |
451| `server.address` | `string` | The host of the client’s base URL, `api.anthropic.com` by default. On a cloud platform’s client, that platform’s host. |
452| `url.query` | `string` | The URL’s query string, with only the query parameters that the endpoint defines. Absent when there are none. In metadata-only mode, absent when the query has a sensitive parameter, such as `email`. |
453453| `url.full` | `string` | The URL, made of `url.scheme`, `server.address`, the port when the base URL has one, `url.path`, and `url.query`. In metadata-only mode, absent whenever that mode leaves out `url.query`. |
454454 
Feedback