hybrid-expressions
workflowv1.0.0Hybrid expressions mixing get() API calls with arithmetic operators
Install
kdeps registry install hybrid-expressions
Then run locally:
kdeps exec hybrid-expressions
Configure LLM provider in ~/.kdeps/config.yaml (created automatically on first run).
README
Hybrid Expressions Example
This example demonstrates hybrid expressions that mix:
get()function calls (from kdeps runtime API)- Arithmetic operators (
*,+,-,/) - Comparison operators (
>,>=,==) - Ternary operators (
? :)
Key Feature
You can write expressions like:
doubled: "{{ get('multiplier') * 2 }}"
Examples in this Workflow
Arithmetic with API values
doubled: "{{ get('value') * 2 }}"
total: "{{ get('price') * get('quantity') }}"
Conditional logic
status: "{{ get('score') >= 80 ? 'Pass' : 'Fail' }}"
Default values
label: "{{ default(get('name'), 'unknown') }}"
Running the Example
kdeps run examples/hybrid-expressions/workflow.yaml
How It Works
The expr-lang evaluator:
- Receives the kdeps context (memory, session, request params)
- Provides kdeps functions like
get(),set(),info(),default() - Allows arithmetic, comparison, and ternary operators within
{{ }}
More Examples
# Arithmetic with stored values
price: "{{ get('base_price') * get('quantity') }}"
# Comparison
eligible: "{{ get('score') >= get('min_score') }}"
# Ternary
tier: "{{ get('score') >= 90 ? 'gold' : get('score') >= 70 ? 'silver' : 'bronze' }}"
# Default fallback
label: "{{ default(get('name'), 'anonymous') }}"
Versions
| Version | Published | Status |
|---|---|---|
| 1.0.0 | 4/11/2026 | active |
Details
- Author
- kdeps
- License
- Apache-2.0
- Latest Version
- 1.0.0
- Published
- 4/11/2026
Tags
expressionsadvanced