Routing
Route requests between agents
Routing directs requests to appropriate agents.
Quick Start
- Route Requests to Agents
rust use praisonai::{Agent, when}; // Create specialized agents let coder = Agent::new() .name("Coder") .instructions("You help with programming tasks") .build()?; let writer = Agent::new() .name("Writer") .instructions("You help with writing tasks") .build()?; // Route based on input content let router = when(|input: &str| input.contains("code")) .then(coder) .otherwise(writer); router.run("Help me write code").await?; // Routes to coder agent - Multi-Route Configuration
rust use praisonai::when; let router = when(|i| i.contains("code")) .then(coder) .when(|i| i.contains("write")) .then(writer) .otherwise(general);