Skip to main content

CEL Expression Editor

AutoTalk uses CEL (Common Expression Language) expressions in AI agents and workflows to make behaviour dynamic — personalising system messages with client names, conditionally running steps, computing values at runtime, and more.

This page explains how to write and test CEL expressions using the built-in editor.


Where expressions appear

CEL expressions appear wherever you see the CEL badge in the configuration UI:

  • Agent → Messages tab — system message content (e.g. inject the client's name into a prompt)
  • Agent → Actions tab — the Condition field on each pre-action or post-action step
  • Workflow → Steps — step conditions and output mappings

The expression editor

The CEL expression editor showing a Condition field with a 'true' expression, a CEL mode badge, and an Expand button

When you open an action step for editing, the Condition field shows the compact expression editor. It has:

  • Syntax highlighting — keywords, strings, and operators are colour-coded
  • Real-time validation — a green Valid badge appears when the expression is correct; a red error badge appears with the exact error message when it isn't
  • Format button — auto-formats the expression (keyboard shortcut: Ctrl+Shift+F)
  • Expand button — opens the full workbench (see below)

Simple CEL vs raw CEL

A system message field open for editing, showing a multi-line CEL expression with the CEL/template toggle in the header

System message fields (and other text fields) offer two authoring modes, toggled by the CEL button in the field header:

ModeExampleWhen to use
Simple CEL (SCEL)Hello {{client.name}}!Simpler syntax for text with variable substitutions
Raw CEL"Hello " + client.name + "!"Full CEL syntax when you need logic, conditionals, or function calls

Both modes produce the same result. The {{variable}} syntax is automatically converted to raw CEL when you save.

Advanced field options

Expand the Advanced drawer under any expression field to configure:

OptionWhat it does
On failureWhat happens if the expression throws an error at runtime: stop the action (throw), return empty (""), or return null
Result typeExpected output type (string, boolean, number, object, array)
FallbackA second expression to evaluate if the primary one fails

The full workbench

Click Expand on any expression editor to open the full workbench in a dedicated view.

Explorer tab

The CEL workbench with the Explorer tab open, showing a searchable variable tree and function list

The Explorer tab shows everything available in the current context:

  • Variables tree — all variables you can reference in this expression, expandable to see nested fields. Click any variable or field to insert it at the cursor.
  • Functions list — all built-in functions with their signature and description. Click to insert.
  • Search box — filters both variables and functions as you type.

The variables shown depend on where the expression lives:

LocationAvailable variables
Agent pre-actions / post-actionsclient, contactMessage, conversation, company, step(0), step(1), …
Agent system messagesclient, company, employee, and session variables set by previous pre-actions
Workflow steps_workflow, occurrenceDate, trigger inputs, step(0), …

Test tab

The CEL workbench with the Test tab open, showing a JSON variable editor and an empty result area

The Test tab lets you evaluate the expression against custom variable values without touching a live conversation:

  1. Edit the JSON on the left to define test values for variables (e.g. set client.name to "Alice")
  2. Click Run (or press Ctrl+Enter)
  3. The result appears on the right — either the computed value or a formatted error message

Variables reference

For a complete list of all available functions, see the CEL Functions Reference.

These variables are available inside agent expressions:

VariableDescription
clientThe contact who sent the message — client.name, client.phoneNumber, client.email, client.tags, etc.
contactMessageThe incoming message — contactMessage.body.text, contactMessage.type, etc.
conversationThe conversation session — conversation.status, conversation.metadata, etc.
companyYour company profile — company.name, company.options, etc.
employeeThe assigned employee/professional (available in system messages)
step(N)Output of a previous step at index N — e.g. step(0).jwt, step(2).data[0], or get(step(1), 'executionContext.status')

Common step outcome checks

Use the step helper functions for concise step status checks:

step_ok(0)                                          // true if step 0 completed successfully
step_data(0, "title") // get step 0's data.title
step_data(1, "choices.0.message.content", "") // LLM response with fallback
step_error(2) // {code, user_message, retryable} or null

Or use step(N).executionContext directly for lower-level checks:

get(step(0), 'executionContext.status') == 'completed'
get(step(1), 'executionContext.safeError.code') == 'unsupported_media_format'
get(step(2), 'executionContext.safeResult.reason') == 'condition_false'

safeError is intended for safe debugging and branching. It does not expose raw stack traces, secrets, or provider payloads.

See the CEL Functions Reference for the complete function list.

Debugging expression errors

When a CEL expression fails during a live conversation, an error bubble appears in the chat — visible only to your team, not to the client.

Reading the error bubble

The error bubble in its collapsed state, showing 'Assistant error', a CelEvaluationError badge, and the error message

The collapsed bubble shows the error type and a one-line message. Click ▼ Expand to see the full detail panel.

Expanded view

The error bubble expanded showing four accordion sections: CEL Expression, Metadata, CEL Variables, and Full Payload

The expanded panel has four sections:

SectionContent
CEL ExpressionThe exact expression that failed — copy it to paste into the workbench for testing
MetadataWhere the error happened: which section of the agent config, which message or action index
CEL Variables(Debug log level only) The full list of variables and their values at the moment of the error
Full PayloadThe raw error data as JSON

CEL Variables section

The CEL Variables accordion expanded, showing a filter input and a list of variables with their types

The CEL Variables section is the most useful for diagnosing problems:

  • Use the filter box to search for the variable your expression references
  • Expand any variable to inspect its actual value and structure
  • Variables labelled truncated are large objects that were abbreviated

Note: CEL Variables only appears when the agent's Log Level is set to Debug. Go to the agent's Advanced tab to raise the log level, then lower it again after you've fixed the issue.

Step-by-step debugging

  1. Expand the error bubble with .
  2. In CEL Expression, copy the failing expression.
  3. In Metadata, note the section and index to find the right field in the agent editor.
  4. In CEL Variables (requires Debug log level), search for the variable the expression uses and check its actual value.
  5. Open the agent editor, go to the relevant tab, and click Expand on the problematic field.
  6. Paste the expression into the Test tab, enter realistic variable values, and run it to reproduce the error.
  7. Fix the expression and save. The error bubble will stop appearing once the expression succeeds.