Struct AgentTurnGuard
pub struct AgentTurnGuard<'a> { /* private fields */ }Expand description
Drop-safe lifecycle bracket for one logical agent turn.
Construction emits exactly one ObserverEvent::AgentStart. Calling
finish, or dropping the guard during an error or panic,
emits exactly one matching ObserverEvent::AgentEnd. Entry points that
invoke the tool loop directly should use this guard instead of open-coding
lifecycle events so in-flight observers cannot be left unbalanced.
Implementations§
Source§impl<'a> AgentTurnGuard<'a>
impl<'a> AgentTurnGuard<'a>
Sourcepub fn start(
observer: &'a dyn Observer,
model_provider: impl Into<String>,
model: impl Into<String>,
channel: Option<String>,
agent_alias: Option<String>,
turn_id: Option<String>,
) -> Self
pub fn start( observer: &'a dyn Observer, model_provider: impl Into<String>, model: impl Into<String>, channel: Option<String>, agent_alias: Option<String>, turn_id: Option<String>, ) -> Self
Open a lifecycle bracket and emit its start event.
Sourcepub fn set_model_route(
&mut self,
model_provider: impl Into<String>,
model: impl Into<String>,
)
pub fn set_model_route( &mut self, model_provider: impl Into<String>, model: impl Into<String>, )
Attribute the closing event to the model route actually used.
Trait Implementations§
Source§impl Drop for AgentTurnGuard<'_>
impl Drop for AgentTurnGuard<'_>
Auto Trait Implementations§
impl<'a> Freeze for AgentTurnGuard<'a>
impl<'a> !RefUnwindSafe for AgentTurnGuard<'a>
impl<'a> Send for AgentTurnGuard<'a>
impl<'a> Sync for AgentTurnGuard<'a>
impl<'a> Unpin for AgentTurnGuard<'a>
impl<'a> UnsafeUnpin for AgentTurnGuard<'a>
impl<'a> !UnwindSafe for AgentTurnGuard<'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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more