An autonomous AI assistant that doesn't just chat β it actually creates, tracks, and updates support tickets in a real database.
Most AI chatbots just talk. This one acts.
Meet Liza β an AI help desk assistant built with Spring AI's Tool Calling feature. When a user reports an issue, Liza doesn't just respond with a canned message. She:
- π Checks the database for existing tickets using the user's email
- π« Creates a real ticket in MySQL with auto-generated ID, priority, and status
- βοΈ Updates existing tickets when users provide additional details
- π§ Remembers the entire conversation across sessions (persistent JDBC memory)
The key difference? Every ticket ID Liza mentions is real β pulled from the database, not hallucinated.
flowchart LR
Client["π₯οΈ Client"] -->|POST /api/v1/ai| API["AiController"]
API --> ChatClient["ChatClient + Memory Advisor"]
ChatClient <-->|Inference| LLM["βοΈ Groq LLM"]
LLM -->|"Tool Call"| Tools["π§ TicketDatabaseTool"]
Tools --> DB[("ποΈ MySQL")]
ChatClient <-->|"Chat History"| DB
|
Liza collects issue details step-by-step, asks clarifying questions, determines priority, and only creates a ticket when she has everything she needs. The LLM doesn't fake it β it invokes actual Java methods annotated with Conversations survive server restarts. Backed by MySQL via |
Real-time Server-Sent Events (SSE) for a live typing experience on the frontend via Ticket IDs come from MySQL's CORS enabled, |
| Tool | What It Does |
|---|---|
createTicketTool |
Saves a new ticket (summary, description, category, priority, email) to MySQL |
getTicketsByEmail |
Looks up all existing tickets for a user β prevents duplicates |
updateTicket |
Appends notes, changes status/priority on an existing ticket |
getCurrentTime |
Returns current system timestamp when the LLM needs it |
Each tool accepts a lightweight Java record (not the raw JPA entity) to avoid deserialization crashes with dates and enums.
- JDK 25+
- MySQL 8.0+ running on
localhost:3306 - A Groq API Key (free at console.groq.com)
git clone https://github.com/Sagar-devx/help-desk-system.git
cd help-desk-system/help-desk-backend# PowerShell
$env:OPENAI_API_KEY="gsk_your_groq_api_key_here"
# Bash / Zsh
export OPENAI_API_KEY="gsk_your_groq_api_key_here"# Windows
.\mvnw.cmd spring-boot:run
# macOS / Linux
./mvnw spring-boot:runApp starts on
http://localhost:8081. MySQL database & tables are auto-created.
curl -X POST http://localhost:8081/api/v1/ai \
-H "Content-Type: text/plain" \
-H "ConversationId: session-001" \
-d "My laptop keeps crashing. Email: sagar@test.com"curl -X POST http://localhost:8081/api/v1/ai/stream \
-H "Content-Type: text/plain" \
-H "Accept: text/event-stream" \
-H "ConversationId: session-001" \
-d "Do I have any open tickets? My email is sagar@test.com"| Endpoint | Method | Content-Type | Description |
|---|---|---|---|
/api/v1/ai |
POST |
text/plain |
Full response after tool execution |
/api/v1/ai/stream |
POST |
text/event-stream |
Token-by-token live streaming |
ConversationIdheader is optional β defaults to"default".
Two tables, both auto-managed:
help_desk_tickets β User support tickets
| Column | Type | Notes |
|---|---|---|
id |
BIGINT |
Auto-increment PK |
summary |
LONGTEXT |
AI-generated issue title |
description |
TEXT |
Detailed issue + appended updates |
category |
VARCHAR |
Hardware / Software / Technical / Account |
email |
VARCHAR |
User's contact email |
priority |
ENUM |
LOW Β· MEDIUM Β· HIGH Β· URGENT |
status |
ENUM |
OPEN Β· CLOSED Β· RESOLVED |
created_on |
DATETIME |
Set automatically on insert |
updated_on |
DATETIME |
Set automatically on update |
spring_ai_chat_memory β Persistent conversation history (auto-created by Spring AI)
help-desk-system/
βββ README.md
βββ help-desk-backend/
βββ pom.xml
βββ src/main/
βββ java/com/helpdesk/
β βββ config/ β AiConfig (ChatClient + Memory)
β βββ controller/ β AiController (REST + SSE)
β βββ entity/ β Ticket, Priority, Status
β βββ repository/ β TicketRepository (JPA)
β βββ service/ β AiService, TicketService
β βββ tools/ β TicketDatabaseTool (@Tool + Records)
βββ resources/
βββ application.yaml
βββ helpdesk-system.st β AI persona & behavior rules
User: "My Wi-Fi keeps dropping. Email: john@test.com"
β
βΌ
βββββββββββββββββββββββββ
β System Prompt β β helpdesk-system.st
β (Liza's persona) β
ββββββββββββ¬βββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β LLM decides to call β
β getTicketsByEmail() β β Checks for existing tickets
ββββββββββββ¬βββββββββββββ
β No open tickets found
βΌ
βββββββββββββββββββββββββ
β LLM calls β
β createTicketTool() β β Saves to MySQL
ββββββββββββ¬βββββββββββββ
β Returns: { id: 42, status: OPEN, ... }
βΌ
βββββββββββββββββββββββββ
β Liza responds with β
β real Ticket ID: 42 β β No hallucination
βββββββββββββββββββββββββ
| Technology | Version | Role | |
|---|---|---|---|
| β | Java | 25 | Language |
| π | Spring Boot | 4.1.2 | Application Framework |
| π€ | Spring AI | 2.0.1 | ChatClient, Tool Calling, Memory |
| ποΈ | MySQL | 8.0+ | Tickets + Chat History |
| βοΈ | Groq | β | LLM Inference (Qwen) |
| β‘ | Project Reactor | β | Reactive Streaming (Flux) |
| π§ | Lombok | β | Boilerplate Reduction |
Sagar Β· @Sagar-devx
Built with β Java, π Spring, and a lot of curiosity.