pub struct ReadOnlyContext<'a> { /* private fields */ }Expand description
Immutable snapshot of step context passed to AgentBehavior phase hooks.
The loop builds a ReadOnlyContext from the current StepContext before
each phase hook and passes it by shared reference. Plugins read data from
this snapshot and return a typed ActionSet describing effects to apply.
Implementations§
Source§impl<'a> ReadOnlyContext<'a>
impl<'a> ReadOnlyContext<'a>
pub fn new( phase: Phase, thread_id: &'a str, messages: &'a [Arc<Message>], run_policy: &'a RunPolicy, doc: &'a DocCell, ) -> Self
pub fn with_llm_response(self, response: &'a LLMResponse) -> Self
pub fn with_tool_info( self, name: &'a str, call_id: &'a str, args: Option<&'a Value>, ) -> Self
pub fn with_tool_result(self, result: &'a ToolResult) -> Self
pub fn with_resume_input(self, resume: ToolCallResume) -> Self
pub fn with_scope_ctx(self, scope_ctx: ScopeContext) -> Self
pub fn phase(&self) -> Phase
pub fn thread_id(&self) -> &str
pub fn messages(&self) -> &[Arc<Message>]
Sourcepub fn initial_message_count(&self) -> usize
pub fn initial_message_count(&self) -> usize
Number of messages that existed before the current run started.
pub fn run_policy(&self) -> &RunPolicy
pub fn run_identity(&self) -> &RunIdentity
pub fn doc(&self) -> &DocCell
pub fn response(&self) -> Option<&StreamResult>
pub fn inference_error(&self) -> Option<&InferenceError>
pub fn tool_name(&self) -> Option<&str>
pub fn tool_call_id(&self) -> Option<&str>
pub fn tool_args(&self) -> Option<&Value>
pub fn tool_result(&self) -> Option<&ToolResult>
pub fn resume_input(&self) -> Option<&ToolCallResume>
pub fn snapshot(&self) -> Value
pub fn snapshot_of<T: State>(&self) -> TireaResult<T>
Sourcepub fn scoped_state_of<T: StateSpec>(&self, scope: StateScope) -> TireaResult<T>
pub fn scoped_state_of<T: StateSpec>(&self, scope: StateScope) -> TireaResult<T>
Scope-aware state read for StateSpec types.
pub fn scope_ctx(&self) -> &ScopeContext
pub fn with_run_identity(self, run_identity: &RunIdentity) -> Self
Auto Trait Implementations§
impl<'a> Freeze for ReadOnlyContext<'a>
impl<'a> RefUnwindSafe for ReadOnlyContext<'a>
impl<'a> Send for ReadOnlyContext<'a>
impl<'a> Sync for ReadOnlyContext<'a>
impl<'a> Unpin for ReadOnlyContext<'a>
impl<'a> UnsafeUnpin for ReadOnlyContext<'a>
impl<'a> UnwindSafe for ReadOnlyContext<'a>
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