Node-based conversation flows that combine deterministic logic with AI intelligence
Scripts are the blueprint of your conversations. They define the structure, logic, and deterministic behavior that guides how your agents interact with users. Unlike pure AI conversations that can be unpredictable, scripts provide a controlled framework while still allowing natural language understanding.
public class BusinessAppScript{ public BusinessAppScriptGeneral General { get; set; } public List<BusinessAppScriptNode> Nodes { get; set; } public List<BusinessAppScriptEdge> Edges { get; set; } public List<BusinessAppScriptVariable> Variables { get; set; }}
Components explained:
General: Name, description, and metadata
Nodes: Individual building blocks (AI responses, tools, logic)
public class BusinessAppScriptStartNode : BusinessAppScriptNode{ public override BusinessAppAgentScriptNodeTypeENUM NodeType => BusinessAppAgentScriptNodeTypeENUM.Start;}
This is the entry point when the script is activated. A script can only have one start node.
Defines what the AI should say and provides examples:
public class BusinessAppScriptAIResponseNode : BusinessAppScriptNode{ [MultiLanguageProperty] public Dictionary<string, string> Response { get; set; } [MultiLanguageProperty] public Dictionary<string, List<string>> Examples { get; set; }}
Example configuration:
Response: English: "Great! I can help you schedule an appointment. Which service are you interested in?" Arabic: "رائع! يمكنني مساعدتك في حجز موعد. ما هي الخدمة التي تهتم بها؟"Examples: English: - "I'd be happy to book that for you. What service do you need?" - "Perfect! Let me help you schedule. Which service would you like?" Arabic: - "يسعدني حجز ذلك لك. ما هي الخدمة التي تحتاجها؟"
The AI uses the response as guidance and the examples to understand tone and variation. The actual response is generated naturally, not templated.
Provide 3-5 examples to give the AI enough variety while maintaining consistency. The AI will generate unique responses that match the style.
Defines what information you’re asking the user for:
public class BusinessAppScriptUserQueryNode : BusinessAppScriptNode{ [MultiLanguageProperty] public Dictionary<string, string> Query { get; set; } [MultiLanguageProperty] public Dictionary<string, List<string>> Examples { get; set; }}
Example configuration:
Query: English: "Ask the user which date they prefer for their appointment"Examples: English: - "What date works best for you?" - "When would you like to schedule your appointment?" - "Do you have a preferred date in mind?"
The AI will ask the question naturally and extract the relevant information (the date) from the user’s response.
public class BusinessAppScriptSystemToolNode : BusinessAppScriptNode{ public virtual BusinessAppAgentScriptNodeSystemToolTypeENUM ToolType { get; set; }}
Always use EncryptInput: true when collecting sensitive information like PINs, credit card numbers, or SSNs. This ensures the AI never sees the raw data.
public class BusinessAppScriptEndCallToolNode : BusinessAppScriptSystemToolNode{ public BusinessAppAgentScriptEndCallTypeENUM Type { get; set; } [MultiLanguageProperty] public Dictionary<string, string>? Messages { get; set; };}
Configuration:
Type: AfterMessage # Options: Immediate, AfterMessageMessages: English: "Thank you for calling! Your appointment is confirmed. Have a great day!" Arabic: "شكراً لاتصالك! تم تأكيد موعدك. أتمنى لك يوماً سعيداً!"
public class BusinessAppScriptVariable{ public string Key { get; set; } // e.g., "user_email" public BusinessAppScriptVariableTypeENUM Type { get; set; } // String, Number, Boolean public string? DefaultValue { get; set; } public bool IsVisibleToAgent { get; set; } = true; // Can AI see this? public bool IsEditableByAI { get; set; } = false; // Can AI modify this? [MultiLanguageProperty] public Dictionary<string, string> Description { get; set; }}
IsVisibleToAgent determines if the AI can see the variable:
# AI can see and use in responsesuser_name: Type: String IsVisibleToAgent: true IsEditableByAI: true Description: "The customer's full name"# AI cannot see (secure data)user_pin: Type: String IsVisibleToAgent: false IsEditableByAI: false Description: "User's 4-digit PIN (encrypted)"
IsEditableByAI controls if the AI can modify it:
# AI can extract and updateappointment_date: Type: String IsVisibleToAgent: true IsEditableByAI: true# Read-only for AI (set by system)max_retry_attempts: Type: Number DefaultValue: "3" IsVisibleToAgent: true IsEditableByAI: false
Use Scriban template syntax to reference variables in nodes: {{ variables.user_name }} or {{ variables.retry_count }}
1. [Start] → Load script, initialize variables2. [AI Response: Greeting] → AI says: "Hi! How can I help you today?"3. [User Query: Intent] → User says: "I need to book an appointment"4. [Extract Intent] → AI sets variables.intent = "booking"5. [User Query: Date] → AI asks: "What date works for you?"6. [Extract Date] → User says: "Next Monday" → variables.date = "2026-03-09"7. [FlowApp: Check Availability] → Calls Cal.com API8. [Available Port] → API returns available slots9. [FlowApp: Book Meeting] → Creates the booking10. [AI Response: Confirmation] → AI says: "You're all set for Monday!"11. [End Call] → Conversation terminates
# Good: Store data you needuser_email: "Used for booking confirmation"retry_count: "Track failed attempts"# Unnecessary: Temporary datalast_ai_response: "Not needed, system handles this"random_number: "Only create if actually used"