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

  1. The bot enters the AI Dialog block.
  2. The AI sends the first message according to the system prompt.
  3. The user replies — the reply is forwarded to the AI as a new message.
  4. The AI continues the dialog, accumulating responses in a data object.
  5. 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}}

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 a database, run calculations — and use the result in its reply.

How It Works

  1. The AI decides it needs information from an external source.
  2. It sends the user a short "loading" message (e.g. "Looking that up, one moment…").
  3. It calls the specified command, passing values via {{tool_input.*}} variables.
  4. The command runs and saves its result to a variable.
  5. The AI receives the result and continues the dialog with the new information.

The AI can call up to 3 tools per dialog turn.

Setting Up a Tool

Click the 🛠️ Tools button in the AI Dialog block, then Add tool.

Field Description
Name snake_case identifier — the AI refers to the tool by this name (e.g. get_weather)
Description for AI Explains to the AI what the tool does and when to call it
Command The command node that the tool executes
Result variable The variable from which the command's response is read (e.g. api_response)
Parameters Data the AI passes into the command

Tool Parameters

Parameters are values the AI inserts into {{tool_input.name}} variables inside the linked command's blocks.

How to configure:

  1. Open the linked command and insert {{tool_input.param_name}} wherever the value is needed (URL, request body, text, etc.):
    https://api.example.com/weather?city={{tool_input.city}}&units={{tool_input.units}}
    
  2. Go back to the tool editor and select this command — the parameters city and units will appear automatically.
  3. Add a description for each parameter — the AI uses it to know what value to provide:
    • city → "The city for which weather is requested"
    • units → "Unit of measurement: celsius or fahrenheit"
  4. Choose the type (string / number / boolean) and mark required parameters.

If you modified the command after selecting it — click the Rescan button next to the Command field.

Result Variable

After the command runs, the AI reads one variable and receives its value as the tool result.

Make sure the command writes the expected result to this variable. For example, if you use an API request block that saves its response to api_response, set api_response as the Result variable.

Difference from the dialog block's "Result variable prefix": The tool's result variable is the temporary response of a single command — visible only to the AI within the current turn. The block's result prefix holds the final data from the entire dialog, available to subsequent nodes in the scenario.

Example: Product Catalog Search Tool

Command search_catalog:

  • API request block: GET https://mystore.com/api/search?q={{tool_input.query}}&limit={{tool_input.limit}}
  • Result saved to variable search_result

Tool in AI Dialog:

  • Name: search_catalog
  • Description: "Search the product catalog by a text query"
  • Command: search_catalog
  • Result variable: search_result
  • Parameters:
    • query (string, required) — "The user's search query"
    • limit (number) — "Maximum number of results to return"

System prompt:

You are an online store assistant. Help users find products.
Use the search_catalog tool whenever the user is looking for something.

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.
  • 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.