Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Task
Defined in the task module.
Rust AI Agent SDK
A unit of work that can be executed by an Agent
Fields
| Name | Type | Description |
|---|
id | String | Unique task ID |
name | Option<String> | Task name (optional) |
description | String | Task description (what to do) |
expected_output | String | Expected output description |
status | TaskStatus | Task status |
task_type | TaskType | Task type |
result | Option<TaskOutput> | Task result |
depends_on | Vec<String> | Dependencies (task IDs or names) |
next_tasks | Vec<String> | Next tasks to execute |
condition | HashMap<String | Condition for routing (decision tasks) |
config | TaskConfig | Task configuration |
output_file | Option<String> | Output file path |
output_variable | Option<String> | Output variable name |
variables | HashMap<String | Variables for substitution |
serde_json | :Value> | Variables for substitution |
retry_count | u32 | Retry count |
is_start | bool | Is this the start task? |
Methods
new
fn new(description: impl Into<String>) -> TaskBuilder
Create a new task with description
Parameters:
| Name | Type |
|---|
description | impl Into<String> |
Get task ID
display_name
fn display_name(&self) -> &str
Get task name or description
is_completed
fn is_completed(&self) -> bool
Check if task is completed
is_failed
fn is_failed(&self) -> bool
Check if task failed
can_retry
fn can_retry(&self) -> bool
Check if task can be retried
increment_retry
fn increment_retry(&mut self) -> ()
Increment retry count
set_result
fn set_result(&mut self, output: TaskOutput) -> ()
Set task result
Parameters:
set_failed
fn set_failed(&mut self, error: &str) -> ()
Set task as failed
Parameters:
result_str
fn result_str(&self) -> Option<&str>
Get result as string
substitute_variables
fn substitute_variables(&self, context: &HashMap<String, String>) -> String
Substitute variables in description
Parameters:
| Name | Type |
|---|
context | &HashMap<String |
Source
View on GitHub
praisonai/src/task/mod.rs at line 186