Skip to main content

Variable Inputs for AI Agents: Collect Information Before Chat

Abdul Samad avatar
Written by Abdul Samad
Updated this week

What are Variable Inputs?

Variable Inputs allow your AI agents to collect specific information from users before starting a conversation. This creates a more personalized and effective experience by ensuring your agent has all the context it needs from the beginning.

Benefits for Your Team

  • Personalized Conversations: Collect client IDs, project names, or preferences

  • Context-Aware Responses: Agents understand the specific scenario from the start

  • Streamlined Workflows: Eliminate repetitive questions at the beginning of each chat

  • Consistent Data Collection: Ensure all required information is gathered in a structured format

How It Works

For Agent Creators

  1. Define Variables: Use the format {{variable_name}} in your agent's system prompt

  2. Configure Input Types: Customize how each variable is collected (text, dropdown, number, date)

  3. Set Validation Rules: Ensure users provide valid data (required fields, number ranges, patterns)

For End Users

  1. Before chatting with an agent, users see a form with the required input fields

  2. After filling in the information, the conversation begins with all context pre-loaded

  3. The agent immediately uses this information in its responses

Setting Up Variable Inputs

Step 1: Define Variables in Your System Prompt

Include variables in your agent's system prompt using double curly braces:

text

You are a support agent helping with {{product_name}} issues.
The customer's account type is {{account_tier}} and they're using version {{version_number}}.

Step 2: Configure Variables in the Agent Settings

  1. Navigate to your agent settings

  2. Go to the "Variable Inputs" tab

  3. Any variables from your system prompt will be automatically detected

  4. Click on each variable to configure:

    1. Display Name: How it appears to users

    2. Input Type: Text, dropdown, number, or date

    3. Required: Whether the field is mandatory

    4. Default Value: Pre-populated information

    5. Description: Help text for users

    6. Validation: Rules to ensure valid input

Step 3: Configure Input Types

Text Inputs

  • Simple text fields for names, IDs, or free-form information

  • Optional pattern validation for formats like email or phone numbers

Dropdown Inputs

  • Static Options: Define a fixed list of choices

  • API Source: Dynamically load options from an API endpoint

Number Inputs

  • Set minimum and maximum values for numerical data

Date Inputs

  • Calendar picker for selecting dates

User Experience

When someone starts a chat with your agent:

  1. They'll see your agent's profile and description

  2. Below that, a form will appear with all required inputs

  3. After submitting valid information, the conversation begins

  4. The agent uses these inputs throughout the conversation

Advanced Configuration

Dropdown Options

For dropdown inputs, you can:

  • Create a static list of options with labels and values

  • Connect to an API endpoint that returns dropdown options

  • Map API response fields to option labels and values

Validation Rules

Ensure data quality with validation:

  • Required Fields: Mark fields that cannot be skipped

  • Pattern Validation: For text that should follow specific formats

  • Number Ranges: Set minimum and maximum values

  • Custom Error Messages: Show helpful guidance when validation fails

Best Practices

Writing Good Variable Names

  • Use clear, descriptive names: client_id instead of cid

  • Use underscores for multi-word variables: project_name instead of projectName

  • Stay consistent with naming conventions across agents

Creating User-Friendly Forms

  • Keep the number of required fields minimal

  • Provide clear descriptions for what information is needed and why

  • Use appropriate input types for each variable

  • Group related variables together

Instructions/System prompt

  • Reference variables naturally in your prompt text

  • Use variables to create conditional instructions for the agent

  • Ensure variable substitution makes grammatical sense in your prompt

Example Use Cases

Customer Support Agent

  • Collect account ID, issue category, and urgency level

  • Agent immediately knows customer context and prioritization

Sales Assistant

  • Gather industry, company size, and current tools

  • Agent can provide tailored product recommendations

Project Management Bot

  • Collect project name, team size, and timeline

  • Agent can suggest appropriate methodologies and tools

Analytics Assistant

  • Specify data source, time period, and metrics

  • Agent can immediately generate relevant reports

Troubleshooting

Variable not appearing in form?

  • Verify the variable is correctly formatted in your system prompt as {{variable_name}}

  • Check that you didn't accidentally delete it in the Variables tab

Dropdown options not loading?

  • Ensure your API endpoint is accessible and returns the correct format

  • Verify your label and value mappings match your API response structure

Did this answer your question?