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 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 call(tool: impl Into<String>, args: Value) -> ToolExpr
pub fn call(tool: impl Into<String>, args: Value) -> ToolExpr
Create a simple tool call expression
Sourcepub fn sequence(steps: Vec<ToolExpr>) -> ToolExpr
pub fn sequence(steps: Vec<ToolExpr>) -> ToolExpr
Create a sequence expression with fail_fast=true
Sourcepub fn sequence_with_fail_fast(
steps: Vec<ToolExpr>,
fail_fast: bool,
) -> ToolExpr
pub fn sequence_with_fail_fast( steps: Vec<ToolExpr>, fail_fast: bool, ) -> ToolExpr
Create a sequence expression with custom fail_fast
Sourcepub fn parallel_with_wait(
branches: Vec<ToolExpr>,
wait: ParallelWait,
) -> ToolExpr
pub fn parallel_with_wait( branches: Vec<ToolExpr>, wait: ParallelWait, ) -> ToolExpr
Create a parallel expression with custom wait strategy
Sourcepub fn choice(condition: Condition, then_branch: ToolExpr) -> ToolExpr
pub fn choice(condition: Condition, then_branch: ToolExpr) -> ToolExpr
Create a conditional expression
Sourcepub fn choice_with_else(
condition: Condition,
then_branch: ToolExpr,
else_branch: ToolExpr,
) -> ToolExpr
pub fn choice_with_else( condition: Condition, then_branch: ToolExpr, else_branch: ToolExpr, ) -> ToolExpr
Create a conditional expression with else branch
Sourcepub fn retry_with_params(
expr: ToolExpr,
max_attempts: u32,
delay_ms: u64,
) -> ToolExpr
pub fn retry_with_params( expr: ToolExpr, max_attempts: u32, delay_ms: u64, ) -> ToolExpr
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<ToolExpr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ToolExpr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ToolExpr
impl Serialize for ToolExpr
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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