AI Dialog
The AI Dialog block lets your bot conduct a multi-turn conversation with the user in natural language: ask questions, collect data, clarify details — and, when done, pass the gathered information to the next node.
How It Works
- The bot enters the AI Dialog block.
- The AI sends the first message according to the system prompt.
- The user replies — the reply is forwarded to the AI as a new message.
- The AI continues the dialog, accumulating responses in a
dataobject. - Once all required data is collected, the AI sets
final_state: true— the dialog ends and the bot moves to the next node.
The dialog history is stored in the database and restored when the user re-enters the block.
Block Settings
Connection
| Field | Description |
|---|---|
| AI Service | The neural network for the dialog: OpenAI, Claude, Gemini, Grok, YandexGPT, OpenRouter |
| Connection | A saved API key from the Integrations section |
| Model | The specific model to use (e.g. gpt-4o). Can be a variable |
Dialog
| Field | Description |
|---|---|
| System prompt | Instructions for the AI: task, communication style, what to collect |
| Allowed message types | What the AI can send: text, inline buttons, reply buttons, polls |
| JSON schema | Structure of the data to collect (key → type). The AI accumulates values in data |
| Result variable prefix | Where dialog results are saved. With prefix ai_result and field name → {{ai_result.name}} |
| AI Tools | Bot commands the AI can call during the conversation. The number beside the button shows how many tools are connected |
| Use bot knowledge base | Lets this block search the selected bot's documents and text entries |
Completion
| Field | Description |
|---|---|
| Go to node | The node the bot transitions to after final_state: true |
Advanced Settings
| Field | Description |
|---|---|
| History message limit | How many recent messages are sent to the AI (default: 50) |
| Store history (hours) | History TTL. After a pause longer than this, the history is reset |
| Max response tokens | Token limit for a single AI response (default: 2048) |
| Encrypt data | Dialog history is stored in the database in encrypted form |
| Streaming mode | The AI response appears in the chat as it is generated (text-only responses) |
JSON Schema
The schema defines what data the AI must collect. Format — a JSON object where keys are field names and values are types:
{
"name": "string",
"phone": "string",
"age": "number",
"agree_terms": "boolean"
}
The AI accumulates values in the data object throughout the dialog. Once all fields are filled — the dialog ends and the data is passed forward.
After the dialog completes, each field is available as a variable:
{{ai_result.name}}
{{ai_result.phone}}
{{ai_result.age}}
System Prompt
The prompt is the main instruction for the AI. JSON response format rules are appended automatically — you don't need to write them. Specify:
- Task: what to collect or find out
- Communication style: tone, language, question format
- Additional rules: question order, how to handle unexpected answers
Example prompt:
You are an appointment booking assistant. Politely collect from the user:
— full name
— phone number
— preferred time (morning / afternoon / evening)
Ask one question at a time. If the answer is incomplete — ask for clarification.
Do not confirm the booking until all three answers are received.
Bot variables are available in the prompt: {{user.first_name}}, {{my_variable}}, etc.
AI Tools
Tools let the AI call bot commands mid-conversation: query an API, check product availability, calculate a price, create a request, or start a prepared message sequence.
How It Works
- The AI decides it needs information or an action.
- It sends the user a short message, such as “Looking that up, one moment…”.
- It calls the selected command and passes values through
{{tool_input.*}}variables. - The command runs in the selected mode: it either returns a variable to the AI or performs all of its actions and messages.
- The AI receives the execution result and continues the dialog.
The AI can call up to 3 tools per dialog turn.
Setting Up a Tool
Click AI Tools in the AI Dialog block, then Add tool. You can select an existing command or create a new one directly from the settings window.
| Field | Description |
|---|---|
| Name | A unique snake_case identifier, such as get_weather |
| Description for AI | Explains what the tool does and when the AI should call it |
| Execution mode | Determines whether the command returns a result to the AI or runs the full command |
| Command | The command node executed by the tool |
| Result variable | The variable containing the command response. Shown only in “Return result to AI” mode |
| Parameters | Data the AI passes to the command |
search_knowledge_base is reserved for the built-in knowledge base search and cannot be used by a custom tool.
Execution Modes
Return result to AI — the command runs API requests, integrations, variable operations, or database operations. The value from Result variable is returned to the AI, which prepares a reply for the user. Use this mode for searches, data checks, and calculations.
Run full command — the whole command runs, including its messages and other actions. The command shows its result to the user itself, and the AI continues the dialog afterward. No result variable is required. Use this mode to send a product card, a prepared instruction, or a complete message sequence.
Tool Parameters
Parameters are values the AI inserts into {{tool_input.name}} variables inside the linked command.
How to configure them:
- Open the linked command and insert
{{tool_input.param_name}}wherever the value is needed — URL, request body, text, and so on:https://api.example.com/weather?city={{tool_input.city}}&units={{tool_input.units}} - Return to the tool editor and select that command. The
cityandunitsparameters will appear automatically. - Describe every parameter so the AI understands which value to provide.
- Select its type (
string,number, orboolean) and mark required parameters.
If you change the command afterward, click Rescan beside the Command field. Parameters can also be added and removed manually.
Result Variable
In Return result to AI mode, the command must write the required value to the selected variable. For example, if an API request saves its response to api_response, enter api_response in the Result variable field.
Difference from the dialog block's “Result variable prefix”: a tool result variable is a temporary response from one command that the AI uses in the current conversation. The block result prefix contains the final dialog data for subsequent flow nodes.
Example: Product Catalog Search
Command search_catalog:
- API request:
GET https://mystore.com/api/search?q={{tool_input.query}}&limit={{tool_input.limit}} - Response saved to
search_result
Tool in the AI Dialog block:
- Name:
search_catalog - Description: “Search the product catalog using the user's query”
- Mode: “Return result to AI”
- Command:
search_catalog - Result variable:
search_result - Parameters:
query(string, required) andlimit(number)
You can add this instruction to the system prompt: “Use search_catalog when the user is looking for a product.”
Knowledge Base
The knowledge base contains documents and text entries about your company, products, services, and operating rules. When connected, the AI can find a relevant passage and use it to answer the user.
How to Connect It
- Open Bot settings → Knowledge base. You can also click the bot knowledge base link below “AI Tools”; it opens in a new tab.
- Upload documents or add text entries.
- Wait until at least one document has the Ready status.
- If needed, open the Test tab and check which passages are found for your question.
- Return to the required AI Dialog block and enable Use bot knowledge base.
- Save the flow changes.
Data is first added in the selected bot's settings and only then enabled in an AI Dialog block. The switch applies only to that block. If your flow has several AI Dialog blocks, enable the knowledge base in each one where it is needed.
The switch is unavailable when the knowledge base is not included in the current plan or when there are no ready documents. Documents that are queued, processing, or failed are not counted.
How the AI Uses It
- The AI decides when a user's question requires a knowledge base search.
- Search is limited to the selected bot's knowledge base.
- Matching passages and their source names are passed to the AI, which then prepares the answer.
- You do not need to create a separate search command: the built-in tool is connected automatically.
- Documents are added, tested, and deleted only under Bot settings → Knowledge base.
You can add a rule to the system prompt, for example:
Use the knowledge base for questions about the company, prices, and services.
If the materials do not contain an answer, say so honestly and do not invent facts.
Canvas Connections
- Purple edge → node after dialog completion
- Gray dashed edges 🛠️ → commands called by AI tools
Tips
- One block = one task. Don't try to collect too many unrelated pieces of data in a single dialog.
- Describe parameters precisely. The description determines how accurately the AI fills in the value.
- Test tools independently. Verify that the tool command works correctly with test data before connecting it to the AI.
- Check the knowledge base in the Test tab. This lets you see the matched text and its source before using it in a live dialog.
- 3-call limit. The AI can call at most 3 tools per turn — to prevent infinite loops.
- Streaming is incompatible with buttons and polls. If inline/reply buttons or polls are enabled, streaming mode is automatically disabled.
