The Open Framework for Building Agents
fix(eve): emit schema-4 tool attribute names from the tracing library (#4718)
Chad Hietala485d0f54478a
diff --git a/.changeset/schema4-tool-names.md b/.changeset/schema4-tool-names.mdnew file mode 100644index 000000000..1dd8de017--- /dev/null+++ b/.changeset/schema4-tool-names.md@@ -0,0 +1,5 @@+---+"eve": patch+---++The agent tracing library now writes schema 4's `agent.action.kind`, `agent.action.name`, and `agent.action.outcome` on tool and approval spans itself, so hosts other than eve render correctly in Agent Runs. eve's trace output is unchanged.diff --git a/packages/eve/src/tracing/eve/profile.ts b/packages/eve/src/tracing/eve/profile.tsindex 58269bdb5..d97a47fc6 100644--- a/packages/eve/src/tracing/eve/profile.ts+++ b/packages/eve/src/tracing/eve/profile.ts@@ -1,12 +1,6 @@import type { Attributes, MappingContext, OutputMapping } from "#compiled/@eve/tracing/index.js";import { currentTraceSessionId } from "#tracing/eve/agent-trace-context-store.js";-/** eve publishes tool call kind and outcome under its schema-4 `agent.action.*` names. */-const TOOL_ATTRIBUTES: Readonly<Record<string, string>> = {- "agent.tool.kind": "agent.action.kind",- "agent.tool.outcome": "agent.action.outcome",-};-export function eveOutputMapping(options?: {readonly resolve: (span: MappingContext) => {readonly traceSessionId?: string;@@ -18,18 +12,12 @@ export function eveOutputMapping(options?: {const output: Record<string, Attributes[string]> = {};for (const [key, value] of Object.entries(attributes)) {if (key === "agent.connection.name") output["eve.connection.name"] = value;- else if (span.type === "tool" && TOOL_ATTRIBUTES[key] !== undefined)- output[TOOL_ATTRIBUTES[key]] = value;- else if (span.type === "approval" && key === "gen_ai.tool.name")- output["agent.action.name"] = value;else if (span.type === "channelRequest" && key === "agent.channel.name")output["eve.channel.name"] = value;else if (span.type === "channelRequest" && key === "agent.channel.kind")output["eve.channel.kind"] = value;else output[key] = value;}- if (span.type === "tool" && attributes["agent.tool.kind"] !== undefined)- output["agent.action.name"] = attributes["gen_ai.tool.name"];if (attributes["agent.run.id"] !== undefined) {const context = options?.resolve(span) ?? {platform: process.env.VERCEL_ENV === undefined ? "other" : "vercel",diff --git a/packages/tracing/README.md b/packages/tracing/README.mdindex a2bc63931..c43c9757f 100644--- a/packages/tracing/README.md+++ b/packages/tracing/README.md@@ -57,6 +57,8 @@ metadata only. Child operations cannot increase capture.When inputs or outputs are captured, a turn's span records its first model call's input as `gen_ai.input.messages` and its latest model output as `gen_ai.output.messages`.+Tool and approval spans use schema 4's names: a call with a `kind` records `agent.action.kind` and `agent.action.name`, an explicit outcome records `agent.action.outcome`, and approvals record `agent.action.name`.+Attempts provide `tool`, `callSubAgent`, and `callRemoteAgent`; each tool call isone `execute_tool` span. Tools provide `approval` and nested `tool` calls. Turns,attempts, and tools provide `memory`.diff --git a/packages/tracing/src/core/span-kinds.ts b/packages/tracing/src/core/span-kinds.tsindex b649be592..e27bce3a2 100644--- a/packages/tracing/src/core/span-kinds.ts+++ b/packages/tracing/src/core/span-kinds.ts@@ -214,7 +214,8 @@ const kinds: { [K in ScopeData["type"]]: Kind<K> } = {"gen_ai.tool.call.id": options.callId,"gen_ai.tool.name": options.name,"gen_ai.tool.type": "function",- "agent.tool.kind": options.kind,+ "agent.action.kind": options.kind,+ "agent.action.name": options.kind === undefined ? undefined : options.name,"agent.invocation.role": delegates ? "caller" : undefined,...toolInput(options.arguments, context),},@@ -222,7 +223,7 @@ const kinds: { [K in ScopeData["type"]]: Kind<K> } = {},complete(span, _data, result, context) {if (result.outcome !== undefined)- applyAttributes(span, { "agent.tool.outcome": result.outcome });+ applyAttributes(span, { "agent.action.outcome": result.outcome });toolOutput(span, result, context);},redact(data, capture) {@@ -243,7 +244,7 @@ const kinds: { [K in ScopeData["type"]]: Kind<K> } = {...namingAttributes(SPAN_NAMES.approval, "workflow"),"gen_ai.operation.name": "workflow","gen_ai.tool.call.id": options.callId,- "gen_ai.tool.name": options.toolName,+ "agent.action.name": options.toolName,"agent.approval.kind": "tool-approval","agent.approval.request_id": options.requestId,[CONTENT_FIELDS.approvalRequest]: context.capture.recordInputsdiff --git a/packages/tracing/src/durable.integration.test.ts b/packages/tracing/src/durable.integration.test.tsindex 38703a8a9..8026ad774 100644--- a/packages/tracing/src/durable.integration.test.ts+++ b/packages/tracing/src/durable.integration.test.ts@@ -159,8 +159,9 @@ describe("durable agent tracing", () => {const tool = spans.get("execute_tool lookup")!;expect(tool.startTime[0] * 1000 + tool.startTime[1] / 1e6).toBeCloseTo(requestedAt, -1);expect(tool.attributes).toMatchObject({- "agent.tool.kind": "subagent-call",- "agent.tool.outcome": "completed",+ "agent.action.kind": "subagent-call",+ "agent.action.name": "lookup",+ "agent.action.outcome": "completed","agent.invocation.role": "caller",});expect(spans.get("execute_tool inner")!.parentSpanContext?.spanId).toBe(diff --git a/research/agent-tracing-library.md b/research/agent-tracing-library.mdindex 2b316beac..4d1369453 100644--- a/research/agent-tracing-library.md+++ b/research/agent-tracing-library.md@@ -258,8 +258,6 @@ with each workflow step. eve keeps these concerns:- session trace seeds, turn ID reservation, and trace policy;- channel delivery metadata and principals;- tool call locators and anchors that dispatched child agents read;-- schema-4 attribute names, such as `agent.action.kind` for the library's- `agent.tool.kind`, through its output mapping;- direct `invokeTool` spans, which have no turn;- SDK registration, request and MCP spans, and local trace storage.