Skip to content

Commit 7805efb

Browse files
nicohrubecclaude
andcommitted
ref(core)!: Rename gen_ai.tool.output to gen_ai.tool.call.result
Emit the `gen_ai.tool.call.result` attribute from `@sentry/conventions` instead of the deprecated `gen_ai.tool.output` alias across all AI integrations (LangChain, LangGraph, Vercel AI). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 44e58d8 commit 7805efb

10 files changed

Lines changed: 19 additions & 19 deletions

File tree

MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ Affected SDKs: All SDKs.
255255
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
256256
- The `gen_ai.request.available_tools` span attribute was renamed to `gen_ai.tool.definitions` across all AI integrations.
257257
- The `gen_ai.tool.input` span attribute was renamed to `gen_ai.tool.call.arguments` across all AI integrations.
258+
- The `gen_ai.tool.output` span attribute was renamed to `gen_ai.tool.call.result` across all AI integrations.
258259
- Span attributes now use the shared `@sentry/conventions` package under the hood.
259260

260261
If you reference these attributes in custom instrumentation, `beforeSendSpan`, dashboards, or alerts, update them to the new names.

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
99
GEN_AI_TOOL_CALL_ARGUMENTS,
10+
GEN_AI_TOOL_CALL_RESULT,
1011
GEN_AI_TOOL_DEFINITIONS,
1112
GEN_AI_TOOL_DESCRIPTION,
1213
GEN_AI_TOOL_NAME,
13-
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
1515
GEN_AI_USAGE_INPUT_TOKENS,
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -235,7 +235,7 @@ describe('Vercel AI integration (streaming v4)', () => {
235235
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
236236
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
237237
[GEN_AI_TOOL_NAME]: attr('getWeather'),
238-
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
238+
[GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }),
239239
[GEN_AI_TOOL_TYPE]: attr('function'),
240240
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
241241
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
99
GEN_AI_TOOL_CALL_ARGUMENTS,
10+
GEN_AI_TOOL_CALL_RESULT,
1011
GEN_AI_TOOL_DEFINITIONS,
1112
GEN_AI_TOOL_DESCRIPTION,
1213
GEN_AI_TOOL_NAME,
13-
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
1515
GEN_AI_USAGE_INPUT_TOKENS,
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -229,7 +229,7 @@ describe('Vercel AI integration (streaming, v6)', () => {
229229
[GEN_AI_TOOL_DESCRIPTION]: attr('Get the current weather for a location'),
230230
[GEN_AI_TOOL_CALL_ARGUMENTS]: expect.objectContaining({ value: expect.any(String) }),
231231
[GEN_AI_TOOL_NAME]: attr('getWeather'),
232-
[GEN_AI_TOOL_OUTPUT]: expect.objectContaining({ value: expect.any(String) }),
232+
[GEN_AI_TOOL_CALL_RESULT]: expect.objectContaining({ value: expect.any(String) }),
233233
[GEN_AI_TOOL_TYPE]: attr('function'),
234234
[GEN_AI_OPERATION_NAME]: attr('execute_tool'),
235235
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: attr('gen_ai.execute_tool'),

dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
GEN_AI_RESPONSE_MODEL,
1111
GEN_AI_SYSTEM_INSTRUCTIONS,
1212
GEN_AI_TOOL_CALL_ARGUMENTS,
13+
GEN_AI_TOOL_CALL_RESULT,
1314
GEN_AI_TOOL_DEFINITIONS,
1415
GEN_AI_TOOL_DESCRIPTION,
1516
GEN_AI_TOOL_NAME,
16-
GEN_AI_TOOL_OUTPUT,
1717
GEN_AI_TOOL_TYPE,
1818
GEN_AI_USAGE_INPUT_TOKENS,
1919
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -242,7 +242,7 @@ describe('Vercel AI integration (v4)', () => {
242242
'Get the current weather for a location',
243243
);
244244
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
245-
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
245+
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_RESULT]).toBeDefined();
246246
},
247247
})
248248
.start()

dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
GEN_AI_REQUEST_MODEL,
88
GEN_AI_RESPONSE_MODEL,
99
GEN_AI_TOOL_CALL_ARGUMENTS,
10+
GEN_AI_TOOL_CALL_RESULT,
1011
GEN_AI_TOOL_DEFINITIONS,
1112
GEN_AI_TOOL_DESCRIPTION,
1213
GEN_AI_TOOL_NAME,
13-
GEN_AI_TOOL_OUTPUT,
1414
GEN_AI_TOOL_TYPE,
1515
GEN_AI_USAGE_INPUT_TOKENS,
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -248,7 +248,7 @@ describe('Vercel AI integration (v5)', () => {
248248
'Get the current weather for a location',
249249
);
250250
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
251-
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
251+
expect(toolExecutionSpan!.attributes[GEN_AI_TOOL_CALL_RESULT]).toBeDefined();
252252
},
253253
})
254254
.start()

dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import {
1111
GEN_AI_RESPONSE_MODEL,
1212
GEN_AI_SYSTEM_INSTRUCTIONS,
1313
GEN_AI_TOOL_CALL_ARGUMENTS,
14+
GEN_AI_TOOL_CALL_RESULT,
1415
GEN_AI_TOOL_DEFINITIONS,
1516
GEN_AI_TOOL_DESCRIPTION,
1617
GEN_AI_TOOL_NAME,
17-
GEN_AI_TOOL_OUTPUT,
1818
GEN_AI_TOOL_TYPE,
1919
GEN_AI_USAGE_INPUT_TOKENS,
2020
GEN_AI_USAGE_INPUT_TOKENS_CACHED,
@@ -151,7 +151,7 @@ describe.each(matrix)('Vercel AI integration (version %s)', (version, vercelAiVe
151151
'Get the current weather for a location',
152152
);
153153
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_ARGUMENTS]).toBeDefined();
154-
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_OUTPUT]).toBeDefined();
154+
expect(toolExecutionSpan.attributes[GEN_AI_TOOL_CALL_RESULT]).toBeDefined();
155155
},
156156
})
157157
.start()

packages/core/src/tracing/langchain/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable typescript-eslint/no-deprecated */
21
/* eslint-disable max-lines */
32
import { captureException } from '../../exports';
43
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '../../semanticAttributes';
@@ -9,9 +8,9 @@ import {
98
GEN_AI_OPERATION_NAME,
109
GEN_AI_REQUEST_MODEL,
1110
GEN_AI_TOOL_CALL_ARGUMENTS,
11+
GEN_AI_TOOL_CALL_RESULT,
1212
GEN_AI_TOOL_DEFINITIONS,
1313
GEN_AI_TOOL_NAME,
14-
GEN_AI_TOOL_OUTPUT,
1514
} from '@sentry/conventions/attributes';
1615
import { resolveAIRecordingOptions, shouldEnableTruncation } from '../ai/utils';
1716
import { LANGCHAIN_ORIGIN } from './constants';
@@ -328,7 +327,7 @@ export function createLangChainCallbackHandler(options: LangChainOptions = {}):
328327
const content =
329328
outputObj && typeof outputObj === 'object' && 'content' in outputObj ? outputObj.content : output;
330329
span.setAttributes({
331-
[GEN_AI_TOOL_OUTPUT]: typeof content === 'string' ? content : JSON.stringify(content),
330+
[GEN_AI_TOOL_CALL_RESULT]: typeof content === 'string' ? content : JSON.stringify(content),
332331
});
333332
}
334333
exitSpan(runId);

packages/core/src/tracing/langgraph/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import {
1111
GEN_AI_RESPONSE_TEXT,
1212
GEN_AI_RESPONSE_TOOL_CALLS,
1313
GEN_AI_TOOL_CALL_ARGUMENTS,
14+
GEN_AI_TOOL_CALL_RESULT,
1415
GEN_AI_TOOL_DESCRIPTION,
1516
GEN_AI_TOOL_NAME,
16-
GEN_AI_TOOL_OUTPUT,
1717
GEN_AI_TOOL_TYPE,
1818
GEN_AI_USAGE_INPUT_TOKENS,
1919
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -130,7 +130,7 @@ export function wrapToolsWithSpans(tools: unknown[], options: LangGraphOptions,
130130
const content =
131131
resultObj && typeof resultObj === 'object' && 'content' in resultObj ? resultObj.content : result;
132132
span.setAttribute(
133-
GEN_AI_TOOL_OUTPUT,
133+
GEN_AI_TOOL_CALL_RESULT,
134134
typeof content === 'string' ? content : JSON.stringify(content),
135135
);
136136
} catch {

packages/core/src/tracing/vercel-ai/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import {
1919
GEN_AI_REQUEST_MODEL,
2020
GEN_AI_RESPONSE_MODEL,
2121
GEN_AI_TOOL_CALL_ARGUMENTS,
22+
GEN_AI_TOOL_CALL_RESULT,
2223
GEN_AI_TOOL_DEFINITIONS,
2324
GEN_AI_TOOL_DESCRIPTION,
2425
GEN_AI_TOOL_NAME,
25-
GEN_AI_TOOL_OUTPUT,
2626
GEN_AI_TOOL_TYPE,
2727
GEN_AI_USAGE_INPUT_TOKENS,
2828
GEN_AI_USAGE_INPUT_TOKENS_CACHED,
@@ -320,7 +320,7 @@ export function processVercelAiSpanAttributes(attributes: Record<string, unknown
320320
renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, GEN_AI_TOOL_DEFINITIONS);
321321

322322
renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, GEN_AI_TOOL_CALL_ARGUMENTS);
323-
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, GEN_AI_TOOL_OUTPUT);
323+
renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, GEN_AI_TOOL_CALL_RESULT);
324324

325325
renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, 'gen_ai.request.schema');
326326
renameAttributeKey(attributes, AI_MODEL_ID_ATTRIBUTE, GEN_AI_REQUEST_MODEL);

packages/server-utils/src/vercel-ai/vercel-ai-dc-subscriber.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import {
1414
GEN_AI_RESPONSE_STREAMING,
1515
GEN_AI_SYSTEM_INSTRUCTIONS,
1616
GEN_AI_TOOL_CALL_ARGUMENTS,
17+
GEN_AI_TOOL_CALL_RESULT,
1718
GEN_AI_TOOL_DEFINITIONS,
1819
GEN_AI_TOOL_NAME,
19-
GEN_AI_TOOL_OUTPUT,
2020
GEN_AI_TOOL_TYPE,
2121
GEN_AI_USAGE_INPUT_TOKENS,
2222
GEN_AI_USAGE_OUTPUT_TOKENS,
@@ -509,7 +509,7 @@ export function enrichSpanOnEnd(
509509

510510
if (type === 'executeTool') {
511511
if (recordOutputs) {
512-
span.setAttribute(GEN_AI_TOOL_OUTPUT, stringify(result.output ?? result));
512+
span.setAttribute(GEN_AI_TOOL_CALL_RESULT, stringify(result.output ?? result));
513513
}
514514
// From V5 on, tool errors are not rejected (so the `error` channel verb never fires) — they
515515
// surface as `tool-error` content on the resolved result. Mirror the OTel path by marking the

0 commit comments

Comments
 (0)