pub enum ToolExpr {
Call {
tool: String,
args: Value,
},
Sequence {
steps: Vec<ToolExpr>,
fail_fast: bool,
},
Parallel {
branches: Vec<ToolExpr>,
wait: ParallelWait,
},
Choice {
condition: Condition,
then_branch: Box<ToolExpr>,
else_branch: Option<Box<ToolExpr>>,
},
Retry {
expr: Box<ToolExpr>,
max_attempts: u32,
delay_ms: u64,
},
Let {
var: String,
expr: Box<ToolExpr>,
body: Box<ToolExpr>,
},
Var(String),
}Expand description
Tool expression DSL for composing tool calls
This enum represents the AST (Abstract Syntax Tree) for the tool composition DSL. Each variant represents a different composition operation.
Variants§
Call
Execute a single tool call
Fields
Sequence
Execute a sequence of expressions
Fields
Parallel
Execute branches in parallel
Fields
§
wait: ParallelWaitWait strategy: All, First, or Any
Choice
Conditional execution
Fields
Retry
Retry with backoff
Fields
Let
Variable binding
Fields
Var(String)
Variable reference
Implementations§
Source§impl ToolExpr
impl ToolExpr
Sourcepub fn sequence_with_fail_fast(steps: Vec<ToolExpr>, fail_fast: bool) -> Self
pub fn sequence_with_fail_fast(steps: Vec<ToolExpr>, fail_fast: bool) -> Self
Create a sequence expression with custom fail_fast
Sourcepub fn parallel_with_wait(branches: Vec<ToolExpr>, wait: ParallelWait) -> Self
pub fn parallel_with_wait(branches: Vec<ToolExpr>, wait: ParallelWait) -> Self
Create a parallel expression with custom wait strategy
Sourcepub fn choice(condition: Condition, then_branch: ToolExpr) -> Self
pub fn choice(condition: Condition, then_branch: ToolExpr) -> Self
Create a conditional expression
Sourcepub fn choice_with_else(
condition: Condition,
then_branch: ToolExpr,
else_branch: ToolExpr,
) -> Self
pub fn choice_with_else( condition: Condition, then_branch: ToolExpr, else_branch: ToolExpr, ) -> Self
Create a conditional expression with else branch
Sourcepub fn retry_with_params(
expr: ToolExpr,
max_attempts: u32,
delay_ms: u64,
) -> Self
pub fn retry_with_params( expr: ToolExpr, max_attempts: u32, delay_ms: u64, ) -> Self
Create a retry expression with custom parameters
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolExpr
impl<'de> Deserialize<'de> for ToolExpr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for ToolExpr
Auto Trait Implementations§
impl Freeze for ToolExpr
impl RefUnwindSafe for ToolExpr
impl Send for ToolExpr
impl Sync for ToolExpr
impl Unpin for ToolExpr
impl UnsafeUnpin for ToolExpr
impl UnwindSafe for ToolExpr
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