Skip to main content

EventKind

Enum EventKind 

Source
#[non_exhaustive]
pub enum EventKind {
Show 23 variants PromptStarted { model: String, messages_in: usize, }, PromptCompleted { model: String, tokens_in: Option<u64>, tokens_out: Option<u64>, response_id: Option<String>, previous_response_id: Option<String>, }, ToolInvoked { tool_name: String, provider_call_id: Option<String>, call_id: String, args_json: String, truncated: bool, }, ToolCompleted { tool_name: String, provider_call_id: Option<String>, call_id: String, result: String, truncated: bool, }, ToolSkipped { tool_name: String, call_id: String, reason: String, }, ToolTerminated { tool_name: String, call_id: String, reason: String, }, ToolHostedInvoked { tool_name: String, provider_call_id: Option<String>, call_id: String, response_id: Option<String>, args_json: String, truncated: bool, }, ToolHostedCompleted { tool_name: String, provider_call_id: Option<String>, call_id: String, response_id: Option<String>, status: Option<String>, result: String, truncated: bool, }, ContextSampled { message_count: usize, byte_size: usize, token_estimate: Option<u64>, }, ContextCompacted { evicted_count: usize, evicted_bytes: usize, carry_over: bool, summary_bytes: usize, }, MemoryDemoted { demoted_count: usize, tags: Vec<String>, }, MemoryFrameWritten { frame_kind: String, frame_count_after: Option<u64>, bytes_written: usize, }, ComposeKernelStart { kernel_id: String, skills_registered: Option<usize>, tools_registered: Option<usize>, }, ComposeKernelShutdown { kernel_id: String, reason: String, }, ComposeLoopIteration { kernel_id: String, iteration: u64, skill_id: Option<String>, confidence: Option<f64>, }, ComposeSkillResolved { kernel_id: String, skill_id: String, applies: bool, delta: Option<f64>, confidence: Option<f64>, }, ComposeRetryAttempt { kernel_id: String, target: String, attempt: u64, classification: String, }, ComposeRecovery { kernel_id: String, reason: String, recovered: bool, }, ResponseSessionStarted { model: String, session_id: String, }, ResponseTurnStarted { session_id: String, previous_response_id: Option<String>, }, ResponseTurnCompleted { session_id: String, response_id: String, previous_response_id: Option<String>, status: String, tokens_in: Option<u64>, tokens_out: Option<u64>, hosted_tool_calls: usize, }, ResponseSessionEnded { session_id: String, reason: String, }, EvalReport { report_id: String, dataset: String, metric: String, value: f64, ci_low: Option<f64>, ci_high: Option<f64>, baseline_value: Option<f64>, delta: Option<f64>, verdict: Option<String>, sample_size: Option<u64>, },
}
Expand description

Payload variants. Tagged on the wire as "kind": "<dotted.name>".

New variants are additive; rename or remove is a breaking change requiring a bump of SCHEMA_VERSION.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

PromptStarted

A prompt is about to be sent to the model provider.

Fields

§model: String

Model name as declared on the agent.

§messages_in: usize

Number of messages in the history at the time of the call.

§

PromptCompleted

A prompt finished; the model returned a completion response.

Fields

§model: String

Model name as reported by the provider response (may differ from the requested model for routed providers).

§tokens_in: Option<u64>

Provider-reported input tokens, if known.

§tokens_out: Option<u64>

Provider-reported output tokens, if known.

§response_id: Option<String>

Provider response ID, if supplied.

§previous_response_id: Option<String>

Server-side chain ancestor when the producer is on a stateful endpoint (e.g. OpenAI’s Responses API). None for one-shot Chat Completions or the first turn of a chain. Populated by crate::TelemetryHook::with_previous_response_id_resolver or by producer crates emitting the kind directly.

§

ToolInvoked

A tool is about to be invoked.

Fields

§tool_name: String

Tool name as registered on the agent.

§provider_call_id: Option<String>

Provider-supplied tool-call ID, when present.

§call_id: String

Stable internal correlation ID (always present).

§args_json: String

JSON-encoded arguments (possibly truncated; see truncated).

§truncated: bool

true if args_json was truncated to PAYLOAD_TRUNCATE_BYTES.

§

ToolCompleted

A tool finished executing.

Fields

§tool_name: String

Tool name (matches the paired tool.invoked).

§provider_call_id: Option<String>

Provider-supplied tool-call ID, when present.

§call_id: String

Stable internal correlation ID (matches the paired tool.invoked).

§result: String

Tool result text (possibly truncated; see truncated).

§truncated: bool

true if result was truncated to PAYLOAD_TRUNCATE_BYTES.

§

ToolSkipped

A previously-ToolInvoked call was skipped by a gating hook before the tool body ran. Pairs by call_id and closes the tool.invoked/tool.completed gap that would otherwise leave the invoke event orphaned.

Fields

§tool_name: String

Tool name (matches the paired tool.invoked).

§call_id: String

Stable internal correlation ID (matches the paired tool.invoked).

§reason: String

Human-readable reason from the gate.

§

ToolTerminated

A previously-ToolInvoked call triggered a hook-driven termination of the agent loop. Pairs by call_id.

Fields

§tool_name: String

Tool name (matches the paired tool.invoked).

§call_id: String

Stable internal correlation ID (matches the paired tool.invoked).

§reason: String

Human-readable reason from the hook.

§

ToolHostedInvoked

A provider-native hosted tool was invoked. Hosted tools (OpenAI Responses web_search / file_search / computer_use / code_interpreter, future Anthropic/Google equivalents) run inside the provider’s infrastructure rather than in the Rig agent loop, so PromptHook::on_tool_call never fires for them. Producers wire this variant from a streaming-chunk tap or session decorator.

Fields

§tool_name: String

Provider-native hosted tool name (e.g. "web_search", "file_search", "computer_use", "code_interpreter").

§provider_call_id: Option<String>

Provider-supplied call ID for the hosted invocation, when surfaced by the provider stream.

§call_id: String

Stable correlation ID chosen by the producer so the matching tool.hosted_completed can be paired.

§response_id: Option<String>

Provider response ID the hosted call belongs to, when known.

§args_json: String

JSON-encoded arguments visible to the producer (possibly truncated; see truncated). May be empty for providers that do not expose hosted-tool inputs in the stream.

§truncated: bool

true if args_json was truncated to PAYLOAD_TRUNCATE_BYTES.

§

ToolHostedCompleted

A provider-native hosted tool finished. Pairs with EventKind::ToolHostedInvoked by call_id.

Fields

§tool_name: String

Hosted tool name (matches the paired tool.hosted_invoked).

§provider_call_id: Option<String>

Provider-supplied call ID, when surfaced.

§call_id: String

Stable correlation ID (matches the paired tool.hosted_invoked).

§response_id: Option<String>

Provider response ID the hosted call belongs to, when known.

§status: Option<String>

Provider-reported status (e.g. "completed", "failed"), when surfaced. Free-form string per provider.

§result: String

Hosted result text or JSON (possibly truncated). May be empty for providers that do not surface hosted-tool outputs in the stream beyond the status.

§truncated: bool

true if result was truncated to PAYLOAD_TRUNCATE_BYTES.

§

ContextSampled

The active context was sampled (typically on ConversationMemory::load).

Fields

§message_count: usize

Number of messages in the loaded history.

§byte_size: usize

JSON byte size of the loaded history (rough size estimate).

§token_estimate: Option<u64>

Optional token-count estimate. None in the default build; populated by consumers that wire a tokenizer.

§

ContextCompacted

A compactor fired, replacing some evicted history with a summary artifact.

Fields

§evicted_count: usize

Number of messages evicted from the active context.

§evicted_bytes: usize

Approximate byte size of the evicted messages.

§carry_over: bool

true if the compactor produced a carry-over artifact for the next compaction cycle.

§summary_bytes: usize

Byte size of the summary text written to long-term memory.

§

MemoryDemoted

A demotion hook moved messages to long-term storage.

Fields

§demoted_count: usize

Number of messages demoted.

§tags: Vec<String>

Tags applied to the demoted frames.

§

MemoryFrameWritten

A frame was written to the long-term store.

Fields

§frame_kind: String

Frame kind as classified by the producer (e.g. "summary", "demoted").

§frame_count_after: Option<u64>

Total frame count in the store after the write. None when the producer does not expose a cheap cumulative count (e.g. memvid). Consumers SHOULD NOT assume 0 means “empty store” — use this Option and treat absence as “unknown”.

§bytes_written: usize

Byte size of the written frame’s text payload.

§

ComposeKernelStart

A rig-compose kernel became active for a conversation.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§skills_registered: Option<usize>

Number of skills registered at startup, when known.

§tools_registered: Option<usize>

Number of tools registered at startup, when known.

§

ComposeKernelShutdown

A rig-compose kernel stopped processing.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§reason: String

Producer-specific shutdown reason (e.g. "normal", "error").

§

ComposeLoopIteration

One iteration of a rig-compose agent/kernel loop began.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§iteration: u64

Monotonic iteration counter inside the kernel.

§skill_id: Option<String>

Skill being considered or executed during this iteration.

§confidence: Option<f64>

Current confidence score, when exposed by the producer.

§

ComposeSkillResolved

A rig-compose skill resolution completed.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§skill_id: String

Skill identifier.

§applies: bool

Whether the skill applied to the current context.

§delta: Option<f64>

Confidence delta returned by the skill, when present.

§confidence: Option<f64>

Post-application confidence score, when exposed by the producer. For applies = false resolutions this is the unchanged context confidence; for applies = true it reflects confidence + delta clamped to [0.0, 1.0].

§

ComposeRetryAttempt

A retry attempt occurred in a rig-compose dispatch or recovery path.

rig-tap does not emit this variant itself: the [crate::DispatchObserveHook] only observes the lifecycle hooks surfaced by rig-compose and rig-compose does not currently expose a per-tool retry hook. Producers with their own retry policy (custom skills, transports, or higher-level orchestrators) should emit this variant directly via crate::emit_kind so consumers receive a consistent shape.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§target: String

Tool or operation being retried.

§attempt: u64

One-based retry attempt number.

§classification: String

Retry classification chosen by the producer.

§

ComposeRecovery

A rig-compose recovery path completed.

Fields

§kernel_id: String

Stable kernel identifier chosen by the producer.

§reason: String

Recovery reason or source error classification.

§recovered: bool

Whether the recovery path restored normal execution.

§

ResponseSessionStarted

A stateful provider session opened. Producers wrap a long-lived session (today: OpenAI Responses WebSocket) and emit this on connect.

Fields

§model: String

Model name as declared on the session.

§session_id: String

Producer-chosen session identifier. Stable for the lifetime of the wrapped session; correlates every response.turn_* and the final response.session_ended.

§

ResponseTurnStarted

A turn began inside a stateful provider session. Producers emit this when the session enqueues a new server-side response.

Fields

§session_id: String

Session identifier (matches the paired response.session_started).

§previous_response_id: Option<String>

Chain ancestor for this turn (previous_response_id sent to the provider). None for the first turn of a session.

§

ResponseTurnCompleted

A turn finished inside a stateful provider session. Pairs with the most recent response.turn_started by session_id.

Fields

§session_id: String

Session identifier (matches the paired response.turn_started).

§response_id: String

Provider response identifier for this turn.

§previous_response_id: Option<String>

Chain ancestor for this turn, when present.

§status: String

Terminal provider status ("completed", "failed", "incomplete").

§tokens_in: Option<u64>

Provider-reported input tokens, if known.

§tokens_out: Option<u64>

Provider-reported output tokens, if known.

§hosted_tool_calls: usize

Number of hosted-tool invocations observed during this turn. Each hosted call is also emitted individually via EventKind::ToolHostedInvoked / EventKind::ToolHostedCompleted.

§

ResponseSessionEnded

A stateful provider session closed. Producers emit this on the underlying close handshake, on a provider response.failed, or on any session-fatal transport error.

Fields

§session_id: String

Session identifier (matches the paired response.session_started).

§reason: String

Human-readable reason for the close. Free-form, producer-chosen (e.g. "client_close", "response_failed", "transport_error").

§

EvalReport

One evaluation metric from a retrieval/RAG eval report. Producers emit one event per (report_id, dataset, metric) triple so consumers can filter and aggregate via the rig_tap.* scalars without parsing the JSON envelope. Pairs naturally with the MultiReport / ReportDiff summaries surfaced by rig-retrieval-evals, but the variant is producer-agnostic: any crate emitting metric verdicts on the same tracing target can reuse it.

Fields

§report_id: String

Stable identifier for the report run (e.g. a commit SHA, a harness invocation id, or a wall-clock-named run).

§dataset: String

Dataset / qrels label the metric was computed against (e.g. "beir/scifact", "internal/v3").

§metric: String

Metric name (e.g. "ndcg@10", "recall@100", "mrr").

§value: f64

Point estimate for the metric.

§ci_low: Option<f64>

Bootstrap confidence-interval lower bound, when computed.

§ci_high: Option<f64>

Bootstrap confidence-interval upper bound, when computed.

§baseline_value: Option<f64>

Baseline value the report was compared against, when a ReportDiff is being emitted.

§delta: Option<f64>

Signed delta vs baseline_value, when a diff is being emitted. Positive = improvement for higher-is-better metrics.

§verdict: Option<String>

Regression-gate verdict (e.g. "improved", "regressed", "neutral", "flaky"). Free-form so producers can carry their own taxonomy.

§sample_size: Option<u64>

Number of underlying samples (queries, judgments, etc.) the metric was computed over, when known.

Implementations§

Source§

impl EventKind

Source

pub fn discriminant(&self) -> &'static str

Returns the wire kind discriminant for this event.

Source

pub fn scalar_fields(&self) -> ScalarFields<'_>

Extract the per-variant scalar correlation fields that crate::emit() surfaces directly on the tracing event so that OpenTelemetry collectors and log indexers can route on them without parsing the JSON event blob.

Absent fields are returned as "" rather than Option<&str> because tracing 0.1’s static-field model does not accept Option<&str> as a Value. Consumers should filter rig_tap.<field> != "" to detect presence.

Returns true if the event is part of the prompt lifecycle (prompt.started, prompt.completed).

Returns true if the event is part of the tool lifecycle (tool.invoked, tool.completed, tool.skipped, tool.terminated, tool.hosted_invoked, tool.hosted_completed).

Returns true if the event is part of the stateful response-session lifecycle (response.session_started, response.turn_started, response.turn_completed, response.session_ended).

Returns true if the event is related to memory and context management.

Returns true if the event is related to a rig-compose kernel or agent loop.

Returns true if the event is an evaluation report metric (eval.report).

Source

pub fn tool_call_id(&self) -> Option<&str>

Extracts the stable call_id for tool events, if present.

Trait Implementations§

Source§

impl Clone for EventKind

Source§

fn clone(&self) -> EventKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EventKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for EventKind

Source§

fn eq(&self, other: &EventKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for EventKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for EventKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,