2026-05-31 18:22:03 +08:00
# AgentDesk
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
English | [简体中文 ](README_ZH.md )
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
An open-source AI Agent customer support system with knowledge-based answers, human handoff, ticket workflows, and self-hosted deployment.
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
> Built for teams that need online support, knowledge-base Q&A, human collaboration, and service tracking in one system. It is not just an LLM inside a chat box; it is an AI Helpdesk foundation designed around real support operations.
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
## Product Preview
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
Customer chat, agent workspace, knowledge base, model configuration, and AI Agent orchestration are managed in one system.
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
### Customer Chat
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00

2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
Customers can start a conversation from the web chat page. The AI Agent responds first with knowledge-grounded answers. When the user explicitly asks for a human, the system can start a handoff confirmation flow.
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
### Agent Workspace
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00

2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
The support workspace includes conversation lists, message handling, AI-to-human handoff, agent replies, conversation tags, linked customers, and ticket context for daily support work.
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
### Knowledge Base and AI Agent Configuration
| Knowledge Base FAQ | AI Agent Configuration |
2026-05-30 22:34:23 +08:00
| --- | --- |
2026-05-30 22:50:42 +08:00
|  |  |
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
The knowledge base stores FAQs, documents, and retrievable content. AI Agents can be bound to model configurations, knowledge bases, Skills, and tools to create support agents for specific scenarios.
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
### Model Configuration
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00

2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
Model configuration supports OpenAI-compatible providers. You can configure LLMs, embedding models, rerank models, context limits, output settings, timeout, retry behavior, and enablement state.
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
## Why Use It
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
- **AI-first support**: Let AI Agents handle common questions, standard procedures, and knowledge-base answers first.
- **Knowledge-constrained replies**: Use RAG and the Answerability Gate to decide whether retrieved knowledge is strong enough to answer, reducing unsupported responses.
- **Natural human handoff**: Move to human agents when knowledge is insufficient, the user asks for help, or a workflow requires human confirmation.
- **Conversation-to-ticket loop**: Online chat, support handling, ticket creation, status flow, and progress records stay in one system.
- **Built for extension**: The backend uses Go, the frontend uses Next.js, and the runtime supports Skills, MCP, and OpenAI-compatible model access.
- **Self-host friendly**: Supports SQLite / MySQL and Qdrant for local trials, intranet deployment, and enterprise self-hosting.
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
## Core Capabilities
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
- **AI Agent support**: AI replies first, with fallback, confirmation, tool calling, and human collaboration.
- **Online conversation system**: Visitor sessions, message send/receive, unread status, assignment, transfer, and close flows.
- **Agent workspace**: Agents can take over conversations, reply to users, transfer teammates, link customers, and create tickets.
- **Knowledge-base RAG**: Knowledge bases, documents, FAQs, chunking, vector retrieval, retrieval logs, and quality analysis.
- **Answerability Gate**: Checks whether retrieved content can support an answer; otherwise returns a fallback and recommends human support.
- **Ticket system**: Create tickets from conversations, categorize, assign, move through status flows, record progress, and close the loop.
- **Support organization management**: Agent profiles, teams, schedules, and automatic assignment.
- **AI extensibility**: Skills, MCP debugging, and external tool integration.
- **Multiple entry points**: Admin dashboard, agent workspace, customer-facing web pages, and embeddable SDK.
2026-04-15 17:04:12 +08:00
2026-05-30 22:50:42 +08:00
## Use Cases
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
- Website live support
- SaaS product support
- AI + human hybrid support
- Internal enterprise service desk
- After-sales service, incident reporting, complaints, and operations support
- Support teams that need knowledge-base Q&A with human collaboration
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
## Quick Start
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
The fastest way to try the full stack is Docker Compose:
2026-04-09 10:01:23 +08:00
2026-05-30 22:34:23 +08:00
```bash
docker compose up -d --build
2026-04-09 10:01:23 +08:00
```
2026-05-31 16:16:53 +08:00
For the full English setup guide, see [Docker Compose Quick Start ](https://aiagent.huabei.pro/docs/getting-started/docker-compose.html ).
2026-05-30 22:55:09 +08:00
2026-05-31 16:16:53 +08:00
To embed customer support on your website, see [Web Widget Integration ](https://aiagent.huabei.pro/docs/integration/web-widget.html ).
2026-05-31 08:54:48 +08:00
2026-05-31 16:16:53 +08:00
To connect OpenAI-compatible model providers, see [Model Provider Configuration ](https://aiagent.huabei.pro/docs/config/model-provider.html ).
2026-05-31 09:45:28 +08:00
2026-05-30 22:50:42 +08:00
Compose starts:
2026-04-09 10:01:23 +08:00
2026-05-31 18:34:08 +08:00
- `agent-desk` : application service on port `8083`
2026-05-30 22:50:42 +08:00
- `mysql` : MySQL 8.4 with the `mysql-data` volume
- `qdrant` : vector database with the `qdrant-data` volume, ports `6333` / `6334`
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
After startup, open:
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
- Admin dashboard: `http://localhost:8083/dashboard`
- Agent workspace: `http://localhost:8083/dashboard/conversations`
- Customer web integration demo: `http://localhost:8083/support/demo`
- Customer chat page: `http://localhost:8083/support/chat`
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
Default administrator account:
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
- Username: `admin`
- Password: `ChangeMe123!`
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
> Before exposing the system to the public internet or a team environment, change the default administrator password and configure independent authentication, session, and model secrets.
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
## Local Development
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
### Requirements
2026-04-09 10:01:23 +08:00
- Go `1.26+`
- Node.js `20+`
- `pnpm`
- Qdrant
2026-05-30 22:50:42 +08:00
### Prepare Configuration
2026-04-09 10:01:23 +08:00
```bash
cp config/config.example.yaml config/config.yaml
```
2026-05-30 22:50:42 +08:00
The default configuration uses:
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
- SQLite: `data/app.db`
- Backend: `http://127.0.0.1:8083`
- Qdrant gRPC: `127.0.0.1:6334`
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
If Qdrant is not running locally, start it with Docker:
2026-04-09 10:01:23 +08:00
```bash
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
```
2026-05-30 22:50:42 +08:00
Install frontend dependencies:
2026-04-09 10:01:23 +08:00
```bash
cd web
pnpm install
cd ..
```
2026-05-30 22:50:42 +08:00
Start backend and frontend development servers together:
2026-04-09 10:01:23 +08:00
```bash
2026-05-23 22:44:06 +08:00
make dev
2026-04-09 10:01:23 +08:00
```
2026-05-30 22:50:42 +08:00
Or start them separately:
2026-04-09 10:01:23 +08:00
```bash
2026-05-23 22:44:06 +08:00
make run-go
make web-dev
2026-04-09 10:01:23 +08:00
```
2026-05-30 22:50:42 +08:00
Default development URLs:
2026-04-26 19:59:29 +08:00
2026-05-30 22:50:42 +08:00
- Admin dashboard: `http://localhost:3000/dashboard`
- Agent workspace: `http://localhost:3000/dashboard/conversations`
- Customer web integration demo: `http://localhost:3000/support/demo`
- Customer chat page: `http://localhost:3000/support/chat`
2026-04-26 19:59:29 +08:00
2026-05-30 22:50:42 +08:00
## Tech Stack
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
- Backend: Golang + Gin + GORM + `github.com/mlogclub/simple`
- Frontend: Next.js 16 + React 19 + shadcn/ui + Tailwind CSS
- Database: SQLite / MySQL
- Vector DB: Qdrant
- AI: OpenAI-compatible LLM / Embedding + RAG + Skills + MCP
2026-05-30 22:34:23 +08:00
2026-05-30 22:50:42 +08:00
## Project Structure
2026-05-30 22:34:23 +08:00
```text
.
├── cmd/ # server / migration / generator / testdata
├── internal/
2026-05-30 22:50:42 +08:00
│ ├── bootstrap/ # startup, routes, database, and migration initialization
│ ├── builders/ # model / aggregate result to response DTO mapping
2026-05-30 22:34:23 +08:00
│ ├── handlers/ # dashboard / api / third HTTP handlers
│ ├── middleware/ # Gin middleware
2026-05-30 22:50:42 +08:00
│ ├── migration/ # idempotent data migrations
2026-05-30 22:34:23 +08:00
│ ├── models/ # GORM models
2026-05-30 22:50:42 +08:00
│ ├── repositories/ # data access layer
│ ├── services/ # business orchestration and transaction boundaries
2026-05-30 22:34:23 +08:00
│ ├── ai/ # LLM / RAG / Runtime / Skills / MCP
2026-05-30 22:50:42 +08:00
│ └── pkg/ # config / dto / enums / httpx / utils and shared packages
├── web/ # Next.js frontend project
│ ├── app/dashboard/ # admin dashboard and agent workspace
│ ├── app/support/ # customer integration and chat pages
│ ├── components/ # React components
│ ├── lib/ # API client, SDK source, and utilities
│ └── public/sdk/ # built embeddable SDK
├── config/ # configuration files
├── docker/ # Docker configuration
└── docs/ # documentation site
2026-05-30 22:34:23 +08:00
```
2026-04-26 19:59:29 +08:00
2026-05-30 22:50:42 +08:00
## Common Commands
2026-04-09 10:01:23 +08:00
```bash
2026-05-30 22:50:42 +08:00
make dev # start backend and frontend development servers
make run # build the frontend SPA, then start the backend
make run-go # start the backend and ensure the SPA has been built
make web-dev # start the frontend development server
make build # build the frontend SPA and current-platform Go binary
make build-linux # build the linux/amd64 binary
make release # build common release binaries
make web-build-spa # build the web static SPA and embeddable SDK
make test # run Go tests after ensuring the SPA is built
make check # run Go tests, frontend typecheck, and lint
make generator # run code generation
make enums # generate frontend enums
make migration # run migrations
make testdata # initialize demo/test data
2026-04-09 10:01:23 +08:00
```
2026-05-30 22:50:42 +08:00
## AI Agent Workflow
2026-05-23 22:50:07 +08:00
2026-05-30 22:34:23 +08:00
```mermaid
flowchart TD
2026-05-30 22:50:42 +08:00
A[User starts a support request<br/>Web support entry / Open API] --> B[Create or match a conversation]
B --> C[Customer sends a message]
C --> D[Trigger AI Reply Runtime]
D --> E[Load conversation history / AI configuration]
E --> F[Retrieve from bound knowledge bases]
F --> G{Are retrieved chunks enough to answer?}
G -- No --> Z[Return knowledge fallback<br/>and recommend human support]
G -- Yes --> H[Prepare Skills / MCP Tools]
H --> I[Pass trusted knowledge context to the Agent]
I --> J{Direct reply?}
J -- Yes --> K[LLM generates a knowledge-grounded reply]
J -- No --> N{Call Graph / MCP Tool?}
N -- Yes --> O[Run Skill / Graph / MCP Tool]
O --> P{Need user confirmation?}
P -- No --> I
P -- Yes --> Q[Ask the user to confirm]
Q --> R{Confirmation result}
R -- Confirm handoff --> S[Move conversation to human handoff pool]
S --> T[Automatic or manual assignment]
T --> U[Agent workspace takeover]
U --> V{Need ticket tracking?}
V -- Yes --> W[Create or link a ticket]
V -- No --> X[Human agent continues handling]
2026-05-30 22:34:23 +08:00
W --> X
2026-05-30 22:50:42 +08:00
X --> Y[Resolve and close]
R -- Confirm ticket --> AA[Create a ticket from the current conversation]
2026-05-30 22:34:23 +08:00
AA --> I
2026-05-30 22:50:42 +08:00
R -- Cancel --> K
N -- No --> K
2026-05-23 22:50:07 +08:00
```
2026-05-30 22:50:42 +08:00
## Support Loop
2026-05-23 22:53:33 +08:00
2026-05-30 22:34:23 +08:00
```mermaid
flowchart LR
2026-05-30 22:50:42 +08:00
A[Customer request] --> B[AI Agent handles first]
B --> C{Can the knowledge base answer?}
C -- Yes --> D[AI replies with trusted knowledge]
C -- No --> E[Fallback / recommend human support]
D --> F{Need a human?}
E --> G[Human takeover]
F -- No --> H[Conversation ends or data is retained]
F -- Yes --> G
G --> I[Agent workspace handles the case]
I --> J{Need follow-up tracking?}
J -- Yes --> K[Create / link a ticket]
J -- No --> L[Resolve directly]
K --> M[Ticket status flow and progress records]
M --> N[Complete]
2026-05-30 22:34:23 +08:00
L --> N
```
2026-05-23 22:53:33 +08:00
2026-05-30 22:50:42 +08:00
## Docker Image
2026-05-23 22:53:33 +08:00
2026-05-30 22:50:42 +08:00
If you only need to build the application image, prepare MySQL and Qdrant yourself and mount a configuration file:
2026-05-23 22:50:07 +08:00
```bash
2026-05-31 18:27:12 +08:00
docker build -t mlogclub/agent-desk .
2026-05-23 22:50:07 +08:00
docker run --rm -p 8083:8083 \
2026-05-31 18:34:08 +08:00
-v $( pwd ) /docker/agent-desk.yaml:/app/config/config.yaml:ro \
-v agent-desk-data:/app/data \
2026-05-31 18:27:12 +08:00
mlogclub/agent-desk
2026-05-23 22:50:07 +08:00
```
2026-05-31 18:34:08 +08:00
Compose uses [docker/agent-desk.yaml ](docker/agent-desk.yaml ) as the in-container configuration. The application reaches `mysql` and `qdrant` through Docker service names.
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
## Open-source Positioning
2026-04-09 10:01:23 +08:00
2026-05-31 18:22:03 +08:00
`AgentDesk` is useful as an open-source foundation for:
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
- AI customer support systems
- AI Helpdesk / AI Support Platform projects
- RAG answerability + human handoff implementation references
- Enterprise AI Agent application frameworks
2026-04-09 10:01:23 +08:00
2026-05-30 22:50:42 +08:00
If you are looking for a customer support system centered on AI Agents rather than a simple LLM chat box, this project is designed for that purpose.