pub struct AgentRunState {Show 15 fields
pub run_id: RunId,
pub conversation_id: ConversationId,
pub message_history: Vec<ModelMessage>,
pub usage: Usage,
pub run_step: usize,
pub status: RunStatus,
pub output: Option<String>,
pub structured_output: Option<Value>,
pub latest_response: Option<ModelResponse>,
pub pending_tool_calls: Vec<ToolCallPart>,
pub pending_tool_returns: Vec<ToolReturnPart>,
pub pending_approval_tool_returns: Vec<ToolReturnPart>,
pub deferred_tool_returns: Vec<ToolReturnPart>,
pub idle_messages: Vec<String>,
pub metadata: Metadata,
}Expand description
Checkpointable state owned by the graph loop.
Fields§
§run_id: RunIdRun identifier.
conversation_id: ConversationIdConversation identifier.
message_history: Vec<ModelMessage>Canonical model history.
usage: UsageAccumulated usage.
run_step: usizeCompleted model/tool loop steps.
status: RunStatusCurrent status.
output: Option<String>Final text output.
structured_output: Option<Value>Final structured JSON output.
latest_response: Option<ModelResponse>Latest model response awaiting classification.
pending_tool_calls: Vec<ToolCallPart>Tool calls awaiting execution.
pending_tool_returns: Vec<ToolReturnPart>Tool returns awaiting request preparation.
pending_approval_tool_returns: Vec<ToolReturnPart>Tool calls that require approval before execution can proceed.
deferred_tool_returns: Vec<ToolReturnPart>Tool calls deferred to another runtime or durable worker.
idle_messages: Vec<String>Idle messages ready to redirect finalization.
metadata: MetadataRun metadata.
Implementations§
Source§impl AgentRunState
impl AgentRunState
Sourcepub fn new(run_id: RunId, conversation_id: ConversationId) -> Self
pub fn new(run_id: RunId, conversation_id: ConversationId) -> Self
Create empty run state.
Sourcepub fn apply_model_response(&mut self, response: ModelResponse)
pub fn apply_model_response(&mut self, response: ModelResponse)
Apply a model response to state.
Sourcepub fn replace_latest_response(&mut self, response: ModelResponse)
pub fn replace_latest_response(&mut self, response: ModelResponse)
Replace the latest response after lifecycle hooks mutate it.
Sourcepub const fn has_pending_hitl(&self) -> bool
pub const fn has_pending_hitl(&self) -> bool
Return true when the run is waiting for approval or deferred tool results.
Sourcepub fn pending_approvals(&self) -> &[ToolReturnPart]
pub fn pending_approvals(&self) -> &[ToolReturnPart]
Return pending approval-required tool returns.
Sourcepub fn pending_deferred_tools(&self) -> &[ToolReturnPart]
pub fn pending_deferred_tools(&self) -> &[ToolReturnPart]
Return pending deferred tool returns.
Sourcepub fn pending_hitl_tool_returns(&self) -> impl Iterator<Item = &ToolReturnPart>
pub fn pending_hitl_tool_returns(&self) -> impl Iterator<Item = &ToolReturnPart>
Iterate all pending HITL tool returns in approval-then-deferred order.
Trait Implementations§
Source§impl Clone for AgentRunState
impl Clone for AgentRunState
Source§fn clone(&self) -> AgentRunState
fn clone(&self) -> AgentRunState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentRunState
impl Debug for AgentRunState
Source§impl<'de> Deserialize<'de> for AgentRunState
impl<'de> Deserialize<'de> for AgentRunState
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>,
impl Eq for AgentRunState
Source§impl PartialEq for AgentRunState
impl PartialEq for AgentRunState
Source§fn eq(&self, other: &AgentRunState) -> bool
fn eq(&self, other: &AgentRunState) -> bool
self and other values to be equal, and is used by ==.