Skip to main content

Module trace

Module trace 

Source
Expand description

Dispatch trace records.

DispatchTrace is an additive, deterministic record of what happened during a dispatch_tool_invocations_with_trace call: each hook’s decision, the eventual invocation outcome, errors, and reservation cleanups. Hosts use it to explain a tool-loop replay or to export structured policy traces without depending on a concrete tracing backend.

§Example

use rig_compose::{
    DispatchTrace, ToolRegistry, dispatch_tool_invocations_with_trace,
};

let trace = DispatchTrace::new();
let _results =
    dispatch_tool_invocations_with_trace(&registry, &invocations, &[], &trace).await?;
for event in trace.events() {
    tracing::debug!(?event, "dispatch trace event");
}

Structs§

DispatchTrace
Append-only collector for DispatchTraceEvent values.

Enums§

DispatchTraceEvent
One observable event within a dispatch trace. Events are pushed in order; invocation_index and hook_index refer to positions in the slices passed to dispatch_tool_invocations_with_trace.
TracedAction
Lightweight projection of ToolDispatchAction suitable for trace recording. Decouples the trace shape from the runtime action enum so adding fields to ToolDispatchAction does not silently widen trace records.
TracedOutcome
Final outcome recorded for one invocation.