Common Expression Language (CEL)
Guide to using CEL for data evaluation and transformation in workflows
CEL (Common Expression Language) is a simple expression language for evaluating conditions and manipulating data in workflows. Used in Condition Nodes, input/output expressions, and data transformation between nodes.
Workflow Data Structure
Data available in CEL expressions:
{
prompt: "initial user input",
input: {
// Data from previous node
propertyName: "value"
},
output: {
// Current node execution result
result: "data"
}
}Data Access:
input- Output from previous nodeinput.propertyName- Specific property from inputoutput- Current node resultprompt- Initial input from Start node
Common Operators
Comparison Operators
input.score > 80 // Greater than
input.score >= 70 // Greater than or equal
input.score < 50 // Less than
input.score <= 40 // Less than or equal
input.status == "done" // Equal
input.status != "pending" // Not equalLogical Operators
input.score > 80 && input.grade == "A" // AND
input.status == "error" || input.status == "failed" // OR
!(input.completed) // NOTArithmetic Operators
input.price + 100 // Addition
input.price - 50 // Subtraction
input.quantity * 2 // Multiplication
input.total / 3 // Division
input.number % 2 == 0 // Modulo (check even)String Operations
"Hello " + input.name // Concatenation
input.text.size() // String length
input.email.contains("@") // Contains check
input.text.startsWith("Hello") // Starts with
input.text.endsWith(".com") // Ends withType Conversion
string(input.count) // Convert to string
int(input.value) // Convert to integer
double(input.price) // Convert to floatList Operations
input.items.size() // List length
input.items[0] // Access by index
5 in input.numbers // Check if value in listUsage Examples
1. Condition Node
// If condition
input.amount > 1000
// Complex condition
input.score >= 80 && input.attendance > 75
// String check
input.category == "urgent" || input.priority == "high"
// List check
"admin" in input.roles2. Input Source Expression
// Get property directly
input.query
// Concat string
"Search for: " + input.topic
// Conditional value
input.useDefault ? "default query" : input.customQuery3. Output Expression
// Format output
"Result: " + string(output.count) + " items found"
// Concat multiple properties
output.result_node + " - Sources: " + string(output.sources.size())
// Extract specific data
output.data.summary4. Response Message
// Simple message
"Task completed successfully"
// Dynamic message
"Found " + string(input.results.size()) + " matches"
// Conditional message
input.success ? "Operation successful!" : "Operation failed"5. API Call Body
// Access input for API payload
{
"query": input.searchTerm,
"limit": 10,
"userId": input.userId
}