pub struct Resolver { /* private fields */ }Expand description
A named async value source whose inputs come from State and whose result
lands back in State under {name}:result (or {name}:error).
Resolver is the async sibling of the deterministic
Recognizer: both are inputs from State →
value. A Resolver
generalizes call_agent from “a sub-agent” to any async source — a sub-agent
(Resolver::agent) or a system fetch / tool call / MCP request
(Resolver::fetch) — under one result convention, so a Flow step can
complete on it via Guard::resolved
regardless of where the value came from.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub fn agent(name: impl Into<String>, agent: Arc<dyn TextAgent>) -> Resolver
pub fn agent(name: impl Into<String>, agent: Arc<dyn TextAgent>) -> Resolver
Resolve by running a sub-agent. Its String output becomes the result.
Sourcepub fn fetch<F, Fut>(name: impl Into<String>, f: F) -> Resolver
pub fn fetch<F, Fut>(name: impl Into<String>, f: F) -> Resolver
Resolve by running an async closure over a clone of State — the seam
for an HTTP fetch, a tool call, or an MCP request. The closure returns
Ok(value) on success or Err(message) to record an error.
Sourcepub fn llm(
name: impl Into<String>,
llm: Arc<dyn BaseLlm>,
prompt: impl Into<String>,
) -> Resolver
pub fn llm( name: impl Into<String>, llm: Arc<dyn BaseLlm>, prompt: impl Into<String>, ) -> Resolver
Resolve by running a one-shot OOB LLM over a State-interpolated prompt
({key} placeholders). The completion text becomes the result.
Sourcepub async fn resolve(&self, state: &State) -> Result<Value, String>
pub async fn resolve(&self, state: &State) -> Result<Value, String>
Resolve synchronously (AgentMode::Call): await the source, write its
value to {name}:result (or its error to {name}:error), record its
provenance under state_meta:{name}:result, and return it.
Sourcepub fn dispatch(self, state: State)
pub fn dispatch(self, state: State)
Resolve detached (AgentMode::Dispatch): spawn the resolution on the
runtime and return immediately. The conversation does not wait; consumers
observe completion reactively via {name}:result.
Auto Trait Implementations§
impl Freeze for Resolver
impl !RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl !UnwindSafe for Resolver
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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>
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>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].