Skip to content

Expressions reference ​

This page lists every field and option. The overview shows what it does and a first example.

Expressions pass data between resources, validate inputs, and run conditional logic, using expr-lang. They run across workflow resources.

Where expressions are used ​

String interpolation - embed an expression inside any string field using {{ }}:

yaml
# resources/example.yaml
chat:
  context:
    prompt: "Hello {{ get('name') }}, today is {{ info('timestamp') }}"

before:/after: blocks - a list of statements executed sequentially. Each statement is a bare expression, not wrapped in {{ }}:

yaml
# resources/example.yaml
after:
  - set('normalized', lower(trim(get('q'))))   # stores a value
  - set('is_admin', get('role') == 'admin')    # boolean
  - set('total', get('price') * get('quantity'))

validations.skip / validations.check / onError.when - a list of boolean expressions. Any one true is enough:

yaml
# resources/example.yaml
validations:
  skip:
    - get('q') == ''           # bare expression, evaluated as bool
  check:
    - len(get('password')) >= 8

Standard library ​

Expressions have access to the full expr-lang standard library:

  • String: trim(), lower(), upper(), split(), replace(), join()
  • Math: min(), max(), abs(), ceil(), floor()
  • List: len(), filter(), map(), first(), last()
  • String matching (infix operators): contains, startsWith, endsWith, matches
  • Type casting: int(), float(), string()

kdeps adds workflow-specific helpers on top. See the Expression Functions Reference for the full list.

See also ​

kdeps has the Apache 2.0 License.