route • Rust AI Agent SDK

route: Create a route workflow step Conditionally routes to different agents based on a condition. # Arguments * `condition` – Function that returns…

route

Function

</div>

This function is defined in the workflow_aliases module.

Create a route workflow step Conditionally routes to different agents based on a condition. # Arguments condition – Function that returns true/false to determine routing if_true – Agent to execute if condition is true * if_false – Optional agent to execute if condition is false

Signature

python
def route(
    condition: F,
    if_true: Arc<crate::agent::Agent>,
    if_false: Option<Arc<crate::agent::Agent>>,
) -> crate::workflows::FlowStep
where
    F: Fn(&str) -> bool + Send + Sync + 'static,

Parameters

ParamField F

No description available.

ParamField Arc&lt;crate::agent::Agent&gt;

No description available.

ParamField Option&lt;Arc&lt;crate::agent::Agent&gt;&gt;

No description available.

Returns

ResponseField

bool + Send + Sync + ‘static,”> The result of the operation.

Source

View on GitHub

praisonai/src/parity/workflow_aliases.rs at line 105


Related Documentation