Task Builder • Rust AI Agent SDK
TaskBuilder: Builder for Task
TaskBuilder
Defined in the task module.
Rust AI Agent SDK
Builder for Task
Fields
| Name | Type | Description |
|---|---|---|
description | String | – |
name | Option<String> | – |
expected_output | String | – |
depends_on | Vec<String> | – |
next_tasks | Vec<String> | – |
condition | HashMap<String | – |
config | TaskConfig | – |
output_file | Option<String> | – |
output_variable | Option<String> | – |
variables | HashMap<String | – |
serde_json | :Value> | – |
task_type | TaskType | – |
is_start | bool | – |
Methods
new
fn new(description: impl Into<String>) -> SelfCreate a new task builder
Parameters:
| Name | Type |
|---|---|
description | impl Into<String> |
name
fn name(mut self, name: impl Into<String>) -> SelfSet task name
Parameters:
| Name | Type |
|---|---|
name | impl Into<String> |
expected_output
fn expected_output(mut self, output: impl Into<String>) -> SelfSet expected output
Parameters:
| Name | Type |
|---|---|
output | impl Into<String> |
depends_on
fn depends_on(mut self, task: impl Into<String>) -> SelfAdd dependency
Parameters:
| Name | Type |
|---|---|
task | impl Into<String> |
next_task
fn next_task(mut self, task: impl Into<String>) -> SelfAdd next task
Parameters:
| Name | Type |
|---|---|
task | impl Into<String> |
task_type
fn task_type(mut self, task_type: TaskType) -> SelfSet task type
Parameters:
| Name | Type |
|---|---|
task_type | TaskType |
decision
fn decision(mut self) -> SelfSet as decision task
loop_task
fn loop_task(mut self) -> SelfSet as loop task
output_file
fn output_file(mut self, path: impl Into<String>) -> SelfSet output file
Parameters:
| Name | Type |
|---|---|
path | impl Into<String> |
output_variable
fn output_variable(mut self, name: impl Into<String>) -> SelfSet output variable
Parameters:
| Name | Type |
|---|---|
name | impl Into<String> |
variable
fn variable(mut self, key: impl Into<String>, value: serde_json::Value) -> SelfAdd variable
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
value | serde_json::Value |
max_retries
fn max_retries(mut self, retries: u32) -> SelfSet max retries
Parameters:
| Name | Type |
|---|---|
retries | u32 |
on_error
fn on_error(mut self, behavior: OnError) -> SelfSet error handling
Parameters:
| Name | Type |
|---|---|
behavior | OnError |
is_start
fn is_start(mut self, is_start: bool) -> SelfSet as start task
Parameters:
| Name | Type |
|---|---|
is_start | bool |
build
fn build(self) -> TaskBuild the task
Source
View on GitHubpraisonai/src/task/mod.rs at line 319