Task Types

ReasonChip supports a variety of task types that form the backbone of any pipeline. Each task performs a specific role, but they all share a set of powerful features that provide control over execution flow, result handling, and logic.

Common Fields (Most Tasks)

These are common fields used across most task types. They provide consistent functionality for conditional logic, asynchronous execution, and result handling. Some fields are supported only in select task types.

  • name: A human-readable identifier for the task.
  • comment: A non-executing note or description.
  • log: Log level for task output (info, debug, trace).
  • when: Conditional expression. If false, the task is skipped.
  • loop: Repeats the task over a list, range, or object.
  • run_async: Runs the task asynchronously if true.
  • store_result_as: Saves the task result in a named variable.
  • append_result_into: Appends the result into a list variable (created if needed).
  • key_result_into: Stores the result into a dictionary under the given key.
  • return_result: Immediately returns the result from this task instead of continuing. The result is returned in a variable called "_".

Note: variables are injected directly, and params are interpolated. Use variables for static values, and params for templated input.

Loop context variables include:

  • item: The current item in the loop
  • loop.index: The counter of the loop, starting at 1
  • loop.index0: The counter of the loop, starting at 0
  • loop.first: True if the first iteration
  • loop.last: True if the last iteration
  • loop.even: True if iteration is even
  • loop.odd: True if iteration is odd
  • loop.revindex: Reverse counter starting at 1
  • loop.revindex0: Reverse counter starting at 0

TaskSet

Executes a group of tasks in sequence. Supports scoped variables and local result handling.

  • variables: Scoped variable declarations for the set.
  • tasks: A list of task definitions.

Supports all common fields.


- name: "Grouped steps"
  variables:
    greeting: "Hello"
  tasks:
    - chip: myapp.chips.say
      params:
        text: "{{ greeting }} {{ item }}"
    - chip: myapp.chips.wait
      params:
        seconds: 1
  loop: var(items)
	

DispatchTask

Calls another pipeline by name, optionally passing in variables and parameters. Execution resumes after the pipeline completes.

  • dispatch: Name of the pipeline to call
  • variables: Variables passed into the new pipeline context
  • params: Interpolated parameters passed into the new pipeline

Supports all common fields.


- name: "Run follow-up"
  dispatch: notifications.send_summary
  params:
    user_id: var(user.id)
	

BranchTask

Redirects execution to another pipeline permanently. Existing variables become global in the new branch. Control never returns to the current pipeline.

  • branch: Name of the new pipeline to redirect to
  • variables: Injected as-is
  • params: Interpolated parameters

Supports: name, comment, when, log


- branch: onboarding.start
  params:
    user_id: var(user.id)
	

ChipTask

Executes a registered chip with given parameters. Chips are reusable, named components.

  • chip: Fully qualified chip name
  • params: Interpolated arguments
  • variables: Injected values

Supports all common fields.


- chip: chatbot.send_message
  params:
    message: "Hello, {{ user.name }}"
  store_result_as: result
	

CodeTask

Executes inline code logic with access to current variables and inputs.

  • code: Python code as a string
  • params: Interpolated arguments
  • variables: Injected variables

Supports all common fields.


- code: |
	result = a + b
  params:
    a: 1
    b: 2
  store_result_as: sum
	

AssertTask

Asserts one or more boolean conditions. Fails if any are false.

  • assert: A condition or list of conditions to assert

Supports: name, comment, when, log, loop


- assert:
    - user.age > 0
    - user.active == true
	

ReturnTask

Ends the current task set or pipeline early and returns a value to the caller.

  • return: Value to return (internally mapped to result)

Supports: name, comment, when, log


- when: result.status != 'OK'
  return:
    status: "error"
    message: "Failed validation"
	

DeclareTask

Declares or overrides variables in the current scope. These variables propagate downward.

  • declare: Key-value variable pairs

Supports: name, comment, when, log, loop


- declare:
    is_admin: false
    retry_count: 0
	

CommentTask

A passive task that does nothing. Useful for annotation.

  • comment: Text description

Supports: name


- comment: "This is a logic block for retry control"
	

TerminateTask

Immediately stops the entire workflow and returns the provided value as the final output.

  • terminate: Final result

Supports: name, comment, when, log


- when: shutdown_signal == true
  terminate:
    reason: "Manual override"
    status: "terminated"
	

© 2025 South Patron LLC. All rights reserved.

AI everywhere.