> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**workflow\_aliases**](../modules/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 theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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 query="condition" type="F" required={true}>
  No description available.
</ParamField>

<ParamField query="if_true" type="Arc<crate::agent::Agent>" required={true}>
  No description available.
</ParamField>

<ParamField query="if_false" type="Option<Arc<crate::agent::Agent>>" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField
  name="Returns"
  type="crate::workflows::FlowStep
where
F: Fn(&str) -> bool + Send + Sync + 'static,"
>
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/workflow_aliases.rs#L105">
  `praisonai/src/parity/workflow_aliases.rs` at line 105
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Routing" icon="route" href="/docs/rust/routing" />

  <Card title="Rust Router" icon="arrows-split" href="/docs/rust/router" />

  <Card title="Rust Conditions" icon="code-branch" href="/docs/rust/conditions" />
</CardGroup>
