CourseAI Engineering: The Complete Course · Module 1: Programming Foundations · part 14 of 105
Part 14 · Module 1: Programming Foundations

Lab: Build the BrightCart API client

16 min read·13 Oct 2026
Module 1 · Lab · About 60 minutes · Needs: lessons 1, 3, 4 and 5 (exceptions, the project folder and tests, Git, timeouts and retries)

What you are building

THE FINISHED PIECE: ONE TICKET THROUGH THE PROJECT ticket 7120 Priya's refund answer.py prompt, fallback client.py retry, timeout orders llm.py key from .env hosted model one call tests/ 9 pass, no key log.py: one JSON line per event .env stays outside git, v0.1.0
What the lab ends with. Blue is your code; the order system and the hosted model (amber: uncertain) sit outside it. Tests (green) run everything but the model; grey parts are the logs and the repository.

Module 1's piece of BrightCart is an API client that retries, times out and keeps keys secret. The lessons built each part in a notebook cell: the retry decorator in lesson 1, the brightcart/ folder and JSON logs in lesson 3, the Git habit in lesson 4, OrderClient with backoff and jitter in lesson 5. This lab puts them in one small project that another person can clone, install and test. One ticket runs through it at the end: Priya's "Please refund order 7120, the bulbs are the wrong fitting." The assistant looks the order up through the client, survives one failure of the order system on the way, and answers with the hosted model. Every file is tested without a model before the model is called once.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.