pub struct MutableSession { /* private fields */ }Available on crate feature
runner only.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 Session>) -> MutableSession
pub fn new(session: Arc<dyn Session>) -> MutableSession
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.
Trait Implementations§
Source§impl Session for MutableSession
impl Session for MutableSession
Auto Trait Implementations§
impl Freeze for MutableSession
impl !RefUnwindSafe for MutableSession
impl Send for MutableSession
impl Sync for MutableSession
impl Unpin for MutableSession
impl !UnwindSafe for MutableSession
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request