AI Agent
Overview
The AI Agent module is LoyJoy's new component for building AI-driven conversational experiences. It allows an AI to understand user intent and use a set of tools to respond to requests and complete tasks. The agent can operate iteratively, meaning it can call multiple tools in sequence (e.g., search a knowledge base, then read a full document, then search the web) before formulating a final answer for the user.
This module replaces the older AI Gateway, AI Knowledge, AI Prompt, AI Smalltalk and AI Recommender modules. It combines the functionality of all those modules into a single, more capable module. If your existing chats use the old modules, we recommend migrating them to the new AI Agent module.
Key Concepts
The AI Agent module is built on two core components:
- Instructions (Prompts): This is where you define the AI's rules and persona. You configure its behavior and provide it with the necessary context to do its job.
- Tools: These are the actions the AI agent can perform. You give the agent a set of capabilities (like searching knowledge or running a process), and it will intelligently decide which one to use—or which combination of tools to use—based on the user's query.
How to Set Up Your AI Agent
Configuring your agent is a step-by-step process.
1. Add the Module
Start by adding the "AI Agent" module to your process. This single module will handle the conversational experience.
2. Select an AI Model
Choose the underlying Large Language Model (LLM) that will power your agent. LoyJoy offers a wide selection, including models from Azure, OpenAI, Anthropic, Mistral, and more.
A good starting point is Azure GPT-4.1 Mini, which offers an excellent balance of speed and power.
3. Configure Instructions (Prompts)
You define your agent's behavior using two types of instructions:
-
Pre-defined Instructions: These are system-provided settings like
Name,Role,Personality,Language Handling, andGuard Rails. You can pick and choose from the available options (e.g., select "Joyful" forPersonality), but you cannot edit the text of the instructions themselves. TheNameinstruction defines how the agent introduces itself (default: "You are the helpful assistant of [your company].");Guard Railsis seeded with a single combined preset that covers hallucination prevention, jailbreak resistance, prompt-leak protection, and the stop condition. -
Custom Instructions: To add your own free-text rules, you must add the "Custom" instruction type. This will give you a text field where you can provide any specific information the AI needs, such as:
- A description of your company.
- Specific rules on how to answer certain questions.
- Logic for iterative tool use (e.g., "First, try to find the answer using the 'Internal Knowledge' tool. If the information is not present, then use the 'Web Search' tool.").
Note: While there is no character limit for custom instructions, they should be as short and concise as possible for the best performance.
4. Add and Configure Tools
This is where you give your agent its capabilities. When adding a tool, keep these critical points in mind:
- Unique Name: Each tool you add must have a unique name. You cannot have two tools with the exact same name. You can leave the default name when adding a tool, but if you add multiple tools of the same type (e.g., two
Knowledge Searchtools), you must change at least one name to be unique. - Name and Description: The AI only sees the tool's Name and Description to understand what it does. Make these as clear and descriptive as possible. For example, instead of just "Knowledge Search," use a name like "Car Insurance Knowledge" and a description like "Searches the car insurance knowledge base for terms, conditions, and prices."
- Usage Logic: The AI can use multiple tools to answer a single query. If a tool requires complex logic (e.g., "Only use the 'Discount' tool if the user is a registered customer and mentions 'coupon'") or you want to define a specific order of operations (e.g., "Always try Tool A first, and only use Tool B if Tool A finds no results"), this logic must be defined in a Custom Instruction.
You can add multiple instances of the same type of tool, as long as each has a unique name. For example:
- Tool 1 Name:
car_insurance_knowledge - Tool 2 Name:
liability_insurance_knowledge
Note: You can add as many tools as you need, but for optimal performance, we recommend keeping the number below 30.
5. Configure the Settings Popover
Click the gear icon in the module toolbar to open the settings popover. Here you can configure:
- Show/hide AI label: Enable or disable the label shown below AI answers (e.g. "AI-generated").
- AI label text and URL: Edit the label text per language. Optionally enter a URL, which turns the label into a clickable link that opens in a new tab.
- AI agent status messages: Show or hide the status messages the agent uses to signal tool calls, such as "Searching for information..." or "Calling tool...".