Skip to main content

hanzo_client/models/
agent_run_view.rs

1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AgentRunView {
16    /// Actor is the \"org/sub\" identity the run was executed and billed AS. Empty means there was no PERSON — a schedule or a service token — which is a different fact from \"we do not know\", and the difference is what an audit asks about.
17    #[serde(rename = "actor", skip_serializing_if = "Option::is_none")]
18    pub actor: Option<String>,
19    /// What an operator needs to answer \"what ran, for whom, and what did it do\" — and, through traceId, to leave this record for the waterfall of the very same run rather than a search that hopefully lands near it.  Agent is on the row because the org-wide feed lists runs across agents, and a run that cannot name its agent is an orphan in exactly the view built to make sense of many of them. Every field is omitempty: a run recorded before these columns existed reports absence rather than a zero it never measured.
20    #[serde(rename = "agent", skip_serializing_if = "Option::is_none")]
21    pub agent: Option<String>,
22    /// CompletionTokens is the same measurement for what the model produced, on the same final completion. It is a count of TOKENS, not of turns and not of money.
23    #[serde(rename = "completionTokens", skip_serializing_if = "Option::is_none")]
24    pub completion_tokens: Option<i32>,
25    /// CreatedAt is when the run finished, RFC 3339 in UTC to the second — the duration above already says how long it had been going.
26    #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
27    pub created_at: Option<String>,
28    /// DurationMs is wall-clock milliseconds around the completion, including a failover's retries. It is time SPENT, not time billed.
29    #[serde(rename = "durationMs", skip_serializing_if = "Option::is_none")]
30    pub duration_ms: Option<i32>,
31    /// Error is why an \"ok\"-less run failed, as the failing call reported it. Empty on every successful run.
32    #[serde(rename = "error", skip_serializing_if = "Option::is_none")]
33    pub error: Option<String>,
34    /// ID is the run's handle, minted as \"run_\" + 32 hex characters. It is the key the metering ledger records this run's per-round token spend under, so it is how a bill and a run are joined.
35    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
36    pub id: Option<String>,
37    /// Input is the text the run was given, verbatim.
38    #[serde(rename = "input", skip_serializing_if = "Option::is_none")]
39    pub input: Option<String>,
40    /// Model is the model that actually SERVED this run, which is not always the one the agent is defined on — a failover records what answered. Normalized to our name on the way out; the stored row is left exactly as it happened, because a run is a record and rewriting it would be worse than the name it carries.
41    #[serde(rename = "model", skip_serializing_if = "Option::is_none")]
42    pub model: Option<String>,
43    /// Output is what the model produced. Empty on an error run, and empty is also a legitimate answer from a run that succeeded with nothing to say — Status is what separates those.
44    #[serde(rename = "output", skip_serializing_if = "Option::is_none")]
45    pub output: Option<String>,
46    /// PromptTokens is what the gateway reported for the run's FINAL completion, and only that one — a tool loop's earlier rounds are the metering ledger's account, joined by this run's id. Reading it as the run's total spend undercounts a loop.
47    #[serde(rename = "promptTokens", skip_serializing_if = "Option::is_none")]
48    pub prompt_tokens: Option<i32>,
49    /// Status is the run's outcome, and there are exactly two: \"ok\" when the model answered, \"error\" when it did not. It is written when the run ends, so no row here is in flight.
50    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
51    pub status: Option<String>,
52    /// ToolCalls is how many tool dispatches the run made — a count of ACTIONS, which is a different measurement from the token counts above and from the turns a build reports. Zero is a run that answered straight from the model.
53    #[serde(rename = "toolCalls", skip_serializing_if = "Option::is_none")]
54    pub tool_calls: Option<i32>,
55    /// TraceID is the trace this run IS, so the record and its spans are one thing to move between: it opens the waterfall for THIS run rather than a search that lands near it. Empty when the process had no tracer, never a fabricated id.
56    #[serde(rename = "traceId", skip_serializing_if = "Option::is_none")]
57    pub trace_id: Option<String>,
58}
59
60impl AgentRunView {
61    pub fn new() -> AgentRunView {
62        AgentRunView {
63            actor: None,
64            agent: None,
65            completion_tokens: None,
66            created_at: None,
67            duration_ms: None,
68            error: None,
69            id: None,
70            input: None,
71            model: None,
72            output: None,
73            prompt_tokens: None,
74            status: None,
75            tool_calls: None,
76            trace_id: None,
77        }
78    }
79}
80