pub struct Ctx { /* private fields */ }Expand description
Execution context shared across all agents in a workflow.
Ctx carries two things:
- a string key-value store for cross-agent data,
- an append-only event log for diagnostic messages.
State is not reset between crate::Runner::run calls, so the store and
log accumulate across runs unless cleared explicitly with
clear_logs or clear.
LLM access lives on crate::LlmConfig, not on Ctx. Agents that need
an LLM hold their own crate::LlmConfig and call
crate::LlmConfig::request to start a chat request.
Implementations§
Source§impl Ctx
impl Ctx
Sourcepub fn set(&mut self, key: impl Into<String>, value: impl Into<String>)
pub fn set(&mut self, key: impl Into<String>, value: impl Into<String>)
Insert or overwrite a key in the KV store.
Sourcepub fn remove(&mut self, key: &str) -> Option<String>
pub fn remove(&mut self, key: &str) -> Option<String>
Remove a key from the KV store, returning its value if it existed.
Sourcepub fn clear_logs(&mut self)
pub fn clear_logs(&mut self)
Clear the event log, leaving the KV store intact.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ctx
impl RefUnwindSafe for Ctx
impl Send for Ctx
impl Sync for Ctx
impl Unpin for Ctx
impl UnsafeUnpin for Ctx
impl UnwindSafe for Ctx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more