Skip to main content

ToolLoop

Struct ToolLoop 

pub struct ToolLoop<'a> {
Show 19 fields pub exec: ResolvedAgentExecution<'a>, pub history: &'a mut Vec<ChatMessage>, pub channel_name: &'a str, pub channel_reply_target: Option<&'a str>, pub cancellation_token: Option<CancellationToken>, pub on_delta: Option<Sender<StreamDelta>>, pub shared_budget: Option<Arc<Atomic<usize>>>, pub channel: Option<&'a dyn Channel>, pub collected_receipts: Option<&'a Mutex<Vec<String>>>, pub event_tx: Option<Sender<TurnEvent>>, pub steering: Option<&'a mut Receiver<String>>, pub new_messages_out: Option<&'a mut Vec<ChatMessage>>, pub image_cache: Option<&'a mut LocalImageCache>, pub ingress: IngressContext, pub memory: Option<TurnMemory<'a>>, pub agent_alias: Option<&'a str>, pub parent_agent_alias: Option<&'a str>, pub turn_id: &'a str, pub sop_reassembly: Option<SopStepReassembly<'a>>,
}

Fields§

§exec: ResolvedAgentExecution<'a>

The resolved per-agent execution context: model binding, gated tool registry, approval, observability, and resolved runtime knobs. Stable for every turn to this agent; built once and reused. See ResolvedAgentExecution. Everything below is per-message turn state.

§history: &'a mut Vec<ChatMessage>§channel_name: &'a str§channel_reply_target: Option<&'a str>§cancellation_token: Option<CancellationToken>§on_delta: Option<Sender<StreamDelta>>§shared_budget: Option<Arc<Atomic<usize>>>§channel: Option<&'a dyn Channel>§collected_receipts: Option<&'a Mutex<Vec<String>>>§event_tx: Option<Sender<TurnEvent>>§steering: Option<&'a mut Receiver<String>>§new_messages_out: Option<&'a mut Vec<ChatMessage>>§image_cache: Option<&'a mut LocalImageCache>§ingress: IngressContext§memory: Option<TurnMemory<'a>>

The per-turn memory half for unified memory-context injection: the handle, raw recall query, session scopes, and spawn-site suppression. None for nested sub-turn sites and paths without a memory backend; the injection decision itself is keyed on ingress.origin.

§agent_alias: Option<&'a str>

Observer metadata: agent alias and turn id, stamped onto every turn-level observer event so OTel spans correlate across the loop. This is the EFFECTIVE agent — the one whose policy/tools/provider this loop actually runs with. A nested cross-agent SOP step runs its sub-loop with the step agent here, never the delegating parent’s.

§parent_agent_alias: Option<&'a str>

The delegating agent’s alias when this loop is a nested cross-agent execution (a live SOP step naming a different agent). Stamped next to agent_alias on observer records so security/audit consumers see both the acting authority and its parent. None for ordinary turns.

§turn_id: &'a str§sop_reassembly: Option<SopStepReassembly<'a>>

Handle the live SOP driver uses to re-assemble a nested step’s execution context when the step delegates to a different agent (see SopStepReassembly). None on every path that cannot reach Config or that never drives nested SOP steps; when None, a cross-agent step FAILS CLOSED (the step errors rather than running with the parent agent’s broader context).

Auto Trait Implementations§

§

impl<'a> Freeze for ToolLoop<'a>

§

impl<'a> !RefUnwindSafe for ToolLoop<'a>

§

impl<'a> Send for ToolLoop<'a>

§

impl<'a> Sync for ToolLoop<'a>

§

impl<'a> Unpin for ToolLoop<'a>

§

impl<'a> UnsafeUnpin for ToolLoop<'a>

§

impl<'a> !UnwindSafe for ToolLoop<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,