pub struct LoopCheckpoint {
pub messages: Vec<LlmMessage>,
pub custom_messages: Vec<Value>,
pub pending_messages: Vec<LlmMessage>,
pub pending_steering_messages: Vec<LlmMessage>,
pub system_prompt: String,
pub provider: String,
pub model_id: String,
pub created_at: u64,
pub metadata: HashMap<String, Value>,
pub state: Option<Value>,
/* private fields */
}Expand description
A serializable snapshot of the agent loop’s in-flight state.
Captures everything needed to pause a running loop and resume it later:
messages, pending injections, system prompt, model, and session state.
Created by
Agent::pause and consumed by
Agent::resume.
Fields§
§messages: Vec<LlmMessage>All context messages at the time of pause.
custom_messages: Vec<Value>Serialized custom messages (envelopes with type and data fields).
pending_messages: Vec<LlmMessage>Follow-up messages queued for injection into the next turn.
pending_steering_messages: Vec<LlmMessage>Steering messages queued at the time of pause.
Older checkpoints without this field deserialize with an empty vec (backward compatible).
system_prompt: StringThe system prompt active at the time of pause.
provider: StringModel provider name.
model_id: StringModel identifier.
created_at: u64Unix timestamp when the checkpoint was created.
metadata: HashMap<String, Value>Arbitrary metadata for application-specific use.
state: Option<Value>Serialized session state snapshot (SessionState.data).
Implementations§
Source§impl LoopCheckpoint
impl LoopCheckpoint
Sourcepub fn new(
system_prompt: impl Into<String>,
provider: impl Into<String>,
model_id: impl Into<String>,
messages: &[AgentMessage],
) -> Self
pub fn new( system_prompt: impl Into<String>, provider: impl Into<String>, model_id: impl Into<String>, messages: &[AgentMessage], ) -> Self
Create a loop checkpoint from the current agent state.
Serializes CustomMessage variants that support serialization.
Non-serializable custom messages are skipped with a warning.
Sourcepub fn with_state(self, state: Value) -> Self
pub fn with_state(self, state: Value) -> Self
Set the session state snapshot.
Sourcepub fn with_pending_messages(self, pending: Vec<LlmMessage>) -> Self
pub fn with_pending_messages(self, pending: Vec<LlmMessage>) -> Self
Set pending follow-up messages.
Sourcepub fn with_pending_steering_messages(self, pending: Vec<LlmMessage>) -> Self
pub fn with_pending_steering_messages(self, pending: Vec<LlmMessage>) -> Self
Set pending steering messages.
Sourcepub fn with_pending_message_batch(self, pending: &[AgentMessage]) -> Self
pub fn with_pending_message_batch(self, pending: &[AgentMessage]) -> Self
Set pending follow-up messages from a full AgentMessage batch.
Sourcepub fn with_pending_steering_message_batch(
self,
pending: &[AgentMessage],
) -> Self
pub fn with_pending_steering_message_batch( self, pending: &[AgentMessage], ) -> Self
Set pending steering messages from a full AgentMessage batch.
Sourcepub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata(self, key: impl Into<String>, value: Value) -> Self
Add metadata.
Sourcepub fn restore_messages(
&self,
registry: Option<&CustomMessageRegistry>,
) -> Vec<AgentMessage>
pub fn restore_messages( &self, registry: Option<&CustomMessageRegistry>, ) -> Vec<AgentMessage>
Restore all messages as AgentMessage values, preserving their
original interleaved order.
If registry is None, custom messages are silently skipped.
Sourcepub fn restore_pending_messages(
&self,
registry: Option<&CustomMessageRegistry>,
) -> Vec<AgentMessage>
pub fn restore_pending_messages( &self, registry: Option<&CustomMessageRegistry>, ) -> Vec<AgentMessage>
Restore pending follow-up messages as AgentMessage values.
Sourcepub fn restore_pending_steering_messages(
&self,
registry: Option<&CustomMessageRegistry>,
) -> Vec<AgentMessage>
pub fn restore_pending_steering_messages( &self, registry: Option<&CustomMessageRegistry>, ) -> Vec<AgentMessage>
Restore pending steering messages as AgentMessage values.
Sourcepub fn to_checkpoint(&self, id: impl Into<String>) -> Checkpoint
pub fn to_checkpoint(&self, id: impl Into<String>) -> Checkpoint
Convert this loop checkpoint into a standard Checkpoint for storage.
Trait Implementations§
Source§impl Clone for LoopCheckpoint
impl Clone for LoopCheckpoint
Source§fn clone(&self) -> LoopCheckpoint
fn clone(&self) -> LoopCheckpoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more