spans changedapi/opentelemetry/spans
Nearest release: v2.1.330, 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+175added
Lines−175removed
From line
44
where the diff opens
First seen
14 Oct 2026
this site's first read of the page
Recorded edits16to this page, all time
The whole hunk
from line 44, old and new numbered
/
from line 44
4444
4545## Span names and kinds
4646
47| Property | SDK spans | API spans |
48| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
49| `service.name` | The application’s `service.name` | `claude-platform` |
50| 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` |
51| Span kind | `CLIENT` on the span for a request, `INTERNAL` otherwise | `SERVER` on the span for a request, `INTERNAL` otherwise |
47| Property | SDK spans | API spans |
48| ----- | ----- | ----- |
49| `service.name` | The application’s `service.name` | `claude-platform` |
50| 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` |
51| Span kind | `CLIENT` on the span for a request, `INTERNAL` otherwise | `SERVER` on the span for a request, `INTERNAL` otherwise |
5252
5353* **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).
5454* **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).
from line 69
6969
7070Any span can have the following attributes:
7171
72| Attribute | Type | Description |
73| --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
74| `gen_ai.provider.name` | `string` | The platform that serves the request: `aws.bedrock` on Amazon Bedrock (Mantle included), `gcp.vertex_ai` on Google Cloud’s Agent Platform, and `anthropic` everywhere else. On every span. |
75| `anthropic.organization.id` | `string` | The organization ID. |
76| `anthropic.workspace.id` | `string` | The ID of the workspace that the work runs in. |
77| `user.id` | `string` | Your end user’s ID, if you set it in the W3C [`baggage`](https://www.w3.org/TR/baggage/) header (for example, `baggage: user.id=4f2a`). It appears on the request’s API span and on every API span under it, such as the session turns that the request starts.<br />Use an opaque ID, such as your database’s key for the user.<br />**Do not put an email address in this value.** To protect user privacy, the API drops any `user.id` that contains one. |
72| Attribute | Type | Description |
73| ----- | ----- | ----- |
74| `gen_ai.provider.name` | `string` | The platform that serves the request: `aws.bedrock` on Amazon Bedrock (Mantle included), `gcp.vertex_ai` on Google Cloud’s Agent Platform, and `anthropic` everywhere else. On every span. |
75| `anthropic.organization.id` | `string` | The organization ID. |
76| `anthropic.workspace.id` | `string` | The ID of the workspace that the work runs in. |
77| `user.id` | `string` | Your end user’s ID, if you set it in the W3C [`baggage`](https://www.w3.org/TR/baggage/) header (for example, `baggage: user.id=4f2a`). It appears on the request’s API span and on every API span under it, such as the session turns that the request starts.<br />Use an opaque ID, such as your database’s key for the user.<br />**Do not put an email address in this value.** To protect user privacy, the API drops any `user.id` that contains one. |
7878
7979### Request span attributes
8080
8181Every span for a request also has the following attributes, except where a description says otherwise:
8282
83| Attribute | Type | Description |
84| --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
85| `anthropic.request.id` | `string` | The value of the `request-id` response header. |
86| `http.request.method` | `string` | The request’s HTTP method, for example `POST`. |
87| `http.route` | `string` | The endpoint’s path, with placeholders for its path parameters, for example `/v1/sessions/{session_id}`. |
88| `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. |
89| `server.address` | `string` | The host that the request was sent to, for example `api.anthropic.com`. |
90| `server.port` | `int` | The request URL’s port, or the default port of its scheme when the URL doesn’t have one. |
91| `url.scheme` | `string` | The URL’s scheme, for example `https`. |
92| `url.path` | `string` | The URL’s path, for example `/v1/messages`. |
93| `url.query` | `string` | The URL’s query string, with only the query parameters that the endpoint defines. Absent when there are none. |
94| `url.full` | `string` | The request’s URL. |
83| Attribute | Type | Description |
84| ----- | ----- | ----- |
85| `anthropic.request.id` | `string` | The value of the `request-id` response header. |
86| `http.request.method` | `string` | The request’s HTTP method, for example `POST`. |
87| `http.route` | `string` | The endpoint’s path, with placeholders for its path parameters, for example `/v1/sessions/{session_id}`. |
88| `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. |
89| `server.address` | `string` | The host that the request was sent to, for example `api.anthropic.com`. |
90| `server.port` | `int` | The request URL’s port, or the default port of its scheme when the URL doesn’t have one. |
91| `url.scheme` | `string` | The URL’s scheme, for example `https`. |
92| `url.path` | `string` | The URL’s path, for example `/v1/messages`. |
93| `url.query` | `string` | The URL’s query string, with only the query parameters that the endpoint defines. Absent when there are none. |
94| `url.full` | `string` | The request’s URL. |
9595
9696API spans for requests sent through a cloud platform, such as Claude Platform on AWS, don’t have `server.address`, `server.port`, or `url.full`.
9797
from line 99
9999
100100In 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).
101101
102| Attribute | Type | Description |
103| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104| `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). |
102| Attribute | Type | Description |
103| ----- | ----- | ----- |
104| `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). |
105105| `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. |
106106
107107### Content attributes
from line 110
110110
111111The 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`:
112112
113| Anthropic content block | GenAI conventions message part |
114| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
115| `text` | `text` |
116| `tool_use`, `server_tool_use` | `tool_call`, with `anthropic_toolset_name` for a `tool_use` block that has a `toolset_name`, such as `computer` |
117| `mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |
118| `tool_result`, `mcp_tool_result`, a server tool’s result block such as `web_search_tool_result` | `tool_call_response` |
119| `thinking` | `reasoning`, without the `thinking` block’s signature. Not in Managed Agents spans, because the `agent.thinking` event doesn’t include the thinking content. |
120| Any other block, such as `image` | The block’s `type` with the prefix `anthropic_`, such as `anthropic_image`. The part has no other fields. |
113| Anthropic content block | GenAI conventions message part |
114| ----- | ----- |
115| `text` | `text` |
116| `tool_use`, `server_tool_use` | `tool_call`, with `anthropic_toolset_name` for a `tool_use` block that has a `toolset_name`, such as `computer` |
117| `mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |
118| `tool_result`, `mcp_tool_result`, a server tool’s result block such as `web_search_tool_result` | `tool_call_response` |
119| `thinking` | `reasoning`, without the `thinking` block’s signature. Not in Managed Agents spans, because the `agent.thinking` event doesn’t include the thinking content. |
120| Any other block, such as `image` | The block’s `type` with the prefix `anthropic_`, such as `anthropic_image`. The part has no other fields. |
121121
122122Each Managed Agents tool use or tool result event also becomes one GenAI conventions message part:
123123
124| Managed Agents event | GenAI conventions message part |
125| ------------------------------------------------------------------------------------------- | -------------------------------------------- |
126| `agent.tool_use`, `agent.custom_tool_use` | `tool_call` |
127| `agent.mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |
128| `user.tool_result`, `user.custom_tool_result`, `agent.tool_result`, `agent.mcp_tool_result` | `tool_call_response` |
124| Managed Agents event | GenAI conventions message part |
125| ----- | ----- |
126| `agent.tool_use`, `agent.custom_tool_use` | `tool_call` |
127| `agent.mcp_tool_use` | `tool_call` with `anthropic_mcp_server_name` |
128| `user.tool_result`, `user.custom_tool_result`, `agent.tool_result`, `agent.mcp_tool_result` | `tool_call_response` |
129129
130130### Token usage
131131
132132The 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. On the API spans for a Messages API request, the token counts are the tokens that your organization is billed for, even when the request fails or the application cancels it. The SDK’s `anthropic.messages.create` span has the counts that the response reports instead, so for a failed or canceled request they can be lower than on the API span, or absent. To count each token once, see [how to count tokens in the guide](https://platform.claude.com/docs/en/manage-claude/opentelemetry#count-tokens).
133133
134| Attribute | Type | Description |
135| ---------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
136| `gen_ai.usage.input_tokens` | `int` | The input tokens, cache reads and writes included. |
137| `gen_ai.usage.output_tokens` | `int` | The output tokens. |
138| `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. |
139| `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. |
140| `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. |
141| `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. |
134| Attribute | Type | Description |
135| ----- | ----- | ----- |
136| `gen_ai.usage.input_tokens` | `int` | The input tokens, cache reads and writes included. |
137| `gen_ai.usage.output_tokens` | `int` | The output tokens. |
138| `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. |
139| `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. |
140| `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. |
141| `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. |
142142
143143## Spans
144144
from line 161
161161
162162The span has the [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage). The SDK span also has the attributes of every [SDK span for a request](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).
163163
164| Attribute | Type | Description |
165| ------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
166| `gen_ai.operation.name` | `string` | `chat` |
167| `gen_ai.request.model` | `string` | The request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
168| `gen_ai.response.id` | `string` | The response’s [`id`](https://platform.claude.com/docs/en/api/messages/create#message). |
169| `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. |
170| `anthropic.message.stop_reason` | `string` | The response’s [`stop_reason`](https://platform.claude.com/docs/en/api/messages#stop_reason), for example `end_turn`. |
171| `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). |
172| `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. |
173| `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. |
174| `gen_ai.usage.reasoning.output_tokens` | `int` | The thinking tokens, which are part of the output tokens. Absent when the thinking tokens aren’t counted separately from the other output tokens, for example on a model whose responses don’t have details for the output tokens. |
175| `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 request has no compaction. |
176| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request’s compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the request has no compaction. |
177| `gen_ai.request.max_tokens` | `int` | The request’s [`max_tokens`](https://platform.claude.com/docs/en/api/messages/create#create.max_tokens). |
178| `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. |
179| `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. |
180| `gen_ai.output.type` | `string` | `json` when the request sets the output format to JSON. Absent otherwise. |
181| `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. |
182| `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. |
183| `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. |
184| `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. |
185| `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. |
186| `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). |
187| `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. |
188| `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). |
164| Attribute | Type | Description |
165| ----- | ----- | ----- |
166| `gen_ai.operation.name` | `string` | `chat` |
167| `gen_ai.request.model` | `string` | The request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
168| `gen_ai.response.id` | `string` | The response’s [`id`](https://platform.claude.com/docs/en/api/messages/create#message). |
169| `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. |
170| `anthropic.message.stop_reason` | `string` | The response’s [`stop_reason`](https://platform.claude.com/docs/en/api/messages#stop_reason), for example `end_turn`. |
171| `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). |
172| `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. |
173| `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. |
174| `gen_ai.usage.reasoning.output_tokens` | `int` | The thinking tokens, which are part of the output tokens. Absent when the thinking tokens aren’t counted separately from the other output tokens, for example on a model whose responses don’t have details for the output tokens. |
175| `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 request has no compaction. |
176| `anthropic.usage.compaction.output_tokens` | `int` | Output tokens of the request’s compactions. Not part of `gen_ai.usage.output_tokens`. Absent when the request has no compaction. |
177| `gen_ai.request.max_tokens` | `int` | The request’s [`max_tokens`](https://platform.claude.com/docs/en/api/messages/create#create.max_tokens). |
178| `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. |
179| `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. |
180| `gen_ai.output.type` | `string` | `json` when the request sets the output format to JSON. Absent otherwise. |
181| `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. |
182| `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. |
183| `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. |
184| `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. |
185| `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. |
186| `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). |
187| `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. |
188| `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). |
189189
190190A 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.
191191
from line 196
196196* **Parent:** The span that is current in the application when it calls the method, or none if no span is current.
197197* **Children:** None.
198198
199| Attribute | Type | Description |
200| --------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
201| `gen_ai.request.model` | `string` | The request’s model. |
202| `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. |
199| Attribute | Type | Description |
200| ----- | ----- | ----- |
201| `gen_ai.request.model` | `string` | The request’s model. |
202| `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. |
203203
204204### `anthropic.sessions.create`
205205
from line 208
208208* **Children of the SDK span:** The API span for that request.
209209* **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).
210210
211| Attribute | Type | Description |
212| ---------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
213| `gen_ai.agent.id` | `string` | The ID of the agent that the session was created from. |
214| `gen_ai.agent.name` | `string` | That agent’s name.<br />**SDK:** Absent when the request failed. |
215| `gen_ai.request.model` | `string` | The model of that agent, which runs the primary thread.<br />**SDK:** Absent when the request failed. |
216| `anthropic.session.environment.id` | `string` | The ID of the session’s environment. |
211| Attribute | Type | Description |
212| ----- | ----- | ----- |
213| `gen_ai.agent.id` | `string` | The ID of the agent that the session was created from. |
214| `gen_ai.agent.name` | `string` | That agent’s name.<br />**SDK:** Absent when the request failed. |
215| `gen_ai.request.model` | `string` | The model of that agent, which runs the primary thread.<br />**SDK:** Absent when the request failed. |
216| `anthropic.session.environment.id` | `string` | The ID of the session’s environment. |
217217
218218### `anthropic.sessions.events.send`
219219
from line 253
253253
254254A turn starts when its thread enters the `running` state and ends when the thread leaves it.
255255
256| Attribute | Type | Description |
257| ------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
258| `gen_ai.operation.name` | `string` | `invoke_agent` |
259| `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. |
260| `gen_ai.agent.name` | `string` | That agent’s name. `anthropic.advisor` on an advisor thread. |
261| `gen_ai.request.model` | `string` | That agent’s model. On an advisor thread, the advisor’s model. |
262| `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. |
263| `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. |
264| `gen_ai.agent.description` | `string` | That agent’s description. Absent on an advisor thread or when the agent doesn’t have one. |
265| `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. |
266| `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. |
267| `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. |
256| Attribute | Type | Description |
257| ----- | ----- | ----- |
258| `gen_ai.operation.name` | `string` | `invoke_agent` |
259| `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. |
260| `gen_ai.agent.name` | `string` | That agent’s name. `anthropic.advisor` on an advisor thread. |
261| `gen_ai.request.model` | `string` | That agent’s model. On an advisor thread, the advisor’s model. |
262| `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. |
263| `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. |
264| `gen_ai.agent.description` | `string` | That agent’s description. Absent on an advisor thread or when the agent doesn’t have one. |
265| `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. |
266| `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. |
267| `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. |
268268
269269### `anthropic.model_request`
270270
from line 283
283283
284284The span has the [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage).
285285
286| Attribute | Type | Description |
287| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
288| `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. |
289| `gen_ai.request.model` | `string` | The request’s model. |
290| `gen_ai.response.model` | `string` | Only on the spans for Messages API requests. The model that ran the model request. |
291| `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. |
286| Attribute | Type | Description |
287| ----- | ----- | ----- |
288| `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. |
289| `gen_ai.request.model` | `string` | The request’s model. |
290| `gen_ai.response.model` | `string` | Only on the spans for Messages API requests. The model that ran the model request. |
291| `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. |
292292
293293### `anthropic.tool_use`, `anthropic.mcp_tool_use`, and `anthropic.custom_tool_use`
294294
from line 323
323323* **Managed Agents:** The agent uses a [multiagent](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration) tool or the [advisor tool](https://platform.claude.com/docs/en/managed-agents/multiagent-orchestration#give-the-session-an-advisor).
324324* **Managed Agents:** The agent asks to use a tool, but the server denies the use under the [`auto` permission policy](https://platform.claude.com/docs/en/managed-agents/permission-policies#let-the-server-evaluate-each-call-with-auto), or the application denies it in a [`user.tool_confirmation`](https://platform.claude.com/docs/en/api/beta/sessions/events#beta_managed_agents_user_tool_confirmation_event) event.
325325
326| Attribute | Type | Description |
327| ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
328| `gen_ai.operation.name` | `string` | `execute_tool` |
329| `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. |
330| `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. |
331| `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). |
332| `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. |
333| `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. |
334| `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. |
335| `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`. |
336| `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). |
337| `gen_ai.tool.description` | `string` | Only on SDK spans. The description in the tool definition. Absent when the description is empty. |
338| `gen_ai.tool.type` | `string` | Only on SDK spans. `function` |
339| `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). |
340| `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. |
326| Attribute | Type | Description |
327| ----- | ----- | ----- |
328| `gen_ai.operation.name` | `string` | `execute_tool` |
329| `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. |
330| `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. |
331| `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). |
332| `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. |
333| `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. |
334| `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. |
335| `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`. |
336| `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_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). |
337| `gen_ai.tool.description` | `string` | Only on SDK spans. The description in the tool definition. Absent when the description is empty. |
338| `gen_ai.tool.type` | `string` | Only on SDK spans. `function` |
339| `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). |
340| `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. |
341341
342342### `anthropic.compaction`
343343
from line 348
348348
349349The 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.
350350
351| Attribute | Type | Description |
352| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
353| `gen_ai.request.model` | `string` | The model requested for the compaction, which is the request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
351| Attribute | Type | Description |
352| ----- | ----- | ----- |
353| `gen_ai.request.model` | `string` | The model requested for the compaction, which is the request’s [`model`](https://platform.claude.com/docs/en/api/messages/create#create.model). |
354354| `gen_ai.response.model` | `string` | The model that ran the compaction. It differs from `gen_ai.request.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. |
355| `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. |
355| `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. |
356356
357357### `anthropic.session.outcome_evaluation`
358358
from line 365
365365
366366The span has two of the [token usage attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#token-usage): `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`.
367367
368| Attribute | Type | Description |
369| -------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
370| `anthropic.session.outcome.id` | `string` | The ID of the outcome that the iteration evaluates. |
371| `anthropic.session.outcome_evaluation.result` | `string` | The iteration’s result: `satisfied`, `needs_revision`, `max_iterations_reached`, `failed`, or `interrupted`. |
372| `anthropic.session.outcome_evaluation.iteration` | `int` | The iteration number. |
373| `anthropic.session.outcome_evaluation.explanation` | `string` | <Badge>Content</Badge> The grader’s explanation of the result, as plain text. |
368| Attribute | Type | Description |
369| ----- | ----- | ----- |
370| `anthropic.session.outcome.id` | `string` | The ID of the outcome that the iteration evaluates. |
371| `anthropic.session.outcome_evaluation.result` | `string` | The iteration’s result: `satisfied`, `needs_revision`, `max_iterations_reached`, `failed`, or `interrupted`. |
372| `anthropic.session.outcome_evaluation.iteration` | `int` | The iteration number. |
373| `anthropic.session.outcome_evaluation.explanation` | `string` | <Badge>Content</Badge> The grader’s explanation of the result, as plain text. |
374374
375375### `anthropic.messages.tool_runner`
376376
from line 381
381381
382382The 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.
383383
384| Attribute | Type | Description |
385| ------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
386| `gen_ai.operation.name` | `string` | `invoke_agent` |
387| `gen_ai.request.model` | `string` | The model of the loop’s first request. |
384| Attribute | Type | Description |
385| ----- | ----- | ----- |
386| `gen_ai.operation.name` | `string` | `invoke_agent` |
387| `gen_ai.request.model` | `string` | The model of the loop’s first request. |
388388| `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. |
389| `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. |
390| `gen_ai.output.type` | `string` | `json` when the requests set the output format to JSON. Absent otherwise. |
389| `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. |
390| `gen_ai.output.type` | `string` | `json` when the requests set the output format to JSON. Absent otherwise. |
391391
392392### `anthropic.messages.batches.<method>`
393393
from line 398
398398
399399The spans also have the attributes of every [SDK span for a request](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).
400400
401| Attribute | Type | Description |
402| --------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
403| `anthropic.message.batch.id` | `string` | The ID of the batch that the method acts on, or of the new batch for `create`. Absent on `list` and on a failed `create`. |
404| `anthropic.message.batch.request_count` | `int` | Only on `create`. The number of items in the [`requests`](https://platform.claude.com/docs/en/api/messages/batches/create#create.requests) array. |
401| Attribute | Type | Description |
402| ----- | ----- | ----- |
403| `anthropic.message.batch.id` | `string` | The ID of the batch that the method acts on, or of the new batch for `create`. Absent on `list` and on a failed `create`. |
404| `anthropic.message.batch.request_count` | `int` | Only on `create`. The number of items in the [`requests`](https://platform.claude.com/docs/en/api/messages/batches/create#create.requests) array. |
405405
406406### `anthropic.sessions.<method>`
407407
from line 415
415415The 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.
416416
417417<Accordion title="Span names and endpoints">
418 | Span | Endpoint |
419 | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
420 | `anthropic.sessions.create` | [`POST /v1/sessions`](https://platform.claude.com/docs/en/api/beta/sessions/create) |
421 | `anthropic.sessions.list` | [`GET /v1/sessions`](https://platform.claude.com/docs/en/api/beta/sessions/list) |
422 | `anthropic.sessions.retrieve` | [`GET /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/retrieve) |
423 | `anthropic.sessions.update` | [`POST /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/update) |
424 | `anthropic.sessions.delete` | [`DELETE /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/delete) |
425 | `anthropic.sessions.archive` | [`POST /v1/sessions/{session_id}/archive`](https://platform.claude.com/docs/en/api/beta/sessions/archive) |
426 | `anthropic.sessions.events.send` | [`POST /v1/sessions/{session_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/events/send) |
427 | `anthropic.sessions.events.list` | [`GET /v1/sessions/{session_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/events/list) |
428 | `anthropic.sessions.events.stream` | [`GET /v1/sessions/{session_id}/events/stream`](https://platform.claude.com/docs/en/api/beta/sessions/events/stream) |
429 | `anthropic.sessions.resources.add` | [`POST /v1/sessions/{session_id}/resources`](https://platform.claude.com/docs/en/api/beta/sessions/resources/add) |
430 | `anthropic.sessions.resources.list` | [`GET /v1/sessions/{session_id}/resources`](https://platform.claude.com/docs/en/api/beta/sessions/resources/list) |
431 | `anthropic.sessions.resources.retrieve` | [`GET /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/retrieve) |
432 | `anthropic.sessions.resources.update` | [`POST /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/update) |
433 | `anthropic.sessions.resources.delete` | [`DELETE /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/delete) |
434 | `anthropic.sessions.threads.list` | [`GET /v1/sessions/{session_id}/threads`](https://platform.claude.com/docs/en/api/beta/sessions/threads/list) |
435 | `anthropic.sessions.threads.retrieve` | [`GET /v1/sessions/{session_id}/threads/{thread_id}`](https://platform.claude.com/docs/en/api/beta/sessions/threads/retrieve) |
436 | `anthropic.sessions.threads.archive` | [`POST /v1/sessions/{session_id}/threads/{thread_id}/archive`](https://platform.claude.com/docs/en/api/beta/sessions/threads/archive) |
437 | `anthropic.sessions.threads.events.list` | [`GET /v1/sessions/{session_id}/threads/{thread_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/threads/events/list) |
418 | Span | Endpoint |
419 | ----- | ----- |
420 | `anthropic.sessions.create` | [`POST /v1/sessions`](https://platform.claude.com/docs/en/api/beta/sessions/create) |
421 | `anthropic.sessions.list` | [`GET /v1/sessions`](https://platform.claude.com/docs/en/api/beta/sessions/list) |
422 | `anthropic.sessions.retrieve` | [`GET /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/retrieve) |
423 | `anthropic.sessions.update` | [`POST /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/update) |
424 | `anthropic.sessions.delete` | [`DELETE /v1/sessions/{session_id}`](https://platform.claude.com/docs/en/api/beta/sessions/delete) |
425 | `anthropic.sessions.archive` | [`POST /v1/sessions/{session_id}/archive`](https://platform.claude.com/docs/en/api/beta/sessions/archive) |
426 | `anthropic.sessions.events.send` | [`POST /v1/sessions/{session_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/events/send) |
427 | `anthropic.sessions.events.list` | [`GET /v1/sessions/{session_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/events/list) |
428 | `anthropic.sessions.events.stream` | [`GET /v1/sessions/{session_id}/events/stream`](https://platform.claude.com/docs/en/api/beta/sessions/events/stream) |
429 | `anthropic.sessions.resources.add` | [`POST /v1/sessions/{session_id}/resources`](https://platform.claude.com/docs/en/api/beta/sessions/resources/add) |
430 | `anthropic.sessions.resources.list` | [`GET /v1/sessions/{session_id}/resources`](https://platform.claude.com/docs/en/api/beta/sessions/resources/list) |
431 | `anthropic.sessions.resources.retrieve` | [`GET /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/retrieve) |
432 | `anthropic.sessions.resources.update` | [`POST /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/update) |
433 | `anthropic.sessions.resources.delete` | [`DELETE /v1/sessions/{session_id}/resources/{resource_id}`](https://platform.claude.com/docs/en/api/beta/sessions/resources/delete) |
434 | `anthropic.sessions.threads.list` | [`GET /v1/sessions/{session_id}/threads`](https://platform.claude.com/docs/en/api/beta/sessions/threads/list) |
435 | `anthropic.sessions.threads.retrieve` | [`GET /v1/sessions/{session_id}/threads/{thread_id}`](https://platform.claude.com/docs/en/api/beta/sessions/threads/retrieve) |
436 | `anthropic.sessions.threads.archive` | [`POST /v1/sessions/{session_id}/threads/{thread_id}/archive`](https://platform.claude.com/docs/en/api/beta/sessions/threads/archive) |
437 | `anthropic.sessions.threads.events.list` | [`GET /v1/sessions/{session_id}/threads/{thread_id}/events`](https://platform.claude.com/docs/en/api/beta/sessions/threads/events/list) |
438438 | `anthropic.sessions.threads.events.stream` | [`GET /v1/sessions/{session_id}/threads/{thread_id}/stream`](https://platform.claude.com/docs/en/api/beta/sessions/threads/events/stream) |
439439</Accordion>
440440
441441The span has the [session attributes](https://platform.claude.com/docs/en/api/opentelemetry/spans#session-attributes). The SDK span also has the attributes of every [SDK span for a request](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-resources-method).
442442
443| Attribute | Type | Description |
444| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
443| Attribute | Type | Description |
444| ----- | ----- | ----- |
445445| `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. |
446446
447447### `anthropic.environment.work`
from line 453
453453
454454The environment worker and the work poller are the [SDK helpers](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes#sdk-helpers) that claim work items in a self-hosted sandbox. They emit one `anthropic.environment.work` span for each work item, from when a poll returns the work item until its handling ends.
455455
456| Attribute | Type | Description |
457| ------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
458| `anthropic.environment.id` | `string` | The environment ID. |
459| `anthropic.environment.work.id` | `string` | The work item ID. |
460| `anthropic.session.id` | `string` | The ID of the session that the work item belongs to. |
461| `error.type` | `string` | The `error.type` of the span for the failed request, if a request ended the handling. `client_error` for any other failure. |
456| Attribute | Type | Description |
457| ----- | ----- | ----- |
458| `anthropic.environment.id` | `string` | The environment ID. |
459| `anthropic.environment.work.id` | `string` | The work item ID. |
460| `anthropic.session.id` | `string` | The ID of the session that the work item belongs to. |
461| `error.type` | `string` | The `error.type` of the span for the failed request, if a request ended the handling. `client_error` for any other failure. |
462462
463463### `anthropic.<resources>.<method>`
464464
from line 473
473473
474474Every SDK span for a request, including [`anthropic.messages.create`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-create), [`anthropic.messages.count_tokens`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-count-tokens), and [`anthropic.messages.batches.<method>`](https://platform.claude.com/docs/en/api/opentelemetry/spans#anthropic-messages-batches-method), has the following attributes:
475475
476| Attribute | Type | Description |
477| --------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
478| `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. |
479| `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`. |
480| `gen_ai.agent.id` | `string` | The agent ID, on the agent methods. |
481| `gen_ai.memory.store.id` | `string` | The memory store ID, on the memory store methods. |
482| `gen_ai.memory.record.id` | `string` | The memory ID, on the memory methods. |
483| `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. |
484| `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. |
485| `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. |
486| `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`. |
487| `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`. |
476| Attribute | Type | Description |
477| ----- | ----- | ----- |
478| `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. |
479| `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`. |
480| `gen_ai.agent.id` | `string` | The agent ID, on the agent methods. |
481| `gen_ai.memory.store.id` | `string` | The memory store ID, on the memory store methods. |
482| `gen_ai.memory.record.id` | `string` | The memory ID, on the memory methods. |
483| `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. |
484| `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. |
485| `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. |
486| `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`. |
487| `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`. |
488488
No line in this hunk matches that.