pub struct AgentTurn {
pub id: Uuid,
pub timestamp: DateTime<Utc>,
pub user: UserMessage,
pub steps: Vec<AgentStep>,
pub stats: TurnStats,
}Expand description
Single user-initiated interaction cycle within a session.
A turn begins with user input and contains all agent steps taken in response until the next user input or session end. Autonomous agents may execute multiple steps per turn.
Fields§
§id: UuidUnique turn identifier (ID of the user event that initiated this turn).
timestamp: DateTime<Utc>When the turn started (user input timestamp).
user: UserMessageUser input that triggered this turn.
steps: Vec<AgentStep>Agent’s response steps in chronological order. Single step for simple Q&A, multiple steps for autonomous operation.
stats: TurnStatsAggregated turn statistics.
Implementations§
Source§impl AgentTurn
impl AgentTurn
Sourcepub fn cumulative_input_tokens(&self, fallback: u32) -> u32
pub fn cumulative_input_tokens(&self, fallback: u32) -> u32
Calculate cumulative input tokens at the end of this turn
Falls back to fallback if no usage data found
Sourcepub fn cumulative_total_tokens(&self, fallback: u32) -> u32
pub fn cumulative_total_tokens(&self, fallback: u32) -> u32
Calculate cumulative total tokens (input + output) at the end of this turn
Falls back to fallback if no usage data found
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentTurn
impl<'de> Deserialize<'de> for AgentTurn
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentTurn, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentTurn, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for AgentTurn
impl Serialize for AgentTurn
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for AgentTurn
impl RefUnwindSafe for AgentTurn
impl Send for AgentTurn
impl Sync for AgentTurn
impl Unpin for AgentTurn
impl UnwindSafe for AgentTurn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more