Example of customer support agent answering user queries based on FAQ documents
- Check LarAgent documentation 📄
- Join LarAgent Discord Community 💪
- Star LarAgent Repository ⭐
-
Clone the repository:
git clone https://github.com/RedberryProducts/faq-agent-example-laragent.git cd faq-agent-example-laragent -
Install PHP dependencies:
composer install
-
Install Node.js dependencies:
npm install
-
Create the environment file:
cp .env.example .env
-
Generate the application key:
php artisan key:generate
-
Run database migrations:
php artisan migrate
-
Seed the database with initial data:
php artisan db:seed
-
Build frontend assets:
npm run build
-
Serve the application:
php artisan serve
Disclaimer: This project is intended for demonstration purposes only. Before deploying to a production environment, it is strongly recommended to review and update the prompts, as well as perform extensive testing to ensure reliability.
- GuardAgent: Acts as a safety layer, checking user messages against defined rules (in
ChatRules) before processing. It usesgpt-4.1-miniand throws aViolationExceptionif a rule is violated. - RetrievalAgent: Analyzes user queries to identify relevant FAQ documents. It returns a list of document IDs that are most likely to contain the answer, using
gpt-4.1-miniand structured output. - SupportAgent: The primary customer support agent. It orchestrates the conversation by first using the
RetrievalAgentto fetch relevant context, then generating a response usinggpt-4.1. It maintains chat history and includes a tool to request manager contact.
Represents the knowledge base articles (FAQ documents) containing title, description, and body. These documents are indexed and retrieved by the agents to provide accurate answers to user queries.
A Livewire component that powers the chat interface. It manages the chat state, handles user input, and coordinates with the agents. It validates messages using the GuardAgent and generates responses via the SupportAgent, while also handling UI elements like typing indicators and error notifications.