How to succesfully train your Agent

icon picker
Requirements for successful Agent training

Agent Script Validation

@Script Validation
is a check during
@Agent
@Training
that all system requirements for the
@Agent
are satisfied.

Agent training

There are two ways to train an
@Agent
:
Click the Train button located in the upper right corner of
@BotBuilder
in the Agent Designer tab. ​
image.png
Click the button on the
@Agent
card. ​
image.png
When you press the Train button:
@Script Validation
occurs. The process can take some time, up to 10 minutes on large
@Agent
s.
Upon successful completion of the
@Script Validation
, a
@Trained Agent Model
is created based on the valid
@Script
.
During this time, the Train button will be inactive. If the
@Script
does not meet the requirements, then
@Script Validation
will fail and an error text will appear in the lower right corner.
Important: If this
@Script
has already been trained, and after making changes the
@Script Validation
fails, then the old
@Trained Agent Model
will work.

Agent requirements for successful validation

In order for the
@Script Validation
to be successful, the
@Script
must satisfy the following rules:
The
@Script
should not have a
@Script Branch
without a
@Blocking Slot
;
The
@Script Branch
es after the
@Timer
and
@Incoming Request Slot
s must be closed;
@Intent
‘s
@Training Dataset
must contain at least two lines;
Each
@Intent
@Training Phrase
phrase must contain at least one letter;
The name of
@User Context Variables
must comply with the .
The contents of the
@result
@Subslot
of a
@Regular Expression Slot
must conform to its syntax.
The expression in the
@condition
@Subslot
of the
@Transition Rule
@Slot
must match its syntax.
In the
@Incoming Request Slot
,
@Slot Filling
,
@Memory
,
@External Request
@Slot
s, there is no attempt to overwrite System context variables that are prohibited from overwriting.
The
@Notification
@Slot
uses the existing Agent Channel.
There are no nested loops in the
@Repeat
@Slot
.

Validation errors and their designation in the Tree

1. Lack of blocking slots in script branches

@Blocking Slot
— a
@Slot
at which the
@Agent
waits for an incoming message from the
@Project Channel
.
@Bot user’s Message
Pushing a
@button
.
Each
@Script Branch
must contain at least one
@Blocking Slot
, otherwise, if there is a
@Script Branch
without a
@Blocking Slot
, the
@Agent
can enter into permanent cycle (it will go through all
@Slot
s from the
@Script Branch
an infinite number of times).
List of
@Blocking Slot
s:
@Wait For Reaction
;
@Button Menu
;
@Change Chat Mode
;
@Incoming Request Slot
.
If there is not a single
@Blocking Slot
from the list in the
@Script Branch
, then the following error will appear during
@Agent
@Training
, where *Slot ID* -> *Slot ID* is the path from the Start
@Slot
to the
@Slot
that ends the invalid
@Script Branch
:
image.png
Important: The
@Blocking Slot
does not have to be at the end of the
@Script Branch
. It can be present anywhere in the
@Script Branch
.

Error highlighting and tooltip

image.png
image.png
Highlighting type
Validation error
Highlighting
Error text
1
Branch highlighting
No blocking slots in script branches.
The entire scenario branch that lacks a blocking slot is highlighted. When adding a slot to a problematic branch, the new slot in the tree is darkened and not highlighted in any color.
Blocking slot types (Button menu, Change chat mode, Incoming request, Wait for reaction) were not found in the branch: *Slot ID* -> *Slot ID*” What to do: add blocking slots to the branch.
No results from filter

2. Unclosed script branches

The following
@Slot
s cannot be located at the end of a
@Script Branch
:
@Timer
;
@Incoming Request Slot
.
These
@Slot
s determine the beginning of one of the
@Agent
's scenarios, so some
@Slot
s must be added after them.
If the Scenario at the end of the
@Script Branch
contains one of the listed
@Slot
s, then the following error will appear during
@Agent
@Training
:
Снимок экрана 2021-04-13 в 14.45.32.png
Where *Slot ID* is the ID of the
@Slot
after which the
@Script
must be continued.

Error highlighting and tooltip

image.png
image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting followed by a button to add a new slot
Unclosed script branches.
The slot after which you need to continue the script, the button to add a slot, and the connecting line between them are highlighted.
Slot of this type can’t be the last one in the branch. What to do: add subsequent branch or at least any of these slots: Wait for reaction, Change chat mode, Jump.
No results from filter

3. Insufficient number of phrases in the training set

For successful recognition, the
@Training Dataset
should be filled according to the rules described in the article .
There must be at least two rows in the
@Intent
@Training Dataset
.
image.png
If there is only one line in the
@Training Dataset
, an error will appear when Training the
@Agent
, where the name of the problematic
@Intent
is specified in quotation marks.
Снимок экрана 2021-04-13 в 14.55.31.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Insufficient number of phrases in the training set
The problematic intent sub-slot with an insufficient number of phrases in the training set is highlighted.
The number of requests of the intent ‘intent name’ is not enough, it should be at least 2. What to do: add some requests to the intent.
No results from filter

4. Insufficient number of letters in the training set phrase

One
@Intent
@Training Phrase
cannot contain less than one letter.
image.png
If the
@Intent
@Training Phrase
does not contain at least one letter character, then the following error will appear during
@Agent
@Training
:
Снимок экрана 2021-04-13 в 14.59.51.png

Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Insufficient number of letters in the training set phrase
The problematic intent sub-slot with an insufficient number of letters in the training sample phrase is highlighted.
The number of letters in the request "..." of this intent is not enough, it should be at least 1. What to do: edit the request so that it contains at least 1 letter.
No results from filter

5. Unescaped characters in the result sub-slot of the Regular Expression slot

The ' and \ characters in the
@result
@Subslot
of a
@Regular Expression Slot
must be escaped: they must be preceded by a \ character.
If there is no escaping of the \ character in the
@result
@Subslot
of the
@Regular Expression Slot
, the following error will appear during
@Agent
@Training
:
Снимок экрана 2021-04-28 в 14.11.02.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Unescaped characters in the result sub-slot of the Regular Expression slot
The problematic result sub-slot with unescaped ' or \ characters is highlighted.
and \ characters in result subslots must be escaped with a \ character. What to do: escape and \ characters with a \ character.
No results from filter

6. An attempt was made to overwrite system context variables that are not allowed to be overwritten.

The following
@System Context Variables
and
@Channel Variables
are not overwriteable:
Variable
Description
Usage
Changed by user
1
agent_id
Unique identifier of the
@Agent
in the
@Platform
identification of the current
@Agent
in this
@Chat
Disabled
2
chat_id
Unique
@Chat
ID in the
@Platform
@Chat
Identification in the
@Platform
@Chat
identification in
@Incoming Request Slot
Disabled
3
channel_chat_id
@Bot User
identifier in the
@End Channel
is a synthetic variable, the rules for its formation are set in the
@Connector
settings for this channel
Identification of
@Chat
and/or
@Bot User
in the
@End Channel
Creation of
@chat_id
Disabled
4
channel_id
Unique identifier of the
@End Channel
Unique identifier of the
@Project Channel
in which communication takes place in this
@Chat
Disabled
5
date
Time of receiving the last message from the
@Bot User
= time of receiving the last value of
@client_message
, but specifically from the
@Project Channel
(and not in the
@Memory
@Slot
)
in a
@Script
at the discretion of the user
for execution purposes of the
@Script
Disabled
6
dialog_id
Conversation ID
for system purposes
Identification of new
@Dialog
Disabled
7
modified_at
Time of last modification of the
@Chat Context
in a
@Script
at the discretion of the user
Disabled
8
slot_id
@Platform
-unique identifier of the last "executed"
@Slot
in the
@Script
in a
@Script
at the discretion of the user
Disabled
9
strategy_modified_at
Creation time
@Trained Agent Model
(time of last
@Agent
@Training
)
in a
@Script
at the discretion of the user, also used to reset the
@Chat
state when
@Training
the
@Agent
Disabled
10
confidence
Percentage of confidence of the
@NLU
model when recognizing
@Request
when going through the
@Script
after the
@NLU
@Slot
Disabled
11
error
Error text received as a result of executing
@NLU
/
@Regular Expression Slot
/
@Memory
@Slot
when going through the
@Script
after
@NLU
/
@Regular Expression Slot
/
@Memory
@Slot
Disabled
12
incoming_request_id
@Platform
-unique identifier (token) of
@Incoming Request
used to initialize the passage of the
@Incoming Request Slot
Disabled
13
intent
@Platform
-unique identifier of the recognized Intent
when going through the
@Script
after the
@NLU
@Slot
Disabled
14
IR_url
Address of the active
@Incoming Request Webhook
in this
@Trained Agent Model
To send a request from external systems to the
@Agent
Disabled
15
notification_count
Counter of mailings in a specific
@Chat
in a
@Script
at the discretion of the user
Disabled
16
notification_task_id
Takes the value equal to the Mailing Task ID that the system sent in the response to the
@Mailing Request
from the external system
in a
@Script
at the discretion of the user
Disabled
17
notification_init_time
Start date and time of the
@Notification
@Slot
execution in UTC
in a
@Script
at the discretion of the user
Disabled
18
notification_message_id
When a mailing is sent, the
@End Channel
returns the message id
@Agent
movement through the
@Script
Disabled
19
notification_id
mailing id, currently =
@Notification
@Slot
id
@Agent
movement through the
@Script
Disabled
20
notification_status
Technical status of the mailing Possible values: 'no_account', 'failed', 'sent', 'delivered', 'read'
@Agent
movement through the
@Script
Disabled
21
platform_chat_id
"Intermediate version" of the Chat ID, designed to match old chat IDs with new IDs
Service variable, not used yet
Disabled
22
chat_language
The variable stores the recognized language
in a
@Script
at the discretion of the user
Disabled
23
repeat_index
the variable is used to reflect the number of the current loop iteration, iteration numbering starts from 0
Disabled
No results from filter
Name
Description
Editing by a user
1
channel_visitor_id
ID of
@Bot User
or
@Chat
in an
@End Channel
Disabled
2
channel_conversation_id
ID of
@Dialog
or
@Chat
in an
@End Channel
Disabled
3
channel_visitor_firstname
@Bot User
‘s name in an
@End Channel
Disabled
4
channel_visitor_lastname
@Bot User
‘s surname in an
@End Channel
Disabled
5
channel_visitor_account
@Bot User
‘s accountvin an
@End Channel
Disabled
6
channel_visitor_phone
@Bot User
‘s phone in an
@End Channel
Disabled
7
channel_visitor_email
@Bot User
‘s email in an
@End Channel
Disabled
8
channel_visitor_source
the source from which the
@Bot User
came to the
@End Channel
(for example, utm tags)
Disabled
9
channel_visitor_auth
Authorization data of the
@Bot User
Disabled
10
channel_visitor_location
@Bot User
‘s location in an
@End Channel
Disabled
11
channel_message_id
message ID in
@Chat2Desk
Disabled
12
channel_message_recipient
A
@Bot
in
@Chat2Desk
is an operator; its id is written to this variable
Disabled
13
channel_webhook_url
Channel webhook URL from
@End Channel
settings
Disabled
14
channel_webhook_token
Channel webhook Token from
@End Channel
settings
Disabled
15
channel_reply_to
Message that was replied to in Telegram
Disabled
There are no rows in this table
When you try to overwrite them in the
@Incoming Request Slot
,
@Slot Filling
,
@Memory
,
@External Request
@Slot
s during
@Agent
@Training
, the following error will appear:
image.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
An attempt was made to overwrite system context variables that are not allowed to be overwritten.
The problematic slot Incoming Request, Slot Filling, Memory, External Request, Synonym is highlighted.
“var” is a system variable that cannot be overwritten in following slot types: Incoming Request, Slot Filling, Memory, External Request, Synonym. What to do: remove the “var” variable from the slot.
No results from filter

7. Incorrect writing of templates in the new syntax

The rules for writing
@Template
s are described in the article . If the
@Template
was entered incorrectly in the new syntax, the following error will appear during
@Agent
@Training
: ​
image.png
Warning text format:
Invalid template syntax:
Slot <id of problem slot>. Error “<error description>” in expression “<problem expression>”
Example:
Invalid template syntax:
Slot 8848840. Error “unexpected char '@' at 3” in expression “{{ @foo }}”
Error explanation: an error was detected in
@Slot
8848840 - an extra '@' symbol with sequence number 3 in the expression {{ @foo }}.
Important: the counting of serial numbers of characters in the problem expression starts from 0.

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Incorrect writing of templates in the new syntax
A slot with an incorrectly composed expression or control structure is highlighted
Error “<error description>” in expression “<incorrectly composed expression>” What to do: edit the expression. New syntax documentation: *documentation link*
No results from filter

8. The Notification slot uses a remote channel

If an
@Project Channel
was previously selected in the
@Notification
@Slot
and then deleted, the following error will appear when
@Training
the
@Agent
:
image.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
The Notification slot uses a remote channel
The problem Notification slot is highlighted
A non-existing channel is set in the destination field (the channel might be deleted). ​What to do: choose an existing channel.
No results from filter

9. Invalid user variable name

If
@Memory
,
@Slot Filling
,
@Notification
,
@Incoming Request Slot
,
@Synonym Slot
or
@External Request
contains
@User Context Variables
whose name does not meet , the following error will appear during
@Agent
@Training
:
image.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Invalid user variable name
The problematic slot containing the variable is highlighted
Wrong name. The name must be no more than 128 characters and may contain only latin letters, numbers and _ . ​What to do: edit the name.
No results from filter

10. Repeat slot nested loops

If there are other
@Repeat
@Slot
s in the
@Repeat Next
@Subslot
@Script Branch
, an error will be displayed:
image.png

Error highlighting and tooltip

image.png
Highlighting type
Validation error
Highlighting
Error text
1
Slot highlighting
Repeat slot nested loops
The problematic Repeat slot is highlighted
Nested repeats are not allowed . ​What to do: delete nested slot Repeat.
No results from filter
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.