Skip to main content

agent_runtime/runtime/
run_event_kind.rs

1//! Variants describing model routing, tool, timeout, and cancellation lifecycle events.
2
3use crate::ErrorCategory;
4use agent_metering::UsageRecord;
5use agent_models::ModelFailureCategory;
6
7#[derive(Debug, Clone)]
8pub enum RunEventKind {
9    ModelRequested,
10    /// Durable usage and cost input for one model invocation.
11    ModelUsageRecorded {
12        record: UsageRecord,
13    },
14    ModelCandidatesDiscovered {
15        model_ids: Vec<String>,
16    },
17    ModelCandidateAttemptStarted {
18        model_id: String,
19    },
20    ModelCandidateAttemptFailed {
21        model_id: String,
22        category: ModelFailureCategory,
23    },
24    ModelFallback {
25        from_model_id: String,
26        to_model_id: String,
27        category: ModelFailureCategory,
28    },
29    ModelSelected {
30        model_id: String,
31    },
32    ModelRoutingFailed {
33        attempted_candidates: usize,
34    },
35    ModelResponded {
36        model_id: String,
37        tool_calls: usize,
38    },
39    ToolExecutionStarted {
40        tool_call_id: String,
41        name: String,
42    },
43    ToolExecutionFinished {
44        tool_call_id: String,
45        name: String,
46        error_category: Option<ErrorCategory>,
47    },
48    Cancelled,
49    TimedOut,
50    ModelFailed {
51        category: ErrorCategory,
52    },
53}