support-triage-agent
by nextrole-git
README.md
# Support Triage Agent
A Python project that shows how to build and deploy a small AI-enabled backend:
- FastAPI REST API
- PostgreSQL persistence with SQLAlchemy and Alembic
- Mistral-compatible agent through Ollama
- MCP server that can run locally or in Azure
- JSON logging with request IDs
- Unit and API tests
- Docker Compose for local development
- Azure Container Apps deployment guide
## Architecture
```text
Client / frontend / test tool
|
v
FastAPI API container ----+
|
MCP HTTP container --------+---- PostgreSQL
|
+---- Ollama / Mistral-compatible model endpoint
```
The REST API and MCP server share the same service layer. That keeps the cloud deployment realistic while avoiding duplicated business logic.
## Local Setup
```bash
cp .env.example .env
docker compose up --build
```
In another terminal, pull the local model:
```bash
docker compose exec ollama ollama pull mistral
```
Run migrations:
```bash
docker compose exec api alembic upgrade head
```
Try the API:
```bash
curl -X POST http://localhost:8000/tickets \
-H "Content-Type: application/json" \
-d '{"customer_email":"user@example.com","subject":"Cannot log in","body":"I reset my password but still cannot access my account."}'
```
Triaging a ticket calls Ollama:
```bash
curl -X POST http://localhost:8000/tickets/TICKET_ID/triage
```
## MCP Server
Local container:
```bash
docker compose up mcp
```
The MCP service is designed to run over HTTP in Azure Container Apps:
```bash
python -m app.mcp_server.main
```
Tools exposed:
- `create_ticket`
- `list_tickets`
- `get_ticket`
- `triage_ticket`
- `update_ticket_status`
## Tests
```bash
python -m pip install -e ".[dev]"
pytest
ruff check .
```
Tests use SQLite in-memory databases so they do not require PostgreSQL.
## Deployment
See `deploy/azure/README.md` for the Azure Container Apps flow. The recommended cloud shape is:
- one Container App for the REST API
- one Container App for MCP over HTTP
- Azure Database for PostgreSQL Flexible Server
- Azure Container Registry
- Container App secrets or Key Vault references
Never commit a real `.env` file. Commit `.env.example` only.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessSyncing