Building on the multi-step flow, this example adds lifecycle actions to create a polished user experience with welcome messages and progress tracking.Documentation Index
Fetch the complete documentation index at: https://docs.syllable.ai/llms.txt
Use this file to discover all available pages before exploring further.
Objective
In this example, you’ll learn:- How to use
on.enterhooks to execute actions when entering a step - How to use the
sayaction for verbatim text delivery - How to use the
setaction to initialize variables - How to use the
incaction to track progress with counters - How to combine multiple actions in lifecycle hooks
The Scenario
Your contact form from Example 3 works, but feels robotic—no greeting, no sense of progress. You want to:- Welcome users at the start
- Show progress indicators (“Step 1 of 3”, “Step 2 of 3”, etc.)
- Track how many steps have been completed
Implementation
Here’s the complete tool definition:Key Concepts
The on.enter Hook
The on.enter hook executes when the workflow enters a step, before the agent starts collecting inputs:
on.enter for:
- Welcome messages and progress indicators
- Initializing step-local variables
- Pre-populating inputs from existing data
The on.submit Hook
The on.submit hook executes after validation passes, before evaluating transitions:
on.submit for:
- Persisting inputs to global variables
- Updating counters
- Triggering side effects (like tool calls)
The say Action
The say action queues text that the agent must include verbatim:
The set Action
The set action initializes or updates a variable:
- Task-local (
local.*): Scoped to this workflow instance - Global (no prefix): Shared across the conversation
The inc Action
The inc action increments a numeric counter:
Enum Constraints
TheCOLLECT_TIME step uses an enum to constrain the contact time:
- “8am” → “morning”
- “after lunch” → “afternoon”
- “around 7pm” → “evening”
How It Works
Here’s the conversation flow:State After Each Step
After COLLECT_NAME:Try It
To test this workflow in the Syllable Console:- Create a new tool with the JSON above
- Assign it to an agent
- Start a conversation and say “hello”
- Notice the welcome message and progress indicator
- Complete all three steps
- Observe how the agent normalizes contact time to one of the enum values
What’s Next
This example collects contact time but treats all preferences the same. In Example 5: Conditional Branching, you’ll learn how to:- Route to different steps based on user input
- Use JMESPath expressions for conditions
- Create parallel workflow paths

