Lab: Build BrightCart's answer engine end to end
18 min read·13 Oct 2026
Module 7 · Lab · About 75 minutes · Needs: lessons 1 to 6 of this module (prompts, structured output, reliability, context, cost, security)
What you are building
Six lessons built six parts of the answer engine. This lab joins them into one function, answer(ticket, key), which later modules rebuild in smaller forms. A ticket goes in; a checked Reply comes out. On the way: a versioned prompt that knows today's date, outside text marked as data, a schema with one repair, a Groq-to-Gemini fallback with a canned last resort, an idempotency cache, an output sanitiser and a cost log. You finish by running eight tickets, two of them Sam's attacks, and printing a scorecard Priya, Marta and Sam can each read.