if_else

A conditional system tool that executes different blocks of tools based on a condition.

Fields

Name
Type
Description
Required

returns_key

string

The name of the variable inside the executed block scope to use for the return value.

condition

prompt

The condition to evaluate which determines the branch of execution.

if_true.if

array

The tool to execute if the condition is true. If this value is not set, the block will be skipped.

if_false.else

array

The tool to execute if the condition is false. If this value is not set, the block will be skipped.

Returns

Type
Description

prompt

The value of the variable inside the executed block scope to use for the return value. This only exists if a returns_key is specified.

Example

- name: if_else
  condition: <existence-if-condition>
  returns_key: <optional-return-key-for-block-scope>
  if:
    tools:
      - name: some_tool
  else:
    tools:
      - name: some_other_tool
  returns: <return-value-from-block-scope-name>

Last updated