pub struct ToolSpan {
pub id: String,
pub name: String,
pub started_at: SystemTime,
pub duration_ms: Option<u64>,
pub sidechain: bool,
pub error: bool,
pub kind: SpanKind,
}Expand description
One span of an agent trace: a tool call, an inference, or a turn.
Every harness writes the same shape in its own vocabulary — Claude pairs a
tool_use block with a tool_result block by tool_use_id, Codex pairs a
function_call with a function_call_output by call_id — and both stamp
each line with a timestamp. That is a span: a name, a start and a duration.
Only the call’s metadata is kept; arguments and output are never read.
The name predates kind: the type carried only tool calls until 0.3.1 and
is kept for the sake of the published API.
Fields§
§id: StringThe harness’s own call id, so a span survives across refreshes. For inference and turn spans, a counter the parser assigns.
name: StringTool name as the harness reports it (Bash, exec_command, …), or
inference / turn.
started_at: SystemTime§duration_ms: Option<u64>Wall-clock duration, or None while the call is still in flight.
sidechain: boolThe call was issued by a subagent (Claude’s isSidechain).
error: boolThe harness reported the result as an error.
kind: SpanKindAbsent in snapshots written before 0.3.1, which held tool calls only.
Implementations§
Source§impl ToolSpan
impl ToolSpan
pub fn is_open(&self) -> bool
Sourcepub fn elapsed_ms(&self, now: SystemTime) -> u64
pub fn elapsed_ms(&self, now: SystemTime) -> u64
Duration if closed, otherwise how long it has been running as of now.