Task Builder • Rust AI Agent SDK

TaskBuilder: Builder for Task

TaskBuilder

Defined in the task module.

Rust AI Agent SDK

Builder for Task

Fields

NameTypeDescription
descriptionString–
nameOption<String>–
expected_outputString–
depends_onVec<String>–
next_tasksVec<String>–
conditionHashMap<String–
configTaskConfig–
output_fileOption<String>–
output_variableOption<String>–
variablesHashMap<String–
serde_json:Value>–
task_typeTaskType–
is_startbool–

Methods

new

rust
fn new(description: impl Into<String>) -> Self

Create a new task builder

Parameters:

NameType
descriptionimpl Into&lt;String&gt;

name

rust
fn name(mut self, name: impl Into<String>) -> Self

Set task name

Parameters:

NameType
nameimpl Into&lt;String&gt;

expected_output

rust
fn expected_output(mut self, output: impl Into<String>) -> Self

Set expected output

Parameters:

NameType
outputimpl Into&lt;String&gt;

depends_on

rust
fn depends_on(mut self, task: impl Into<String>) -> Self

Add dependency

Parameters:

NameType
taskimpl Into&lt;String&gt;

next_task

rust
fn next_task(mut self, task: impl Into<String>) -> Self

Add next task

Parameters:

NameType
taskimpl Into&lt;String&gt;

task_type

rust
fn task_type(mut self, task_type: TaskType) -> Self

Set task type

Parameters:

NameType
task_typeTaskType

decision

rust
fn decision(mut self) -> Self

Set as decision task

loop_task

rust
fn loop_task(mut self) -> Self

Set as loop task

output_file

rust
fn output_file(mut self, path: impl Into<String>) -> Self

Set output file

Parameters:

NameType
pathimpl Into&lt;String&gt;

output_variable

rust
fn output_variable(mut self, name: impl Into<String>) -> Self

Set output variable

Parameters:

NameType
nameimpl Into&lt;String&gt;

variable

rust
fn variable(mut self, key: impl Into<String>, value: serde_json::Value) -> Self

Add variable

Parameters:

NameType
keyimpl Into&lt;String&gt;
valueserde_json::Value

max_retries

rust
fn max_retries(mut self, retries: u32) -> Self

Set max retries

Parameters:

NameType
retriesu32

on_error

rust
fn on_error(mut self, behavior: OnError) -> Self

Set error handling

Parameters:

NameType
behaviorOnError

is_start

rust
fn is_start(mut self, is_start: bool) -> Self

Set as start task

Parameters:

NameType
is_startbool

build

rust
fn build(self) -> Task

Build the task

Source

View on GitHub

praisonai/src/task/mod.rs at line 319


Related Documentation