Flowent Flows.yml Complete Reference Guide
This comprehensive guide explains every aspect of writing flows.yml files for the Flowent conversational flow system. This document is designed to help both humans and AI models create perfect flow files without any syntax errors or validation issues.🎯 What is a Flow?
A flow in Flowent is a structured conversation that guides users through a sequence of interactions to accomplish a specific task. Think of it as a conversation script with branching logic, data collection, and actions.📁 File Structure Overview
Top-Level Structure
Every flows.yml file must follow this exact structure:🚨 Critical Rules:
- Root level must be
flows: - Flow IDs (like
flow_id_1) must be unique and follow naming conventions - Each flow must have
name,description, andsteps - Steps array cannot be empty
🔧 Flow Definition Rules
Required Flow Fields
Optional Flow Fields
Flow ID Naming Rules
✅ Valid Flow IDs:🎭 Step Types and Purposes
The One-Purpose Rule
🚨 CRITICAL: Every step must have exactly one purpose. You cannot mix purposes in a single step.Three Valid Purposes:
- 📥 Data Collection (
collect) - Gather information from user - ⚡ Action Execution (
action) - Execute backend operations - 💬 Response (
response) - Send messages to user
Valid Step Examples:
Invalid Step Examples:
📥 Data Collection Steps
Data collection steps gather information from users and store it in slots for later use.Basic Structure
Collect Field Rules
✅ Valid Field Names:
❌ Invalid Field Names:
Data Types (collect_type)
Confirmation Options
Collect Confirmation
Ask user to confirm their input before saving:Send Confirmation
Send confirmation message after successfully saving:Alternative Slot Names
Save collected data with a different name:⚡ Action Execution Steps
Action steps execute backend operations like API calls, database queries, or business logic.Basic Structure
Available Actions
Actions must be registered in the system. Common actions include:Action Parameter Dependencies
Actions may require specific slots to be collected before execution: ✅ Correct Order:Error Handling with else
💬 Response Steps
Response steps send messages directly to users without collecting data or executing actions.Basic Structure
Static Responses
Dynamic Responses with Slots
🔀 Conditional Logic and Branching
Flowent supports two types of conditional logic for branching flows based on collected data.Simple Next Step
Point to a single next step or end the flow:Conditional Next Steps
Use conditions to branch to different steps:Programmatic Conditions (if)
Use code-like expressions for precise logic:
Semantic Conditions (semantic_if)
Use natural language for LLM-based evaluation:
Complex Branching Example
Using else for Fallbacks
The else field provides a safety net when no conditions match:
🏷️ Template System and Slot References
Flowent uses a powerful template system to reference previously collected data in responses and descriptions.Slot Reference Syntax
Useslots.field_name to reference collected data:
Valid Slot Names
✅ Valid Slot References:Using Slots in Responses
Using Slots in Descriptions
Provide context to the LLM about what data to collect:Slot Availability Rules
🚨 Critical Rule: You can only reference slots that were collected in previous steps. ✅ Correct Slot Usage:🧭 Flow Connectivity and Navigation
Proper navigation ensures users can move through your flow without getting stuck.Step Reference Rules
Every step must be reachable and every reference must be valid: ✅ Valid References:Ending Flows
UseEND to terminate a flow:
Unreachable Steps
Avoid creating steps that can never be reached: ❌ Unreachable Step Example:Circular References
Avoid infinite loops by being careful with step references: ⚠️ Potential Loop (use with caution):🎯 NLU Triggers
NLU (Natural Language Understanding) triggers define how flows can be automatically started based on user intents.Basic Structure
Intent Configuration
Multiple Trigger Examples
Flows Without Triggers
Flows without NLU triggers can only be started programmatically:✅ Validation Rules and Common Errors
Understanding validation rules helps you avoid common mistakes.Flow-Level Validation
Required Fields Missing
Mismatched Flow ID
Step-Level Validation
Missing Step ID
Duplicate Step IDs
No Step Purpose
Multiple Step Purposes
Data Collection Validation
Invalid Field Names
Invalid Collect Types
Template and Slot Validation
Invalid Slot References
Incomplete Slot References
Unavailable Slot Dependencies
Navigation Validation
Invalid Step References
Invalid Conditional References
Action Validation
Non-existent Actions
Missing Action Parameters
🎯 Complete Examples
Simple Linear Flow
Complex Branching Flow
Multi-Service Flow with Semantic Conditions
🏆 Best Practices
1. Clear and Descriptive Naming
✅ Good:2. Comprehensive Error Handling
Always provide error paths and fallbacks:3. Logical Step Progression
Structure steps in logical order:4. Meaningful Descriptions
Provide context for LLM and debugging:5. Consistent Data Types
Be explicit about data types:6. Smart Confirmations
Use confirmations strategically:7. Graceful Flow Termination
Always provide clear endings:8. Test Edge Cases
Consider all possible user paths:9. Document Your Flows
Include comments and documentation:10. Modular Design
Keep flows focused and reusable:🚨 Critical Reminders
- Every step MUST have exactly one purpose (collect, action, or response)
- Step IDs must be unique within each flow
- All step references must exist (next, else, then fields)
- Slot references can only use previously collected data
- Field names must follow naming rules (alphanumeric + underscore only)
- collect_type must be valid (string, file, number, boolean)
- Actions must exist in the system registry
- Use END to terminate flows
- Always provide error handling with else fields
- Test all conditional paths
This comprehensive guide covers every aspect of writing flows.yml files for Flowent. Following these rules and examples will ensure your flows validate successfully and provide excellent user experiences. Remember: when in doubt, keep it simple and always provide fallback paths for error handling!