Foundations · Python and API Fundamentals
Ticket Triage Lab
Support Classification
Build a support ticket classifier from scratch. Start with rule-based routing, then integrate a real AI model, measure accuracy on labeled examples, and understand where your Python code ends and the API boundary begins. Ten lessons, eight to twelve study sessions.
Status: Guided Tutorial
A ten-lesson interactive tutorial covering Python setup, JSON parsing, Pydantic validation, rule-based classification, API integration with OpenAI, and evaluation metrics. Includes starter code, tests, and a complete reference implementation. Designed as your first experience building a Python program that calls an external API.
The problem
Support teams face inconsistent ticket routing:
- •Tickets arrive without a category, slowing triage
- •Manual classification is slow; automation needs to be reliable
- •It's unclear when to use simple rules versus when to call an expensive API
- •How do you measure whether your classifier actually works?
How it works
Read a ticket from JSON. Validate its structure with Pydantic. Route it through one of two classifiers: a rule-based keyword matcher that's fast and free, or an OpenAI API call that's accurate and costs money. Log the prediction with timing and token usage. Then compare both against human labels to see which approach matches reality better.
What you'll build
Ten lessons, each with clear learning objectives and hands-on code:
Key learnings
This project teaches the engineering fundamentals needed to build any AI application:
Python fundamentals
Variables, functions, loops, conditionals, file I/O, and modules.
Data validation
Pydantic schemas enforce structure at boundaries, not just at parse time.
Rules vs. AI
Compare simple keyword matching against a real model on dev and holdout examples.
API integration
Send structured requests, handle responses, understand token costs and latency.
Evaluation design
Labeled examples, dev/holdout splits, accuracy metrics, error analysis.
Error recovery
Missing files, JSON errors, validation failures, API timeouts, and retries.
Why this project
Most AI tutorials skip the fundamentals. They assume you already know Python, or they gloss over the difference between a local script and an API call. This project starts from zero: installing Python, writing your first file, understanding JSON, building a schema, then gradually introducing complexity until you have a complete classifier you can run live.
By the end, you'll understand the real work: defining what success means (evaluation), building something simple that works (rules), knowing when to add complexity (the model call), and measuring whether it helped (accuracy on labeled data).
Your tech stack
Ready to build?
Clone the starter template, follow the ten lessons step by step, and have a working support classifier running on your machine within a few study sessions.