pub struct WorkflowTask {Show 30 fields
pub name: String,
pub task_reference_name: String,
pub task_type: TaskType,
pub input_parameters: HashMap<String, Value>,
pub description: Option<String>,
pub dynamic_task_name_param: Option<String>,
pub case_value_param: Option<String>,
pub case_expression: Option<String>,
pub script_expression: Option<String>,
pub decision_cases: HashMap<String, Vec<WorkflowTask>>,
pub dynamic_fork_tasks_param: Option<String>,
pub dynamic_fork_tasks_input_param_name: Option<String>,
pub default_case: Vec<WorkflowTask>,
pub fork_tasks: Vec<Vec<WorkflowTask>>,
pub start_delay: i32,
pub sub_workflow_param: Option<SubWorkflowParams>,
pub join_on: Vec<String>,
pub sink: Option<String>,
pub optional: bool,
pub async_complete: bool,
pub default_exclusive_join_task: Option<Vec<String>>,
pub loop_condition: Option<String>,
pub loop_over: Vec<WorkflowTask>,
pub retry_count: Option<i32>,
pub evaluator_type: Option<String>,
pub expression: Option<String>,
pub rate_limited: bool,
pub join_on_script: Option<String>,
pub on_state_change: Option<StateChangeConfig>,
pub task_definition: Option<EmbeddedTaskDef>,
}Expand description
A task definition within a workflow.
Fields§
§name: StringTask name.
task_reference_name: StringTask reference name (unique within workflow).
task_type: TaskTypeTask type.
input_parameters: HashMap<String, Value>Input parameters.
description: Option<String>Description.
dynamic_task_name_param: Option<String>Dynamic task name (for dynamic tasks).
case_value_param: Option<String>Case value (for switch tasks).
case_expression: Option<String>Case expression (for switch tasks).
script_expression: Option<String>Script expression (for inline tasks).
decision_cases: HashMap<String, Vec<WorkflowTask>>Decision cases (for switch tasks).
dynamic_fork_tasks_param: Option<String>Dynamic fork tasks param (for fork_join_dynamic).
dynamic_fork_tasks_input_param_name: Option<String>Dynamic fork tasks input param name.
default_case: Vec<WorkflowTask>Default case (for switch tasks).
fork_tasks: Vec<Vec<WorkflowTask>>Fork tasks (for fork_join).
start_delay: i32Start delay seconds.
sub_workflow_param: Option<SubWorkflowParams>Subworkflow param (for subworkflow tasks).
join_on: Vec<String>Join on (for join tasks).
sink: Option<String>Sink (for event tasks).
optional: boolOptional task flag.
async_complete: boolAsync complete flag (for wait tasks).
default_exclusive_join_task: Option<Vec<String>>Default exclusive join task (for exclusive_join).
loop_condition: Option<String>Loop condition (for do_while).
loop_over: Vec<WorkflowTask>Loop over (for do_while).
retry_count: Option<i32>Retry count.
evaluator_type: Option<String>Evaluator type (for inline tasks).
expression: Option<String>Expression (for inline tasks).
rate_limited: boolRate limited flag.
join_on_script: Option<String>Join on script (for join tasks with custom script).
on_state_change: Option<StateChangeConfig>State change configuration (for audit events).
task_definition: Option<EmbeddedTaskDef>Inline task definition (for embedded task defs).
Implementations§
Source§impl WorkflowTask
impl WorkflowTask
Sourcepub fn simple(name: impl Into<String>, task_ref_name: impl Into<String>) -> Self
pub fn simple(name: impl Into<String>, task_ref_name: impl Into<String>) -> Self
Create a simple task.
Sourcepub fn sub_workflow(
task_ref_name: impl Into<String>,
workflow_name: impl Into<String>,
) -> Self
pub fn sub_workflow( task_ref_name: impl Into<String>, workflow_name: impl Into<String>, ) -> Self
Create a subworkflow task.
Sourcepub fn http(task_ref_name: impl Into<String>, uri: impl Into<String>) -> Self
pub fn http(task_ref_name: impl Into<String>, uri: impl Into<String>) -> Self
Create an HTTP task.
Sourcepub fn list_mcp_tools(
task_ref_name: impl Into<String>,
mcp_server: impl Into<String>,
headers: Option<HashMap<String, String>>,
) -> Self
pub fn list_mcp_tools( task_ref_name: impl Into<String>, mcp_server: impl Into<String>, headers: Option<HashMap<String, String>>, ) -> Self
Create a LIST_MCP_TOOLS task — lists available tools from an MCP server.
Sourcepub fn inline(
task_ref_name: impl Into<String>,
script: impl Into<String>,
) -> Self
pub fn inline( task_ref_name: impl Into<String>, script: impl Into<String>, ) -> Self
Create an inline JavaScript task.
Sourcepub fn with_input(self, input: HashMap<String, Value>) -> Self
pub fn with_input(self, input: HashMap<String, Value>) -> Self
Set input parameters.
Sourcepub fn with_input_param(
self,
key: impl Into<String>,
value: impl Serialize,
) -> Self
pub fn with_input_param( self, key: impl Into<String>, value: impl Serialize, ) -> Self
Add a single input parameter.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set description.
Sourcepub fn switch(
task_ref_name: impl Into<String>,
case_expression: impl Into<String>,
) -> Self
pub fn switch( task_ref_name: impl Into<String>, case_expression: impl Into<String>, ) -> Self
Create a switch (decision) task with JavaScript expression.
Sourcepub fn switch_value_param(
task_ref_name: impl Into<String>,
case_expression: impl Into<String>,
) -> Self
pub fn switch_value_param( task_ref_name: impl Into<String>, case_expression: impl Into<String>, ) -> Self
Create a switch (decision) task with value_param evaluator.
Use this for simple value expressions like ${workflow.input.choice}
The evaluator_type is set to “value-param” which directly evaluates the expression.
Sourcepub fn with_switch_case(
self,
case_value: impl Into<String>,
tasks: Vec<WorkflowTask>,
) -> Self
pub fn with_switch_case( self, case_value: impl Into<String>, tasks: Vec<WorkflowTask>, ) -> Self
Add a switch case.
Sourcepub fn with_default_case(self, tasks: Vec<WorkflowTask>) -> Self
pub fn with_default_case(self, tasks: Vec<WorkflowTask>) -> Self
Set default case for switch.
Sourcepub fn fork(
task_ref_name: impl Into<String>,
branches: Vec<Vec<WorkflowTask>>,
) -> Self
pub fn fork( task_ref_name: impl Into<String>, branches: Vec<Vec<WorkflowTask>>, ) -> Self
Create a fork task for parallel execution.
Sourcepub fn join(task_ref_name: impl Into<String>, join_on: Vec<String>) -> Self
pub fn join(task_ref_name: impl Into<String>, join_on: Vec<String>) -> Self
Create a join task.
Sourcepub fn set_variable(task_ref_name: impl Into<String>) -> Self
pub fn set_variable(task_ref_name: impl Into<String>) -> Self
Create a set variable task.
Sourcepub fn terminate(
task_ref_name: impl Into<String>,
status: impl Into<String>,
) -> Self
pub fn terminate( task_ref_name: impl Into<String>, status: impl Into<String>, ) -> Self
Create a terminate task.
Sourcepub fn with_termination_reason(self, reason: impl Into<String>) -> Self
pub fn with_termination_reason(self, reason: impl Into<String>) -> Self
Set termination reason.
Sourcepub fn json_jq_transform(
task_ref_name: impl Into<String>,
query: impl Into<String>,
) -> Self
pub fn json_jq_transform( task_ref_name: impl Into<String>, query: impl Into<String>, ) -> Self
Create a JSON JQ transform task.
Sourcepub fn wait_duration(
task_ref_name: impl Into<String>,
duration: impl Into<String>,
) -> Self
pub fn wait_duration( task_ref_name: impl Into<String>, duration: impl Into<String>, ) -> Self
Create a wait task with duration.
Sourcepub fn event(task_ref_name: impl Into<String>, sink: impl Into<String>) -> Self
pub fn event(task_ref_name: impl Into<String>, sink: impl Into<String>) -> Self
Create an event task.
Sourcepub fn do_while(
task_ref_name: impl Into<String>,
loop_condition: impl Into<String>,
loop_tasks: Vec<WorkflowTask>,
) -> Self
pub fn do_while( task_ref_name: impl Into<String>, loop_condition: impl Into<String>, loop_tasks: Vec<WorkflowTask>, ) -> Self
Create a do-while loop task.
Sourcepub fn async_complete(self) -> Self
pub fn async_complete(self) -> Self
Set async complete (for wait tasks).
Sourcepub fn with_start_delay(self, seconds: i32) -> Self
pub fn with_start_delay(self, seconds: i32) -> Self
Set start delay in seconds.
Sourcepub fn with_state_change(self, config: StateChangeConfig) -> Self
pub fn with_state_change(self, config: StateChangeConfig) -> Self
Set state change configuration for audit events.
Sourcepub fn with_task_definition(self, task_def: EmbeddedTaskDef) -> Self
pub fn with_task_definition(self, task_def: EmbeddedTaskDef) -> Self
Set embedded task definition.
Sourcepub fn join_with_script(
task_ref_name: impl Into<String>,
join_on: Vec<String>,
script: impl Into<String>,
) -> Self
pub fn join_with_script( task_ref_name: impl Into<String>, join_on: Vec<String>, script: impl Into<String>, ) -> Self
Create a join task with custom script.
Sourcepub fn http_poll(
task_ref_name: impl Into<String>,
uri: impl Into<String>,
) -> Self
pub fn http_poll( task_ref_name: impl Into<String>, uri: impl Into<String>, ) -> Self
Create an HTTP Poll task.
Sourcepub fn with_polling_strategy(self, strategy: impl Into<String>) -> Self
pub fn with_polling_strategy(self, strategy: impl Into<String>) -> Self
Set polling strategy (FIXED, LINEAR_BACKOFF, or EXPONENTIAL_BACKOFF).
Sourcepub fn with_polling_interval(self, interval_secs: i64) -> Self
pub fn with_polling_interval(self, interval_secs: i64) -> Self
Set polling interval in seconds.
Sourcepub fn with_termination_condition(self, script: impl Into<String>) -> Self
pub fn with_termination_condition(self, script: impl Into<String>) -> Self
Set termination condition script for HTTP Poll.
Sourcepub fn wait_for_webhook(task_ref_name: impl Into<String>) -> Self
pub fn wait_for_webhook(task_ref_name: impl Into<String>) -> Self
Create a wait for webhook task.
Sourcepub fn with_matches(self, matches: HashMap<String, String>) -> Self
pub fn with_matches(self, matches: HashMap<String, String>) -> Self
Set webhook matches configuration.
Sourcepub fn llm_text_complete(
task_ref_name: impl Into<String>,
llm_provider: impl Into<String>,
model: impl Into<String>,
prompt_name: impl Into<String>,
) -> Self
pub fn llm_text_complete( task_ref_name: impl Into<String>, llm_provider: impl Into<String>, model: impl Into<String>, prompt_name: impl Into<String>, ) -> Self
Create an LLM text complete task.
Sourcepub fn llm_chat_complete(
task_ref_name: impl Into<String>,
llm_provider: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn llm_chat_complete( task_ref_name: impl Into<String>, llm_provider: impl Into<String>, model: impl Into<String>, ) -> Self
Create an LLM chat complete task.
Sourcepub fn with_instructions_template(
self,
template_name: impl Into<String>,
) -> Self
pub fn with_instructions_template( self, template_name: impl Into<String>, ) -> Self
Set instructions template for LLM tasks.
Sourcepub fn with_messages(self, messages: Vec<ChatMessage>) -> Self
pub fn with_messages(self, messages: Vec<ChatMessage>) -> Self
Set messages for chat complete.
Sourcepub fn with_temperature(self, temp: f32) -> Self
pub fn with_temperature(self, temp: f32) -> Self
Set temperature for LLM tasks.
Sourcepub fn with_max_tokens(self, tokens: i32) -> Self
pub fn with_max_tokens(self, tokens: i32) -> Self
Set max tokens for LLM tasks.
Sourcepub fn with_top_p(self, top_p: f32) -> Self
pub fn with_top_p(self, top_p: f32) -> Self
Set top_p for LLM tasks.
Sourcepub fn with_prompt_variables(self, variables: HashMap<String, Value>) -> Self
pub fn with_prompt_variables(self, variables: HashMap<String, Value>) -> Self
Set prompt variables for LLM tasks.
Sourcepub fn with_prompt_variable(
self,
key: impl Into<String>,
value: impl Into<Value>,
) -> Self
pub fn with_prompt_variable( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self
Add a single prompt variable.
Sourcepub fn llm_generate_embeddings(
task_ref_name: impl Into<String>,
llm_provider: impl Into<String>,
model: impl Into<String>,
text: impl Into<String>,
) -> Self
pub fn llm_generate_embeddings( task_ref_name: impl Into<String>, llm_provider: impl Into<String>, model: impl Into<String>, text: impl Into<String>, ) -> Self
Create an LLM generate embeddings task.
Sourcepub fn llm_search_index(
task_ref_name: impl Into<String>,
vector_db: impl Into<String>,
index: impl Into<String>,
query: impl Into<String>,
) -> Self
pub fn llm_search_index( task_ref_name: impl Into<String>, vector_db: impl Into<String>, index: impl Into<String>, query: impl Into<String>, ) -> Self
Create an LLM search index task.
Sourcepub fn llm_search_embeddings(
task_ref_name: impl Into<String>,
vector_db: impl Into<String>,
index: impl Into<String>,
embeddings: Vec<f64>,
) -> Self
pub fn llm_search_embeddings( task_ref_name: impl Into<String>, vector_db: impl Into<String>, index: impl Into<String>, embeddings: Vec<f64>, ) -> Self
Create an LLM search-by-embedding task – searches a vector database using a
pre-computed embedding vector, as opposed to WorkflowTask::llm_search_index, which
searches by query text.
Sourcepub fn generate_image(
task_ref_name: impl Into<String>,
llm_provider: impl Into<String>,
model: impl Into<String>,
prompt: impl Into<String>,
) -> Self
pub fn generate_image( task_ref_name: impl Into<String>, llm_provider: impl Into<String>, model: impl Into<String>, prompt: impl Into<String>, ) -> Self
Create an image-generation task.
Sourcepub fn generate_audio(
task_ref_name: impl Into<String>,
llm_provider: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn generate_audio( task_ref_name: impl Into<String>, llm_provider: impl Into<String>, model: impl Into<String>, ) -> Self
Create an audio-generation (text-to-speech) task.
Sourcepub fn with_namespace(self, namespace: impl Into<String>) -> Self
pub fn with_namespace(self, namespace: impl Into<String>) -> Self
Set namespace for vector DB tasks.
Sourcepub fn with_max_results(self, max: i32) -> Self
pub fn with_max_results(self, max: i32) -> Self
Set max results for search tasks.
Sourcepub fn with_embedding_model(
self,
provider: impl Into<String>,
model: impl Into<String>,
) -> Self
pub fn with_embedding_model( self, provider: impl Into<String>, model: impl Into<String>, ) -> Self
Set embedding model for vector DB tasks.
Sourcepub fn with_dimensions(self, dimensions: i32) -> Self
pub fn with_dimensions(self, dimensions: i32) -> Self
Set embedding vector dimensions, for WorkflowTask::llm_search_embeddings.
Sourcepub fn with_n(self, n: i32) -> Self
pub fn with_n(self, n: i32) -> Self
Set the number of outputs to generate, for WorkflowTask::generate_image/
WorkflowTask::generate_audio.
Sourcepub fn with_image_dimensions(self, width: i32, height: i32) -> Self
pub fn with_image_dimensions(self, width: i32, height: i32) -> Self
Override the default 1024x1024 size, for WorkflowTask::generate_image.
Sourcepub fn with_size(self, size: impl Into<String>) -> Self
pub fn with_size(self, size: impl Into<String>) -> Self
Set a size specification (e.g. "1024x1024"), as an alternative to
WorkflowTask::with_image_dimensions, for WorkflowTask::generate_image.
Sourcepub fn with_style(self, style: impl Into<String>) -> Self
pub fn with_style(self, style: impl Into<String>) -> Self
Set image style (e.g. "natural", "vivid"), for WorkflowTask::generate_image.
Sourcepub fn with_weight(self, weight: f64) -> Self
pub fn with_weight(self, weight: f64) -> Self
Set the image weight parameter, for WorkflowTask::generate_image.
Sourcepub fn with_output_format(self, format: impl Into<String>) -> Self
pub fn with_output_format(self, format: impl Into<String>) -> Self
Override the default "png" output format, for WorkflowTask::generate_image.
Sourcepub fn with_text(self, text: impl Into<String>) -> Self
pub fn with_text(self, text: impl Into<String>) -> Self
Set the text to convert to speech, for WorkflowTask::generate_audio.
Sourcepub fn with_voice(self, voice: impl Into<String>) -> Self
pub fn with_voice(self, voice: impl Into<String>) -> Self
Set the voice, for WorkflowTask::generate_audio.
Sourcepub fn with_speed(self, speed: f64) -> Self
pub fn with_speed(self, speed: f64) -> Self
Set the speech speed multiplier, for WorkflowTask::generate_audio.
Sourcepub fn with_response_format(self, format: impl Into<String>) -> Self
pub fn with_response_format(self, format: impl Into<String>) -> Self
Set the audio response format (e.g. "mp3", "wav"), for
WorkflowTask::generate_audio.
Sourcepub fn with_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_prompt(self, prompt: impl Into<String>) -> Self
Set an alternative prompt, for WorkflowTask::generate_audio.
Sourcepub fn llm_index_text(
task_ref_name: impl Into<String>,
vector_db: impl Into<String>,
index: impl Into<String>,
text: impl Into<String>,
doc_id: impl Into<String>,
) -> Self
pub fn llm_index_text( task_ref_name: impl Into<String>, vector_db: impl Into<String>, index: impl Into<String>, text: impl Into<String>, doc_id: impl Into<String>, ) -> Self
Create an LLM index text task.
Sourcepub fn llm_index_document(
task_ref_name: impl Into<String>,
vector_db: impl Into<String>,
index: impl Into<String>,
url: impl Into<String>,
doc_id: impl Into<String>,
) -> Self
pub fn llm_index_document( task_ref_name: impl Into<String>, vector_db: impl Into<String>, index: impl Into<String>, url: impl Into<String>, doc_id: impl Into<String>, ) -> Self
Create an LLM index document task.
Sourcepub fn with_media_type(self, media_type: impl Into<String>) -> Self
pub fn with_media_type(self, media_type: impl Into<String>) -> Self
Set media type for document tasks.
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
Set metadata for indexing tasks.