Skip to main content

Tasks in workflows

When building workflows, you can use the built-in system tasks and operators provided by Conductor and additionally write your own custom worker tasks to implement custom logic.

Built-in tasks

Here is an introduction of the built-in tasks available in Conductor. These system tasks and operators enable you to quickly build workflows without needing to code.

  • System tasks are managed by Conductor and run within its JVM, allowing you to get started quickly without needing custom workers. System tasks include AI tasks that can be used to build AI-powered and agentic applications.
  • Operators are also managed by Conductor and run within its JVM. They enable you to declaratively design the workflow control flow and logic with minimal code required.

For control flow

The control structures and operations in your Conductor workflow are implemented as tasks. Here are the tasks available for managing the flow of execution:

  • Conditional flow
    • Switch—Execute tasks conditionally, like an if…else… statement.
  • Looping flow
    • Do While—Execute tasks repeatedly, like a do…while… statement.
  • Parallel flows
    • Fork—Execute a static number of tasks in parallel.
    • Dynamic Fork—Execute a dynamic number of tasks in parallel.
    • Join—Join the forks after a Fork or Dynamic Fork before proceeding to the next task.
    • Start Workflow—Asynchronously start another workflow.
  • Jumps or state changes in flow
    • Terminate—Terminate the current workflow, like a return statement.
    • Sub Workflow—Synchronously start another workflow, like a subroutine.
    • Terminate Workflow—Terminate another ongoing workflow.
    • Update Task—Update the status of another ongoing task.
  • State querying
    • Get Workflow—Get the execution details of another ongoing workflow.
  • Waits in flow
    • Wait—Pause the current workflow until a set time, duration, or signal is received.
    • Wait for Webhook—Pause the current workflow for an incoming webhook signal.
    • Human–Pause the current workflow for user input before proceeding to the next task.
  • Dynamic tasks in flow
    • Dynamic—Execute a task dynamically, like a function pointer.

For assigning variables

In general, variables are bounded within each task and passed along in the workflow as necessary. However, you can also handle variables or secrets at a global environment or workflow level.

For execution logic

In most common cases, you can make use of existing Conductor features instead of creating a custom worker from scratch. These include tasks for data transformation, user journeys, and LLM chaining.

Use CaseTask to Use
Call an API or HTTP endpointHTTP
Poll an API or HTTP endpointHTTP Poll
Publish or consume eventsEvent
Clean or transform JSON dataJSON JQ
Modify SQL databasesJDBC
Execute JavaScript scriptsInline
Evaluate and retrieve data in spreadsheetsBusiness Rule
Get authorized using a signed JWTGet Signed JWT
Orchestrate human input in the loopHuman
Query data from Conductor Search API or MetricsQuery Processor
Send alerts to OpsgenieOpsgenie
Retrieve text or JSON content from a URLGet Document
Generate text embeddingsGenerate Embeddings
Store text embeddings in a vector databaseStore Embeddings
Generate and store text embeddings in a vector databaseIndex Text
Chunk, generate, and store text embeddings in a vector databaseIndex Document
Retrieve data from a vector databaseGet Embeddings
Retrieve data from a vector database based on a search querySearch Index
Generate text from an LLM based on a defined promptText Complete
Generate text from an LLM based on a user query and additional system/assistant instructionsChat Complete

Custom tasks

A Worker task can be used to implement custom logic outside the scope of Conductor’s system tasks. These tasks can be written in any programming language of your choice (Python, Java, JavaScript, C#, Go, and Clojure).

Refer to Writing Workers for Conductor Workflows for more information.

Task definition

A task definition specifies a task’s general implementation details, like the expected input and output keys, and failure-handling configurations, like rate limits, retries, and timeouts. This definition applies to all instances of the task across workflows.

All task definitions are stored as JSON. These parameters can be updated in real time without needing to redeploy your application.

Example

Here is an example task definition JSON:

{
"createTime": 1721901586970,
"updateTime": 1725926875230,
"createdBy": "user@acme.com",
"updatedBy": "user@acme.com",
"name": "calculate-fx",
"description": "Calculates currency exchange",
"retryCount": 0,
"timeoutSeconds": 3600,
"inputKeys": [],
"outputKeys": [],
"timeoutPolicy": "TIME_OUT_WF",
"retryLogic": "EXPONENTIAL_BACKOFF",
"retryDelaySeconds": 30,
"responseTimeoutSeconds": 600,
"concurrentExecLimit": 20,
"inputTemplate": {},
"rateLimitPerFrequency": 10,
"rateLimitFrequencyInSeconds": 1,
"ownerEmail": "user@acme.com",
"pollTimeoutSeconds": 3600,
"backoffScaleFactor": 1,
"enforceSchema": false
}

Task registration

The following task types must be registered as a task definition in Conductor before they can be used in a workflow:

  • Worker tasks
  • Human tasks

Task definitions enable configuration of the task’s failure handling settings, as well as RBAC governance. You may also choose to create a task definition for other system tasks if required.

Task definitions can be registered via the Conductor UI or through SDK/API. Once registered, they can be referenced and used in different workflows.

Task configuration

The task configuration is part of the workflow definition. It specifies the workflow-specific implementation details, like the task reference name, task type, task input parameters, and so on.

Although each task type has its unique configuration, all tasks share several parameters in common.

  • For all tasks, the configuration specifies the input parameters.
  • For custom worker tasks, the configuration contains a reference to a registered worker.
  • For system tasks and operators, the configuration includes parameters that control the task behavior. For example, the configuration for an HTTP task specifies the endpoint URL and the payload template, which will be used during task execution.

Refer to the Task Reference to learn more about the task configuration for each task type.

Common configuration parameters

The task configurations appear in the tasks array of the workflow definition JSON. Each task configuration JSON object may contain the following parameters:

ParameterDescriptionRequired/ Optional
nameName of the task. The default value is the same as the task type.

The name can be changed to something descriptive. To use a given task definition, the task name here must match the task definition name (case-sensitive).

Note: It is recommended to use alphanumeric characters for task names. While special characters are allowed for backward compatibility, they are not fully supported and may cause unexpected behavior.
Required.
taskReferenceNameReference name for the task.

Must be a unique value in a given workflow.
Required.
typeThe task type. For example, HTTP, SIMPLE.Required.
inputParametersMap of the task’s input parameters.Depends on the task type.
optionalWhether the task is optional.

If set to true, the workflow continues to the next task even if this task fails or remains incomplete.
Optional.
asyncCompleteWhether the task is completed asynchronously. The default value is false. Supported values:
  • false—Task status is set to COMPLETED upon successful execution.
  • true—Task status is kept as IN_PROGRESS until an external event completes it.
Optional.
startDelayThe time in seconds to wait before making the task available for worker polling. The default value is 0.Optional.
onStateChangeConfiguration for publishing an event or starting another task when this task status changes.Optional.

Passing data between tasks

Data can be passed from one task to another, by using dynamic references in a task’s inputParameters. These dynamic references are formatted as JSONPath expressions. Refer to Wiring Parameters to learn more.

Task reuse

Since task workers typically perform a unit of work as part of a larger workflow, Conductor’s infrastructure is built to enable task reusability out of the box. Once a task is defined in Conductor, it can be reused numerous times:

  • In the same workflow, using different task reference names.
  • Across various workflows.

When reusing tasks, it's important to think of situations that a multi-tenant system faces. By default, all the work assigned to this worker goes into the same task queue. This could result in your worker not being polled quickly if there is a noisy neighbor in the ecosystem. You can tackle this situation by scaling up the number of workers to handle the task load, or even using task-to-domain to route the task load into separate queues.