ReasonChip supports dynamic variables that you can define, reuse, and resolve across your entire pipeline. These variables help make workflows clean, reusable, and data-driven.
You can define variables in two main ways: A DeclareTask, or directly in a task.
- name: "Declare example"
declare:
greeting: "Hello"
is_active: True
- name: "Prepare message"
variables:
text: "Welcome, {{ user_name }}"
chip: chatbot.say
params:
message: text
You can use variables in two ways:
greeting
{{ user.name }}
Bare variables are supported in most task
fields: params
, loop
, when
, etc.
✅ Example using bare name:
- name: "Send greeting"
method_name: chatbot.say
params:
message: greeting
✅ Example using interpolation inside a string:
- name: "Compose greeting"
vars:
greeting: "Hello, {{ user.name }}!"
Variables can reference other variables, and ReasonChip will resolve them recursively:
variables:
a: b
b: c
c: 42
# Result: a == 42
- name: "Declare context"
declare:
name: Elvis
greeting: "Hello, {{ name }}"
- name: "Send message"
chip: chatbot.send
params:
message: greeting
ReasonChip supports nested resolution across dicts, objects, and attributes:
user.email
– nested objectdata['status']
– dict-style accessprofile.age
– object attribute accessExpressions inside {{ ... }}
are evaluated using standard Python syntax, with access to the current variable context.
This means you can use methods, arithmetic, and indexing:
- name: "Custom message"
vars:
user: { name: "Elvis", age: 42 }
- name: "Say message"
method_name: chatbot.say
params:
message: "User {{ user.name.upper() }} is {{ user.age + 1 }} years old"
You can use any valid Python operation that works within the safe vobj
context (your variables, safely exposed).
Examples:
{{ name.upper() }}
→ "ELVIS"{{ price * quantity }}
→ numeric calculation{{ user.get('email', 'not set') }}
→ dict fallbackBuilt-ins and external libraries are not available—only your variables are exposed to keep evaluation secure and deterministic.
params
, when
).{{ ... }}
is best used for inline string construction or complex expressions.© 2025 South Patron LLC. All rights reserved.
AI everywhere.