Form Inputs
Form inputs allow you to gather structured information from users before starting a conversation with your agent. By defining inputs directly in your agent's system prompt or user prompt using a special syntax, you can create dynamic, interactive forms that capture exactly the information your agent needs.
Available Input Types
Gen8 provides a comprehensive set of input types to handle different data collection needs:
| Type | Syntax | Description | Options |
|---|---|---|---|
| Textfield | {{textfield;...}} | Single-line text input | label, name, description, placeholder, suggestions, default, required |
| Textarea | {{textarea;...}} | Multi-line text input | label, name, description, placeholder, suggestions, default, required |
| Dropdown | {{dropdown;...}} | Select from a list | label, name, description, options, default, required |
| Radio | {{radio;...}} | Single selection from visible options | label, name, description, options, default, required |
| Pick | {{pick;...}} | Button-style selection | label, name, description, options, default, required |
| Checkbox | {{checkbox;...}} | True/false toggle | label, name, description, true, false, default, required |
| Toggle | {{toggle;...}} | Switch-style true/false | label, name, description, true, false, default, required |
| Text | {{text;...}} | Display-only text (no input) | label, description, bold |
| Prompt | {{prompt;...}} | Hidden prompt text (conditional) | value |
| If | {{if;...}} | Start conditional block | condition expression (e.g., fieldName=value) |
| EndIf | {{endif}} | End conditional block | none |
Common Options
Most input types share these configuration options:
| Option | Description | Example |
|---|---|---|
label | Display name shown to users | label=Your Name |
name | Internal identifier used for conditions and references | name=userName |
description | Help text displayed below the field | description=Enter your full name |
default | Pre-filled value | default=John |
required | Makes the field mandatory | required=true |
Input Type Details
Text Inputs
Textfield and Textarea inputs accept free-form text from users.
Additional options for text inputs:
| Option | Description | Example |
|---|---|---|
placeholder | Ghost text shown when empty | placeholder=Enter text here... |
suggestions | Quick-fill buttons below the field | suggestions={"Option A";"Option B"} |
{{textfield;label=Topic;name=topic;placeholder=Enter your topic;required=true}}
{{textarea;label=Additional Context;name=context;description=Provide any extra information}}
Selection Inputs
Dropdown, Radio, and Pick inputs let users choose from predefined options.
| Option | Description | Example |
|---|---|---|
options | List of choices with values and labels | options={value1=Label 1;value2=Label 2} |
The difference between these types is visual: dropdowns collapse into a menu, radio buttons show all options with selection circles, and pick buttons display as clickable button choices.
{{dropdown;label=Tone;name=tone;options={formal=Formal;casual=Casual;professional=Professional};default=professional}}
{{radio;label=Output Length;name=length;options={short=Short;medium=Medium;long=Long}}}
{{pick;label=Priority;name=priority;options={low=Low;medium=Medium;high=High}}}
Boolean Inputs
Checkbox and Toggle inputs capture yes/no decisions and insert different text into the prompt based on the user's choice.
| Option | Description | Example |
|---|---|---|
true | Text inserted when checked/enabled | true=Please include practical examples. |
false | Text inserted when unchecked/disabled | false=No examples needed. |
{{checkbox;label=Include Examples;name=includeExamples;true=Please include practical examples.;false=}}
When the user checks this box, "Please include practical examples." appears in the prompt. When unchecked, nothing is inserted (empty string).
Display Text
The Text type displays information to users without collecting input. It's useful for section headers, instructions, or important notices.
| Option | Description | Example |
|---|---|---|
bold | Makes the text bold | bold=true |
{{text;label=Important Notice;description=Please review all fields before submitting.;bold=true}}
Hidden Prompts
The Prompt type includes text in the AI prompt without showing it to users. Combined with conditions, you can dynamically include or exclude instructions.
{{if;advancedMode=true}}
{{prompt|Include detailed technical specifications only for advanced users.}}
{{endif}}
Conditional Logic with If/EndIf
For more complex forms, use {{if;...}} and {{endif}} blocks to conditionally show or hide entire sections of inputs based on user selections.
Basic Syntax
{{if;fieldName=value}}
... inputs and text shown when condition is true ...
{{endif}}
How It Works
The if block evaluates conditions based on other form input values. When the condition is met, everything between {{if;...}} and {{endif}} is shown to the user and included in the prompt. When the condition is not met, that entire section is hidden.
Condition Operators
| Operator | Description | Example |
|---|---|---|
= | Equals | topic=technical |
!= | Not equals | topic!=personal |
> | Greater than | count>5 |
< | Less than | count<10 |
>= | Greater than or equal | priority>=medium |
<= | Less than or equal | priority<=low |
Multiple Conditions
Combine conditions using & (AND) or ; (OR):
{{if;category=business&priority=high}}
{{textarea;label=Urgent Details;name=urgentDetails;required=true}}
{{endif}}
Nested Conditions
You can nest if blocks for complex logic:
{{dropdown;label=Service Type;name=serviceType;options={basic=Basic;premium=Premium;enterprise=Enterprise}}}
{{if;serviceType=premium}}
{{checkbox;label=Add Priority Support;name=prioritySupport}}
{{if;prioritySupport=true}}
{{textfield;label=Preferred Contact Time;name=contactTime}}
{{endif}}
{{endif}}
{{if;serviceType=enterprise}}
{{textarea;label=Custom Requirements;name=customReqs;required=true}}
{{textfield;label=Account Manager;name=accountManager}}
{{endif}}
Practical Example
Here's a complete example showing conditional logic in action:
You are a helpful assistant.
{{dropdown;label=Request Type;name=requestType;options={question=Question;feedback=Feedback;support=Support Request}}}
{{if;requestType=question}}
{{textfield;label=Your Question;name=question;required=true}}
{{endif}}
{{if;requestType=feedback}}
{{dropdown;label=Feedback Type;name=feedbackType;options={positive=Positive;suggestion=Suggestion;complaint=Complaint}}}
{{textarea;label=Your Feedback;name=feedback;required=true}}
{{endif}}
{{if;requestType=support}}
{{textfield;label=Issue Summary;name=issueSummary;required=true}}
{{dropdown;label=Severity;name=severity;options={low=Low;medium=Medium;high=High;critical=Critical}}}
{{textarea;label=Steps to Reproduce;name=steps}}
{{if;severity=critical}}
{{textfield;label=Emergency Contact;name=emergencyContact;required=true}}
{{prompt;This is a critical issue. Prioritize resolution and provide immediate assistance.}}
{{endif}}
{{endif}}
How Form Inputs Work
When a user starts a conversation with an agent that has form inputs:
- The form is rendered based on your input definitions
- Conditional sections show/hide as users fill in fields
- Users complete the required fields and submit
- All
{{...}}placeholders are replaced with the entered values - The resolved prompt (with conditions evaluated) is sent to the AI
For checkbox and toggle inputs, the true or false text value is inserted based on the user's selection. For conditional blocks, sections where conditions aren't met are removed entirely from the final prompt.
Linking to Snippets
Form inputs can be connected to Snippets for automatic pre-filling. This is especially useful for frequently-used information like user names, company details, or project settings.
To link an input to a snippet:
- Click the snippet icon (🔗) next to any input in the form editor
- Select an existing snippet or create a new one
- The field automatically fills with the snippet's current value
Users can still edit the pre-filled value before submitting if needed.
Auto-Filling via Query Parameters
When sharing a public agent link, you can pre-fill form inputs using a query parameter. This allows you to automatically set values for form fields without requiring user input.
To use query parameters for auto-filling, you must provide a single inputs parameter containing a Base64-encoded JSON array of string values. The values must correspond to the form fields in the order they appear in your template.
How to construct the URL
- Create an array of values for your fields in order:
["JavaScript", "John"] - Convert the array to a JSON string:
'["JavaScript","John"]' - Base64 encode the string:
WyJKYXZhU2NyaXB0IiwiSm9obiJd - Append it to the URL as the
inputsparameter:
https://app.gen8.ai/public/{tokenId}/{templateId}?inputs=WyJKYXZhU2NyaXB0IiwiSm9obiJd
This URL will pre-fill the first form field with "JavaScript" and the second field with "John". Users can still edit these values before submitting their form.
Note: The values are applied by index (order), not by field name. Ensure your array matches the exact order of inputs in your agent definition.