pub struct RouteTextAgent { /* private fields */ }Expand description
State-driven deterministic branching — evaluates predicates in order, dispatches to the first matching agent. Falls back to default if none match.
Implementations§
Source§impl RouteTextAgent
impl RouteTextAgent
Sourcepub fn new(
name: impl Into<String>,
rules: Vec<RouteRule>,
default: Arc<dyn TextAgent>,
) -> Self
pub fn new( name: impl Into<String>, rules: Vec<RouteRule>, default: Arc<dyn TextAgent>, ) -> Self
Create a new route agent with rules and a default fallback.
Sourcepub fn with_middleware_chain(self, chain: MiddlewareChain) -> Self
pub fn with_middleware_chain(self, chain: MiddlewareChain) -> Self
Attach a middleware chain. AgentEvent::RouteSelected is emitted through
it with the chosen branch, so on_event observers (M::on_route) fire.
Trait Implementations§
Source§impl TextAgent for RouteTextAgent
impl TextAgent for RouteTextAgent
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 State,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute this agent. Reads/writes
state. Returns the final text output.Auto Trait Implementations§
impl Freeze for RouteTextAgent
impl !RefUnwindSafe for RouteTextAgent
impl Send for RouteTextAgent
impl Sync for RouteTextAgent
impl Unpin for RouteTextAgent
impl !UnwindSafe for RouteTextAgent
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