pub struct RunState {Show 13 fields
pub run_id: String,
pub agent: String,
pub status: Status,
pub messages: Vec<Message>,
pub steps: u32,
pub usage: Usage,
pub cost_usd: f64,
pub pending: Vec<PendingCall>,
pub approvals: HashMap<String, bool>,
pub tool_results: Vec<Content>,
pub structured_output: Option<Value>,
pub finish_rejections: u32,
pub next_seq: u64,
}Expand description
The full state of a run, derived purely from its events.
There is no other source of truth: live execution, resume after a crash
and time-travel debugging all go through RunState::apply.
Fields§
§run_id: String§agent: String§status: Status§messages: Vec<Message>§steps: u32§usage: Usage§cost_usd: f64§pending: Vec<PendingCall>§approvals: HashMap<String, bool>§tool_results: Vec<Content>Results gathered for the current batch of tool calls.
structured_output: Option<Value>Validated final answer when the agent has a finish schema.
finish_rejections: u32How many final answers have been rejected by the finish schema.
next_seq: u64Implementations§
Source§impl RunState
impl RunState
Sourcepub fn from_events(events: &[Event]) -> Option<Self>
pub fn from_events(events: &[Event]) -> Option<Self>
Rebuild state from a run’s events. Returns None for an empty slice.
Pass a prefix (&events[..=n]) to see the state at any point in time.
pub fn apply(&mut self, event: &Event)
pub fn awaiting_approval(&self) -> Vec<PendingCall>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RunState
impl<'de> Deserialize<'de> for RunState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for RunState
Auto Trait Implementations§
impl Freeze for RunState
impl RefUnwindSafe for RunState
impl Send for RunState
impl Sync for RunState
impl Unpin for RunState
impl UnsafeUnpin for RunState
impl UnwindSafe for RunState
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