Description of actions in the prompt
Actions allow the bot to receive and modify data in external systems: search for a client, create a record, change the status of a transaction, send a webhook or perform a sequence of operations.
In order for the bot to cause actions predictably, configure not only the action card, but also the rules for its use in the system pump.
Before writing the prompt
First, create an action according to the instruction How actions work and fill in:
- Action name is a clear name in the interface.
- The code name is a unique identifier by which the action can be uniquely specified in the prompt;
- Description of action for the bot - purpose, call conditions and restrictions;
- Execution response - what the bot should do after the result is received
- What to do as a result of is a basic or integration operation and its parameters.
The description in the card helps the model understand the individual action. The system prompt specifies the general order of operation: what data to collect, when to request confirmation, in what sequence to call actions and how to respond to the user.
What is required to indicate in the Prompt
1. Condition of call
Describe the specific situation in which the action is permitted.
Use `check_stock` only when the customer asks whether a specific product is available.
Don’t use vague phrases like “cause action if necessary.” Indicate the intention of the user and the expected result.
2. Mandatory data
List the values that the bot must receive before the call.
Before calling `create_record`, collect the service, customer name, phone number, and preferred date.
If any value is missing, ask a follow-up question and do not call the action.
3. Verification and confirmation
For creation, modification, deletion, payment and other significant transactions, request explicit confirmation.
Before calling `create_order`, show the order contents and total.
Call the action only after the customer clearly confirms.
Do not consider a question or clarification as confirmation of the operation.
4. Multiple actions
If the result of one operation is needed by another, record the sequence.
1. Call `find_contact` and check whether the contact exists.
2. If found, use its identifier in `create_deal`.
3. If not found, call `create_contact` first and then `create_deal`.
5. Response after completion
Describe a successful result, an empty answer and an error.
After a successful `create_order`, provide the order number returned by the action.
If no number is returned, do not invent one; say that the order could not be confirmed.
If an error occurs, offer to try again or hand the conversation over to a manager.
The bot must use only actual data from the result and not substitute fictitious identifiers, dates, prices or statuses.
Use of preview results
In the transaction card, open Preview of the result. It shows an example of JSON that an action will return to the bot without executing an operation or altering real data.
From the preview, determine:
- which fields are available after execution;
- where the desired identifier, status or message is located;
- what values may be missing;
- How to respond to the user.
The preview does not replace testing: the actual response of the external system may depend on the data transmitted and the integration settings.
An example of a finished block of a prompt
## Customer booking
Use `create_record` when a customer wants to book a service.
Before calling it, collect:
- the service;
- the customer name;
- the phone number;
- the date and time.
Repeat all details to the customer and ask for confirmation.
Do not call the action before explicit confirmation.
After success, provide the date, time, and booking number from the result.
If the slot is unavailable, offer another time.
If the action returns an error, do not claim that the booking succeeded; offer help from a manager.
Typical errors
- the action is mentioned without a code name;
- It is not specified which data are required;
- the action is called before the confirmation of the client;
- several actions are listed without an order of execution;
- The bot must report data that is not available as a result.
- There is no script for an error or an empty answer.
- A financial or irreversible transaction is permitted without further verification.
Verification of settings
Test at least four situations:
- All data collected, the user confirmed the operation.
- One mandatory value is missing.
- The user changed the data or refused to confirm.
- The action returned an empty result or error.
For operations that change data, use test records and accounts.