Skip to main content

WorkflowTask

Struct WorkflowTask 

Source
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: String

Task name.

§task_reference_name: String

Task reference name (unique within workflow).

§task_type: TaskType

Task 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: i32

Start 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: bool

Optional task flag.

§async_complete: bool

Async 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: bool

Rate 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

Source

pub fn simple(name: impl Into<String>, task_ref_name: impl Into<String>) -> Self

Create a simple task.

Source

pub fn sub_workflow( task_ref_name: impl Into<String>, workflow_name: impl Into<String>, ) -> Self

Create a subworkflow task.

Source

pub fn wait(task_ref_name: impl Into<String>) -> Self

Create a wait task.

Source

pub fn http(task_ref_name: impl Into<String>, uri: impl Into<String>) -> Self

Create an HTTP task.

Source

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.

Source

pub fn inline( task_ref_name: impl Into<String>, script: impl Into<String>, ) -> Self

Create an inline JavaScript task.

Source

pub fn with_input(self, input: HashMap<String, Value>) -> Self

Set input parameters.

Source

pub fn with_input_param( self, key: impl Into<String>, value: impl Serialize, ) -> Self

Add a single input parameter.

Source

pub fn with_description(self, desc: impl Into<String>) -> Self

Set description.

Source

pub fn optional(self) -> Self

Mark as optional.

Source

pub fn switch( task_ref_name: impl Into<String>, case_expression: impl Into<String>, ) -> Self

Create a switch (decision) task with JavaScript expression.

Source

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.

Source

pub fn with_switch_case( self, case_value: impl Into<String>, tasks: Vec<WorkflowTask>, ) -> Self

Add a switch case.

Source

pub fn with_default_case(self, tasks: Vec<WorkflowTask>) -> Self

Set default case for switch.

Source

pub fn fork( task_ref_name: impl Into<String>, branches: Vec<Vec<WorkflowTask>>, ) -> Self

Create a fork task for parallel execution.

Source

pub fn join(task_ref_name: impl Into<String>, join_on: Vec<String>) -> Self

Create a join task.

Source

pub fn set_variable(task_ref_name: impl Into<String>) -> Self

Create a set variable task.

Source

pub fn terminate( task_ref_name: impl Into<String>, status: impl Into<String>, ) -> Self

Create a terminate task.

Source

pub fn with_termination_reason(self, reason: impl Into<String>) -> Self

Set termination reason.

Source

pub fn json_jq_transform( task_ref_name: impl Into<String>, query: impl Into<String>, ) -> Self

Create a JSON JQ transform task.

Source

pub fn wait_duration( task_ref_name: impl Into<String>, duration: impl Into<String>, ) -> Self

Create a wait task with duration.

Source

pub fn event(task_ref_name: impl Into<String>, sink: impl Into<String>) -> Self

Create an event task.

Source

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.

Source

pub fn human(task_ref_name: impl Into<String>) -> Self

Create a human task.

Source

pub fn async_complete(self) -> Self

Set async complete (for wait tasks).

Source

pub fn with_start_delay(self, seconds: i32) -> Self

Set start delay in seconds.

Source

pub fn with_state_change(self, config: StateChangeConfig) -> Self

Set state change configuration for audit events.

Source

pub fn with_task_definition(self, task_def: EmbeddedTaskDef) -> Self

Set embedded task definition.

Source

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.

Source

pub fn http_poll( task_ref_name: impl Into<String>, uri: impl Into<String>, ) -> Self

Create an HTTP Poll task.

Source

pub fn with_polling_strategy(self, strategy: impl Into<String>) -> Self

Set polling strategy (FIXED, LINEAR_BACKOFF, or EXPONENTIAL_BACKOFF).

Source

pub fn with_polling_interval(self, interval_secs: i64) -> Self

Set polling interval in seconds.

Source

pub fn with_termination_condition(self, script: impl Into<String>) -> Self

Set termination condition script for HTTP Poll.

Source

pub fn wait_for_webhook(task_ref_name: impl Into<String>) -> Self

Create a wait for webhook task.

Source

pub fn with_matches(self, matches: HashMap<String, String>) -> Self

Set webhook matches configuration.

Source

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.

Source

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.

Source

pub fn with_instructions_template( self, template_name: impl Into<String>, ) -> Self

Set instructions template for LLM tasks.

Source

pub fn with_messages(self, messages: Vec<ChatMessage>) -> Self

Set messages for chat complete.

Source

pub fn with_temperature(self, temp: f32) -> Self

Set temperature for LLM tasks.

Source

pub fn with_max_tokens(self, tokens: i32) -> Self

Set max tokens for LLM tasks.

Source

pub fn with_top_p(self, top_p: f32) -> Self

Set top_p for LLM tasks.

Source

pub fn with_prompt_variables(self, variables: HashMap<String, Value>) -> Self

Set prompt variables for LLM tasks.

Source

pub fn with_prompt_variable( self, key: impl Into<String>, value: impl Into<Value>, ) -> Self

Add a single prompt variable.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn with_namespace(self, namespace: impl Into<String>) -> Self

Set namespace for vector DB tasks.

Source

pub fn with_max_results(self, max: i32) -> Self

Set max results for search tasks.

Source

pub fn with_embedding_model( self, provider: impl Into<String>, model: impl Into<String>, ) -> Self

Set embedding model for vector DB tasks.

Source

pub fn with_dimensions(self, dimensions: i32) -> Self

Set embedding vector dimensions, for WorkflowTask::llm_search_embeddings.

Source

pub fn with_n(self, n: i32) -> Self

Set the number of outputs to generate, for WorkflowTask::generate_image/ WorkflowTask::generate_audio.

Source

pub fn with_image_dimensions(self, width: i32, height: i32) -> Self

Override the default 1024x1024 size, for WorkflowTask::generate_image.

Source

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.

Source

pub fn with_style(self, style: impl Into<String>) -> Self

Set image style (e.g. "natural", "vivid"), for WorkflowTask::generate_image.

Source

pub fn with_weight(self, weight: f64) -> Self

Set the image weight parameter, for WorkflowTask::generate_image.

Source

pub fn with_output_format(self, format: impl Into<String>) -> Self

Override the default "png" output format, for WorkflowTask::generate_image.

Source

pub fn with_text(self, text: impl Into<String>) -> Self

Set the text to convert to speech, for WorkflowTask::generate_audio.

Source

pub fn with_voice(self, voice: impl Into<String>) -> Self

Set the voice, for WorkflowTask::generate_audio.

Source

pub fn with_speed(self, speed: f64) -> Self

Set the speech speed multiplier, for WorkflowTask::generate_audio.

Source

pub fn with_response_format(self, format: impl Into<String>) -> Self

Set the audio response format (e.g. "mp3", "wav"), for WorkflowTask::generate_audio.

Source

pub fn with_prompt(self, prompt: impl Into<String>) -> Self

Set an alternative prompt, for WorkflowTask::generate_audio.

Source

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.

Source

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.

Source

pub fn with_media_type(self, media_type: impl Into<String>) -> Self

Set media type for document tasks.

Source

pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self

Set metadata for indexing tasks.

Source

pub fn dynamic( task_ref_name: impl Into<String>, dynamic_task_name: impl Into<String>, ) -> Self

Create a dynamic task.

Source

pub fn get_document( task_ref_name: impl Into<String>, url: impl Into<String>, ) -> Self

Create a get document task.

Trait Implementations§

Source§

impl Clone for WorkflowTask

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkflowTask

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WorkflowTask

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for WorkflowTask

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for WorkflowTask

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more