Skip to main content

objectiveai_sdk/agent/
response.rs

1//! Response types for Agent API endpoints.
2
3use serde::{Deserialize, Serialize};
4use schemars::JsonSchema;
5
6/// Response containing a list of Agents.
7#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
8#[schemars(rename = "agent.ListAgentResponse")]
9pub struct ListAgentResponse {
10    /// The list of Agent summaries.
11    pub data: Vec<ListAgentItem>,
12}
13
14/// Summary information for a listed Agent.
15pub type ListAgentItem = crate::RemotePath;
16
17/// Response containing a single Agent with creation timestamp.
18#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
19#[schemars(rename = "agent.GetAgentResponse")]
20pub struct GetAgentResponse {
21    #[serde(flatten)]
22    #[schemars(schema_with = "crate::flatten_schema::<crate::RemotePath>")]
23    pub path: crate::RemotePath,
24    /// The Agent definition.
25    #[serde(flatten)]
26    #[schemars(schema_with = "crate::flatten_schema::<super::RemoteAgentWithFallbacks>")]
27    pub inner: super::RemoteAgentWithFallbacks,
28}
29
30/// Usage statistics for an Agent.
31#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
32#[schemars(rename = "agent.UsageAgentResponse")]
33pub struct UsageAgentResponse {
34    /// Total number of requests made with this Agent.
35    pub requests: u64,
36    /// Total completion tokens generated.
37    pub completion_tokens: u64,
38    /// Total prompt tokens processed.
39    pub prompt_tokens: u64,
40    /// Total cost incurred.
41    #[serde(deserialize_with = "crate::serde_util::decimal")]
42    #[schemars(with = "f64")]
43    pub total_cost: rust_decimal::Decimal,
44}