execute_tool span carrying the tool name,
the JSON-encoded arguments, the tool-call id, and the result.
Created by weave.startTool() (or turn.startTool(), or
llm.startTool()) and terminated with end(). Assign result before
calling end() to record the tool’s output on the span.
Defined in: src/genai/tool.ts:43
Example
Extends
SpanBase
Properties
args
Defined in: src/genai/tool.ts:52readonlyargs:string
name
Defined in: src/genai/tool.ts:51readonlyname:string
result
Tool output as a string. Recorded onoptionalresult:string
gen_ai.tool.call.result at end().
Defined in: src/genai/tool.ts:47
toolCallId
Defined in: src/genai/tool.ts:53readonlytoolCallId:string
Methods
addEvent()
addEvent(Add a named event to the span. Useful for marking non-span moments such as context compaction, tool-loop detection, or guardrail trips. Warns and no-ops aftername,attributes?,startTime?):this
end(). Mirrors OTel Span.addEvent.
Defined in: src/genai/spanBase.ts:82
Parameters
name
string
attributes?
Attributes
startTime?
TimeInput
Returns
this
Example
Inherited from
SpanBase.addEvent
end()
end(Flushopts?):void
result to the span and close it. Idempotent. Pass error to mark
the span as failed; pass endTime to backdate the close.
Defined in: src/genai/tool.ts:87
Parameters
opts?
SpanEndOptions
Returns
void
setAttributes()
setAttributes(Set multiple attributes on the span at once. Warns and no-ops afterattributes):this
end(). Mirrors OTel Span.setAttributes (and the Python SDK’s
set_attributes).
Defined in: src/genai/spanBase.ts:63
Parameters
attributes
Attributes
Returns
this
Example
Inherited from
SpanBase.setAttributes