Skip to main content

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

fn new(description: impl Into<String>) -> Self
Create a new task builder Parameters:
NameType
descriptionimpl Into&lt;String&gt;

name

fn name(mut self, name: impl Into<String>) -> Self
Set task name Parameters:
NameType
nameimpl Into&lt;String&gt;

expected_output

fn expected_output(mut self, output: impl Into<String>) -> Self
Set expected output Parameters:
NameType
outputimpl Into&lt;String&gt;

depends_on

fn depends_on(mut self, task: impl Into<String>) -> Self
Add dependency Parameters:
NameType
taskimpl Into&lt;String&gt;

next_task

fn next_task(mut self, task: impl Into<String>) -> Self
Add next task Parameters:
NameType
taskimpl Into&lt;String&gt;

task_type

fn task_type(mut self, task_type: TaskType) -> Self
Set task type Parameters:
NameType
task_typeTaskType

decision

fn decision(mut self) -> Self
Set as decision task

loop_task

fn loop_task(mut self) -> Self
Set as loop task

output_file

fn output_file(mut self, path: impl Into<String>) -> Self
Set output file Parameters:
NameType
pathimpl Into&lt;String&gt;

output_variable

fn output_variable(mut self, name: impl Into<String>) -> Self
Set output variable Parameters:
NameType
nameimpl Into&lt;String&gt;

variable

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

fn max_retries(mut self, retries: u32) -> Self
Set max retries Parameters:
NameType
retriesu32

on_error

fn on_error(mut self, behavior: OnError) -> Self
Set error handling Parameters:
NameType
behaviorOnError

is_start

fn is_start(mut self, is_start: bool) -> Self
Set as start task Parameters:
NameType
is_startbool

build

fn build(self) -> Task
Build the task

Source

View on GitHub

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