pub trait AgentState:
'static
+ Debug
+ Clone
+ Send
+ Sync
+ for<'de> Deserialize<'de>
+ Serialize
+ Default { }Expand description
Marker trait for types that can represent agent state.
Types implementing this trait can be used as the state type in state-related events (StateSnapshot, StateDelta, etc.).
§Bounds
'static: Required for async operationsDebug: For debugging and loggingClone: State may need to be copiedSend + Sync: For thread-safe async operationsSerialize + Deserialize: For JSON serializationDefault: For initializing empty state
§Example
use ag_ui_core::AgentState;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
struct MyState {
counter: u32,
messages: Vec<String>,
}
impl AgentState for MyState {}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.