pub struct MutableSession { /* private fields */ }Expand description
MutableSession wraps a session with shared mutable state.
This mirrors ADK-Go’s MutableSession pattern where state changes from events are immediately visible to all agents sharing the same context. This is critical for SequentialAgent/LoopAgent patterns where downstream agents need to read state set by upstream agents via output_key.
Implementations§
Source§impl MutableSession
impl MutableSession
Sourcepub fn new(session: Arc<dyn AdkSession>) -> Self
pub fn new(session: Arc<dyn AdkSession>) -> Self
Create a new MutableSession from a session snapshot. The state is copied from the session and becomes mutable.
Sourcepub fn apply_state_delta(&self, delta: &HashMap<String, Value>)
pub fn apply_state_delta(&self, delta: &HashMap<String, Value>)
Apply state delta from an event to the mutable state. This is called by the Runner when events are yielded.
Sourcepub fn append_event(&self, event: Event)
pub fn append_event(&self, event: Event)
Append an event to the session’s event list. This keeps the in-memory view consistent.