Skip to main content
Glama
nextrole-git

support-triage-agent

by nextrole-git

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

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.

Related MCP server: OTRS MCP Server

Local Setup

cp .env.example .env
docker compose up --build

In another terminal, pull the local model:

docker compose exec ollama ollama pull mistral

Run migrations:

docker compose exec api alembic upgrade head

Try the API:

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:

curl -X POST http://localhost:8000/tickets/TICKET_ID/triage

MCP Server

Local container:

docker compose up mcp

The MCP service is designed to run over HTTP in Azure Container Apps:

python -m app.mcp_server.main

Tools exposed:

  • create_ticket

  • list_tickets

  • get_ticket

  • triage_ticket

  • update_ticket_status

Tests

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.

Related MCP Connectors

Related MCP Servers