Skip to main content
Action flows combine the probabilistic nature of AI with the reliability of deterministic code execution. While your agent handles conversations dynamically, action flows ensure critical business logic runs predictably.

Philosophy

Iqra AI maintains a clear separation:
  • AI layer - Handles natural language understanding and generation (probabilistic)
  • Deterministic layer - Handles business logic, data validation, and workflow control (guaranteed)
Action flows live in the deterministic layer, ensuring your business rules are never subject to LLM hallucination or uncertainty.

Core concepts

Variables as state

Variables are the foundation of deterministic control. Unlike AI memory (which is fuzzy), variables store exact values:
Variable properties:
  • Type safety - String, Number, or Boolean
  • Visibility control - Show/hide from AI
  • Edit permissions - AI-editable or read-only
  • Template access - Use in Scriban templates
See Visual IDE for complete variable configuration.

System tools as actions

System tools are deterministic operations that modify state or control flow:
  • DTMF Input - Collect exact keypad digits
  • Go To Node - Jump to specific conversation points
  • End Call - Terminate with certainty
  • Send SMS - Guaranteed message delivery
  • Add Script - Dynamic context loading

Conditional routing

Edges between nodes can represent different outcomes, creating if/else logic:

Common patterns

If/else branching

Implement conditional logic using DTMF outcomes or Custom Tool responses. Example: Menu selection
1

Present options

2

Collect input

3

Execute path

Each outcome connects to a different workflow branch that executes deterministically.

Loops and retries

Use Go To Node to create retry logic for failed operations. Example: PIN verification with retry limit
Key components:
  • Variable tracking (pin_attempts)
  • Conditional checking (attempts < max)
  • Loop back (Go To Node)
  • Exit condition (End Call)

State machines

Model complex workflows as states and transitions. Example: Payment processing
Each state is a node or group of nodes, transitions are edges.

Dynamic script loading

Load different conversation modules based on runtime conditions. Example: Tier-based support
This pattern keeps scripts modular and loads only relevant context.

Data validation pipeline

Chain multiple validation steps before processing. Example: Email verification

Template logic

Use Scriban templates in AI Response nodes for dynamic content generation.

Conditional messages

Loops in templates

Math operations

Scriban templates execute during the AI Response generation phase, allowing you to compute values before speaking them.

Best practices

Separate concerns

Each layer does what it’s best at.

Use variables for decisions

Don’t ask the AI to make business decisions:

Handle all edge cases

Every DTMF Input and Custom Tool should have:
  • Success path
  • Failure path
  • Timeout path (if applicable)
  • Maximum retry logic

Keep loops bounded

Always have an exit condition:

Log state transitions

Use variables to track workflow progress:
This helps debugging and analytics.

Advanced patterns

Saga pattern for distributed workflows

When integrating multiple external systems, implement compensating actions:

Rate limiting

Track API call counts to avoid exceeding limits:

A/B testing flows

Randomly route users to different experiences:
Track completion rates in variables for analysis.

Debugging flows

Use descriptive variable names

Add checkpoint nodes

Insert AI Response nodes that speak variable values during testing:
Remove these before production.

Log to variables

Create a debug_log variable and append to it:

Performance considerations

Minimize tool calls

Batch operations when possible:

Cache computed values

Don’t recalculate in templates:

Lazy-load scripts

Only add scripts when needed:

Next steps

Script nodes

Learn about all available node types

Secure sessions

PCI-DSS compliant data collection

Custom tools

Integrate your backend APIs