From 66d8b5403901f1cde815b4ba4f9cc47547eb6dc4 Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Wed, 8 Apr 2026 08:24:28 -0400 Subject: [PATCH] ref: Remove gen_ai.tool.type assertions from test framework Remove all references to the gen_ai.tool.type attribute: - Remove from checkToolSpanAttributes assertion - Remove type field from ExpectedToolCall interface and checkToolCalls validation - Remove type: "function" from tool-call test expectations - Remove gen_ai.tool.type setAttribute/set_data from manual agent templates Refs PY-2284 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../templates/agents/node/manual/template.njk | 1 - .../templates/agents/python/manual/template.njk | 1 - src/test-cases/agents/tool-call.ts | 2 -- src/test-cases/checks.ts | 15 --------------- 4 files changed, 19 deletions(-) diff --git a/src/runner/templates/agents/node/manual/template.njk b/src/runner/templates/agents/node/manual/template.njk index 44f8e8f..443d3ff 100644 --- a/src/runner/templates/agents/node/manual/template.njk +++ b/src/runner/templates/agents/node/manual/template.njk @@ -186,7 +186,6 @@ const TOOLS = {{ agent.tools | dump }}; toolSpan.setAttribute("gen_ai.operation.name", "execute_tool"); toolSpan.setAttribute("gen_ai.agent.name", AGENT_NAME); toolSpan.setAttribute("gen_ai.tool.name", "{{ tool.name }}"); - toolSpan.setAttribute("gen_ai.tool.type", "function"); toolSpan.setAttribute("gen_ai.tool.description", "{{ tool.description }}"); const toolInputJson{{ turnIndex }}_{{ loop.index }} = JSON.stringify({{ tool.arguments | dump }}); diff --git a/src/runner/templates/agents/python/manual/template.njk b/src/runner/templates/agents/python/manual/template.njk index 37b85aa..c6d940a 100644 --- a/src/runner/templates/agents/python/manual/template.njk +++ b/src/runner/templates/agents/python/manual/template.njk @@ -183,7 +183,6 @@ TOOLS = {{ agent.tools | dump }} tool_span.set_data("gen_ai.operation.name", "execute_tool") tool_span.set_data("gen_ai.agent.name", AGENT_NAME) tool_span.set_data("gen_ai.tool.name", "{{ tool.name }}") - tool_span.set_data("gen_ai.tool.type", "function") tool_span.set_data("gen_ai.tool.description", "{{ tool.description }}") tool_input_json = json.dumps({{ tool.arguments | dump }}) diff --git a/src/test-cases/agents/tool-call.ts b/src/test-cases/agents/tool-call.ts index 6a1acc4..e9d9a50 100644 --- a/src/test-cases/agents/tool-call.ts +++ b/src/test-cases/agents/tool-call.ts @@ -107,14 +107,12 @@ export const toolCallAgentTest: TestDefinition = { checkToolCalls([ { name: "add", - type: "function", description: "Add two numbers together", input: { a: 3, b: 5 }, output: 8, }, { name: "multiply", - type: "function", description: "Multiply two numbers together", input: { a: 8, b: 4 }, output: 32, diff --git a/src/test-cases/checks.ts b/src/test-cases/checks.ts index 4bd09ef..b3734c7 100644 --- a/src/test-cases/checks.ts +++ b/src/test-cases/checks.ts @@ -225,7 +225,6 @@ export const checkAgentSpanAttributes: Check = { * Validates: * - description equals " " * - gen_ai.operation.name matches TOOL_OPERATION_NAME_PATTERN - * - gen_ai.tool.type exists * - gen_ai.tool.name exists * - gen_ai.tool.description exists * @@ -243,7 +242,6 @@ export const checkToolSpanAttributes: Check = { "description": (span) => `${span.data?.["gen_ai.operation.name"]} ${span.data?.["gen_ai.tool.name"]}`, "gen_ai.operation.name": TOOL_OPERATION_NAME_PATTERN, - "gen_ai.tool.type": true, "gen_ai.tool.name": true, "gen_ai.tool.description": true, }); @@ -256,8 +254,6 @@ export const checkToolSpanAttributes: Check = { export interface ExpectedToolCall { /** Tool name to match */ name: string; - /** Expected tool type (e.g., "function") */ - type?: string; /** Expected tool description */ description?: string; /** Expected input arguments (parsed from gen_ai.tool.input JSON) */ @@ -276,7 +272,6 @@ export interface ExpectedToolCall { * // Check a single tool call * checkToolCalls([{ * name: "add", - * type: "function", * description: "Add two numbers together", * input: { a: 4, b: 7 }, * output: 11, @@ -317,16 +312,6 @@ export function checkToolCalls(expectedTools: ExpectedToolCall[]): Check { continue; } - // Validate type if specified - if (expected.type !== undefined) { - const actual = toolSpan.data?.["gen_ai.tool.type"]; - if (actual !== expected.type) { - const msg = `Tool "${expected.name}" should have type "${expected.type}" but has "${actual}"`; - errors.push(msg); - locations.push({ spanId: toolSpan.span_id, attribute: "gen_ai.tool.type", message: msg }); - } - } - // Validate description if specified if (expected.description !== undefined) { const actual = toolSpan.data?.["gen_ai.tool.description"];