# Tartan Tickets

> A course ticketing platform with Scotty, an LLM assistant that looks up orders, buys tickets, and issues refunds through tool calls. I built the refund capability and the guards around it: the model can ask for a refund, but it cannot decide one.

- Author: Benjamin Zhuang
- Category: AI agent safety
- Context: CMU 17-643 Quality Management · four-person team
- Years: 2026
- Stack: TypeScript, Node.js, Express, React, PostgreSQL, TypeORM, OpenAI SDK, LiteLLM, Prometheus, Grafana, Playwright, k6
- Source: https://github.com/CMU-643/17643-s26-team04 (private repository)
- Web page: https://benjaminnnnnn.github.io/portfolio/tartan-tickets/

**An assistant that can refund money needs more than a prompt.**

## Key figures

- 10 tools: the assistant can call
- 1 refund: at most per assistant turn
- $10,000: ceiling before a person takes over

## Start from a course codebase.

Tartan Tickets is the starter project for CMU's Quality Management course: a React frontend, Express services, PostgreSQL, and a Prometheus and Grafana stack. The course staff added Scotty, an assistant that calls tools through an OpenAI-compatible gateway.

Each teammate took one capability to make safe enough to launch. Mine was refunds.

## The model proposes. The service decides.

A refund passes checks the model cannot skip: a signed-in user, an explicit confirmation, valid input, ownership of the order, no earlier refund, an event that has not ended, and an amount under the ceiling. The user's identity comes from the session token on the server, never from the model's tool arguments.

The order moves to refund-pending in a guarded transaction before the payment provider is called with an idempotency key. If that call fails, a sweep every five minutes asks the provider what happened to orders stuck for ten minutes, then completes or rolls back the refund.

## What I built, and what I didn't.

Besides refunds I added the session middleware Scotty's tools rely on, Prometheus metrics, Grafana dashboards, alert rules, Playwright end-to-end tests, and k6 load tests. Teammates hardened purchasing, order lookup, and event discovery.

The platform and the first version of Scotty came from the course staff, and the repository is private.
