AI Agents & Automation
Rule-Based Logic
Functioning, Implementation and Example
Specifications
Base Settings
Tip
AI agents offer an innovative way to handle customer inquiries efficiently and automate standard processes.
Thanks to flexible configuration, agents can be precisely tailored to individual requirements. The setup is done in a few, clearly structured steps, which are described under the tabs detailed above.
1. Set Specifications
Here the foundation for the AI agent is laid. This includes:
-
Name: The agent's name should reflect its area of responsibility, e.g., "Prepayment-Agent".
-
Description: A brief description helps to grasp the purpose of the agent at a glance.
-
Topic: The topic results from the existing skill tags. For example, a Prepayment-Agent could be assigned the skill tag "Payment Transactions". This assignment ensures clear organizational allocation and simplifies, for instance, access via the template catalog.
-
Channels: Determine through which communication channels the AI-Agent should act – email, chat, mail, phone, etc. An agent can easily be assigned to multiple channels.
2. Choose Avatar
The avatar gives the AI agent a visual identity and emphasizes its individual character. Various options are available:
-
Style: Should the avatar look more professional, friendly, or neutral?
-
Color accents: Additionally, colors can be selected that, for example, match the brand identity.
-
Recognition value: A uniform avatar across all channels strengthens the visual appearance of the AI agent.
3. Configure Intelligence
Here it is determined how the AI agent solves tasks:
-
Smart argumentation logic: Rules in natural language without programming – ideal for standard processes.
-
Rule-based logic: Code-based workflows for more complex procedures.
4. Adjust Personality
The personality of the AI agent defines how it communicates – not only content-wise but also in tone. The communication style can be finely adjusted using intuitive sliders:
-
Informal to formal: Should the AI agent appear casual or businesslike?
-
Speaking style: From concise responses to detailed explanations.
-
Concise to comprehensive: Determines the level of detail in feedback.
These adjustments ensure that the AI agent perfectly matches the company language and positively supports the customer experience.
Info
**All specifications – name, topic, intelligence, personality, and channels – can be flexibly adjusted at any time. This keeps the AI Agent dynamic and always adapted to current requirements.
Recognition
Methods and Configuration
Tip
The Recognition section determines when an AI agent is assigned to a ticket. This can be based on keywords, ticket data, or AI analysis.
Authentication
If this option is activated, requests from unauthenticated customers will be ignored by the AI agent. This setting is particularly suitable for processes that involve sensitive data or require customer verification.
Recognition Methods
Various methods are available for assigning AI agents:
Input Parameters
Purpose and Configuration
Tip
Rule-based AI agents use defined input parameters to extract information from customer inquiries or other data sources for further processing. These parameters control which data is collected, analyzed, displayed, and used for processing.
Parameter Management
1. Input Parameters and Their Sources
Input parameters can be obtained from various sources:
- Ticket data: Information from the original ticket
- Customer data: Master data of the customer
- Contract data: Information about the customer's contract
- Extraction by AI: Automatic AI analysis of the customer request to recognize relevant information
- Manual definition: A fixed value defined by a user
Note
The source must match the attribute: a customer attribute can only be accessed under Customer data, not under Ticket data. If a parameter is used in an agent's recognition condition and refers to an attribute that is not present in the chosen source, it behaves like an empty value — see Configuring tags.
2. Parameter Values and Mandatory Fields
Every parameter requires a value that is automatically adopted depending on the source, extracted by AI, or manually entered. Mandatory fields ensure that certain information is available before the AI agent can carry out processing.
3. Parameter Attributes
The following fields are available when configuring a parameter:
| Field | Description |
|---|---|
| Reference to Source Key | Technical key for identification in the data object, e.g. channel |
| Variable name in business logic | Internal identifier for further processing in logic and actions |
| Label for User | Display name in the UI, if the parameter is visible to users |
| Format | Data type, e.g. String, Boolean, Number, Date or Enum |
| Options | Selection values for parameters of type Enum |
| Internal Description | Explanation of the function or use; in case of AI extraction, it serves as a recognition hint |
| Required | Determines whether the parameter must be set |
| Visibility for users | Controls the UI display: Visible, Hidden, Readonly |
| Display Options | Additional display settings for visible string parameters |
4. Visibility and Editing Restrictions
- Visible: The parameter can be viewed and edited by the editor, unless otherwise restricted.
- Hidden: The parameter is processed in the background, but not displayed.
- Readonly: The value is visible, but cannot be modified.
5. Display Options for Visible Text Parameters
For parameters with the format String and visibility Visible, additional display options can be configured:
- Multiline: The parameter is displayed as a multi-line input field.
- Lines: Defines the height of the multi-line input field.
- Automatically submit: Specifies whether an input is automatically accepted/sent.
These display options are only available for visible String parameters. For hidden, read-only or differently formatted parameters, they are not displayed.
6. Requirement of a Parameter
- Yes: The parameter must be specified in order for the processing to be carried out using or by the AI agent.
- No: The parameter is optional and can remain empty.
Parameters can be removed at any time.
Example Bank Data
To process customer requests for bank data adjustments, the bank data agent needs a combination of certain information and checks. It draws the relevant information from the input parameters, while the checks are defined in the business logic.
The following input parameters are thus configured for this AI agent:
contractId(Source: Contract data) → The customer's contract number to assign the change to the correct contract.newIBAN(Source: Extraction from the customer request with AI) → The new bank details the customer wishes to deposit.oldIBAN(Source: Contract data) → The previously deposited IBAN to compare it with the new one.accountHolder(Source: Extraction from the customer request with AI) → The name of the account holder to verify the identity. If no name is mentioned, the value remains empty.date(Source: Extraction from the customer request with AI) → If specified, the date when the new bank account should be valid.
Summary
The predefined configuration of input parameters allows rule-based AI agents to efficiently process customer inquiries. In combination with the business logic, data is recorded in a structured manner, checked, appropriately displayed in the UI, and automatically processed. This ensures precise processing with minimum manual effort.
Business Logic
Functioning and Example
Tip
The business logic defines how an AI agent processes input parameters and makes decisions based on them. It ensures that customer inquiries are checked, processed, and executed correctly in a structured manner.
Function
After the relevant input parameters have been collected, business logic takes over the processing. This includes:
-
Checks for completeness and plausibility
-
Validation of data based on predefined rules
-
Determination of additional values, if required
-
Triggering of actions based on the results of checks
Technical Implementation
The business logic can be implemented in:
-
PHP (8.2)
-
Python (3.11)
-
JavaScript (Node 20)
The implementation follows a structured processing pipeline:
1. Initialization and Input Validation
-
Input parameters are taken from the context and translated into a standardized format.
-
Mandatory fields are checked, missing values are replaced by defaults if necessary.
-
Type conversions are performed, such as
bool,int,float, to ensure consistent processing.
2. Rule-Based Processing
-
The business logic validates the inputs based on defined rules (e.g., format checks, plausibility checks).
-
If necessary, external API calls or database queries are made to supplement additional information.
-
Computations and decision processes are based on the parameters (e.g., branching for varying inputs).
3. Actions and Output
-
The business logic controls the further process by:
-
Making automatic changes in the system
-
Calling external APIs (e.g., for data storage)
-
Generating queries or confirmations
-
-
The returned values are standardized as an response object, which depending on the context can contain a confirmation, error messages or interaction options.
The business logic provides results that are processed further via output handling. Here it is determined how the AI agent reacts to certain scenarios – either through confirmations, queries or interaction possibilities.
Example: Business Logic for Processing an IBAN Change
An AI agent processes requests to change a bank account. The business logic ensures that the change is implemented correctly and all relevant checks are made.
1. Validate Inputs Firstly, inputs are standardized and checked:
-
Remove spaces in the IBAN
-
If no account holder is specified, it is supplemented from the contract data
$this->input->newIBAN = str_replace(' ', '', $this->input->newIBAN);
$this->input->oldIBAN = $this->input->oldIBAN ?? '';
$this->input->oldIBAN = str_replace(' ', '', $this->input->oldIBAN);
// In case no account holder is specified, retrieve it from contract data
if (!($this->input->accountHolder ?? null)) {
$this->input->accountHolder = sprintf(
'%s %s',
$this->contractData->firstname,
$this->contractData->lastname
);
}2. Validate Inputs
The business logic checks if the new IBAN is correct:
-
IBAN Validation: Format and Check Digits validation
-
Contract exists: The change must be assigned to a valid contract
// Retrieve contract
$this->contractData = ApiEnneo::getContract($this->input->contractId);
if (!$this->contractData) {
throw new Exception('Contract not found.');
}
// Format and Check Digits validation of the IBAN
if (!$this->validateIbanFormatting($this->input->newIBAN) || !$this->validateIbanChecksum($this->input->newIBAN)) {
$this->interaction->infos[] = new IntentInfo(
type: 'warning',
message: 'IBAN not in correct format or checksum invalid',
);
$this->interaction->options[] = new IntentOption(
type: self::ACTION_IBAN_INVALID,
name: 'Ask customer for correct IBAN',
recommended: true,
);
throw new ChangeBankDataException();
}3. Output Result and Determine Next Action
Depending on the result of the checks, the business logic decides how the process continues:
-
If the checks are successful → IBAN is saved
-
If errors are detected → Customer receives a request or chance to correct
if ($this->input->_action === self::ACTION_ENTER_INTO_SYSTEM) {
$this->saveBankData();
foreach ($this->form->fields as $field) {
$field->readonly = true;
}
} else {
$this->interaction->options[] = new IntentOption(
type: self::ACTION_ENTER_INTO_SYSTEM,
name: 'Store bank details in system',
recommended: true,
);
}4. Interaction Design with the SDK
Interactions are the primary tool of enneo to provide agents with structured feedback. An interaction consists of four elements:
- Infos: What messages or warnings should be shown to the agent?
- Form: What input fields, for example, text fields or dropdown menus, should be displayed?
- Data: What values do the input fields have?
- Options: What buttons should be shown to the user?
To create an interaction, the enneo SDK can be used, a library with object definitions. The above interaction could be created with this code:
Info
Note: The enneo SDK requires environment variables that specify the API URL of enneo and a session token for authorization. If a source code executor is used, these environment variables will be inserted at runtime and don't have to be set manually. If the SDK is integrated into your own web service, ENNEO_API_URL must be set to https://instance-name.enneo.ai and ENNEO_SESSION_TOKEN to a service worker token.
<?php
use EnneoSDK\Interaction;
require(getenv()['SDK']);
$interaction = new Interaction(data: $in);
$interaction->infos[] = new IntentInfo(
type: 'warning',
message: 'The contract was cancelled before the start of supply and therefore cannot be cancelled.'
);
$interaction->options[] = new IntentOption(
type: 'termination_already_processed',
name: 'Inform customer',
recommended: true
);// Load SDK
const dotenv = require('dotenv');
dotenv.config();
const sdkPath = process.env.SDK || 'sdk.js';
const SDK = require(sdkPath);
(async () => {
const inputData = await SDK.getInputData();
console.log('Received input data:', inputData);
const interaction = new SDK.Interaction(inputData);
interaction.infos.push(
new SDK.IntentInfo(
'warning',
'The contract was cancelled before the start of supply and therefore cannot be cancelled.',
),
);
interaction.options.push(new SDK.IntentOption('termination_already_processed', 'Inform customer', true));
console.log(JSON.stringify(interaction));
})();Instead of the SDK, the JSON object for the interaction can also be created directly. Here is a complete example of the interaction of the shown cancellation AI functionality:
{
"data": {
"date": "2023-12-08",
"type": "regular",
"dryRun": "true",
"_action": "null",
"contractId": 756852,
"dateReceived": "2023-12-08",
"proofIncluded": false
},
"form": {
"fields": [
{
"id": "contractId",
"type": "integer",
"label": "Contract Number",
"fields": null,
"hidden": true,
"options": null,
"readonly": false,
"valueRef": "data.contractId",
"validation": null,
"placeholder": null,
"defaultValue": null
}, {
"id": "date",
"type": "date",
"label": "Cancellation Date",
"fields": null,
"hidden": false,
"options": null,
"readonly": false,
"valueRef": "data.date",
"validation": null,
"placeholder": null,
"defaultValue": null
},{
"id": "type",
"type": "select",
"label": "Cancellation Type",
"fields": null,
"hidden": false,
"options": [
{
"id": "regular",
"label": "Regular",
"value": "regular"
},
{
"id": "priceAdjustment",
"label": "Price Adjustment",
"value": "priceAdjustment"
},
{
"id": "relocation",
"label": "Relocation",
"value": "relocation"
},
{
"id": "death",
"label": "Death",
"value": "death"
},
{
"id": "custom",
"label": "Other",
"value": "custom"
}
],
"readonly": false,
"valueRef": "data.type",
"validation": null,
"placeholder": null,
"defaultValue": null
},
{
"id": "_action",
"type": "text",
"label": "_action",
"fields": null,
"hidden": true,
"options": null,
"readonly": false,
"valueRef": "data._action",
"validation": null,
"placeholder": null,
"defaultValue": null
},
{
"id": "proofIncluded",
"type": "checkbox",
"label": "Proof Included",
"fields": null,
"hidden": false,
"options": null,
"readonly": false,
"valueRef": "data.proofIncluded",
"validation": null,
"placeholder": null,
"defaultValue": null
},
{
"id": "dryRun",
"type": "checkbox",
"label": "(actually perform write access)",
"fields": null,
"hidden": true,
"options": null,
"readonly": false,
"valueRef": "data.dryRun",
"validation": null,
"placeholder": null,
"defaultValue": null
},
{
"id": "dateReceived",
"type": "date",
"label": "Cancellation Received",
"fields": null,
"hidden": true,
"options": null,
"readonly": false,
"valueRef": "data.dateReceived",
"validation": null,
"placeholder": null,
"defaultValue": null
},
{
"id": "sourceCode-0",
"type": "dict",
"label": "Source code executor response",
"fields": null,
"hidden": false,
"options": null,
"readonly": false,
"valueRef": "data.sourceCode-0",
"validation": null,
"placeholder": null,
"defaultValue": null
}
]
},
"infos": [
{
"code": null,
"type": "warning",
"message": "The contract was cancelled before the start of supply and therefore cannot be cancelled.",
"extraInfo": null
}
],
"options": [
{
"icon": "check",
"name": "Inform Customer",
"type": "termination_already_processed",
"order": 1,
"handler": "",
"recommended": true
}
]
}Summary
The business logic defines how an AI agent processes input parameters and makes decisions based on them. It ensures efficient and traceable execution of customer requests, validations, and further processing via automated rules and processes, thereby minimizing manual interventions.
Output handling
Functionality and Example
Tip
The output handling determines how the AI agent reacts to the results of the business logic. It decides whether and how information is returned to the user or a system.
Basic Functionality
Output handling is based on predefined rules that build on the results of the business logic. It controls, among other things:
-
Text Templates: Automated messages to the user, e.g., confirmations or queries.
-
Interactions: Provision of buttons or forms for further processing.
-
API Calls: Forwarding the results to other systems.
-
Automatic Ticket Actions: Entries into the system or completion of processes.
In enneo, there are different action types that can trigger a reaction:
-
AI Suggestion Response: The AI generates a response to the customer based on the context.
-
Use Text Template: A defined message is sent directly.
-
Interaction: The user receives choices for further processing.
-
Close ticket without replying: The concern is automatically concluded.
-
Send text template and close ticket: A confirmation is sent, and the ticket is concluded.
Example: Output handling in Bankdata agent
The business logic of the bank data agent makes decisions based on input parameters. The output handling builds on this and controls the response.
1. IBAN is already in the system
If the new IBAN is already deposited (iban_already_in_system), a text template is automatically sent to the customer:
Thank you for submitting your bank data.
The bank account with the ending digits ...{{last4digits newIBAN}} is already stored in our system and will be used by us
{{#if payoutOnly}}for future credits{{else}}for monthly deductions, bills, and any potential credits{{/if}}.
-
Action: Use text template
-
Condition:
_action = iban_already_in_system -
Automatic execution: Yes → Message is automatically sent.
2. IBAN is invalid
If the business logic identifies the new IBAN as invalid (iban_invalid), an alternative action is carried out. The customer is asked to provide a correct IBAN.
The given IBAN {{newIBAN}} is not valid.
Please check the IBAN for any typing errors and send us the correct bank details so we can deposit them. Thank you for your support.
-
Action: Interaction or use text template
-
Condition:
_action = iban_invalid -
Automatic execution: No → The user decides the further course of action.
3. IBAN has been successfully deposited
Once the IBAN has been successfully entered into the system (enter_into_system), a confirmation is sent to the customer:
Thank you for your message.
The bank account with the ending digits ...{{last4digits newIBAN}} has been stored in our system and will be used by us
{{#if payoutOnly}}for future credits{{else}}for monthly deductions, bills, and any potential credits{{/if}}.
-
Action: Use text template
-
Condition:
_action = enter_into_system -
Automatic execution: Yes → Message is sent directly.
Summary
The output handling connects the business logic with the communication. It ensures that decisions are automatically turned into actions – be it through direct confirmations, queries, or follow-up processes. This way, customer inquiries are processed efficiently, traceably, and without manual intervention.
Testing and Publishing
Functionality
Tip
Test cases simulate real scenarios to ensure that the AI agent operates correctly. Each test case is based on a ticket ID and represents the entire processing process. Regular tests ensure that the AI agent operates stably and reliably, even with changed requirements or system updates.
Test Procedure
-
A real ticket ID is selected and added.
-
The AI agent processes the ticket based on the defined logic.
-
The result is displayed as successful or failed.
Result Interpretation
-
Successful: The test confirms that the AI agent responds as intended. The AI agent can now be published.
-
Failed: In this case, the existing settings need to be reviewed. Instructions, detections, input parameters, business logic, and/or output handling should be examined for possible inconsistencies. After adjusting, the test should be performed again.