execute_tool span carrying the tool name,
the arguments, the tool-call id, and the result. String arguments and
results are recorded as-is; other JSON values are serialized.
Created by weave.startTool() (or turn.startTool(), or
llm.startTool()) and terminated with end(), which accepts the result and
optional error metadata.
Example
Extends
SpanBase
Properties
args
readonlyargs:string
name
readonlyname:string
result
Tool output as a string. Prefer passingoptionalresult:string
result to end().
toolCallId
readonlytoolCallId: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.
Parameters
string
required
Attributes
TimeInput
Returns
this
Example
Inherited from
SpanBase.addEvent
end()
end(Record an optional result and error type, then close the span. Idempotent. Passopts?):void
error to mark the span as failed and endTime to backdate the close.
Parameters
ToolEndOptions
See
ToolEndOptions.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).
Parameters
Attributes
required
Returns
this
Example
Inherited from
SpanBase.setAttributes