CourseLarge Language Models: The Complete Course · Module 7: Context Engineering · part 52 of 103
Part 52 · Module 7: Context Engineering

Lab: Retrieval, a budgeted context and memory

48 min read·13 Oct 2026
Module 7 · Lab · About 75 minutes · Needs: lessons 1 to 4 of this module, and the Module 1, 2 and 6 labs (or the cells in Step 1)

What you are building

SUPPORTDESK/ AFTER MODULE 7 kb_search.py KBSearch, search tool context.py builder, report memory.py store, recall, controls draft_context() hosted model tests/ 9 tests, no key imports data.py, llm.py, baseline.py (M1), tokens.py (M2), tools.py (M6)
Three new files (blue) meet in `draft_context`, the only door to the model (amber); keyless tests (green) and earlier modules' files (grey) frame them.

It is Friday 17 July 2026, the end of week 7. This week's retrieval, token budgets and memory live in notebook cells; this lab moves them into three files that Module 8's agent will import. supportdesk/kb_search.py holds KBSearch and a search_help_centre tool with Module 6's fixed name and contract, now backed by real retrieval. supportdesk/context.py holds the builder, its report, the history policy and one function that assembles a draft request. supportdesk/memory.py holds the store with slots, provenance, scope and the customer's controls. You finish by drafting Ana Duarte's T-1041 from all three. Two cells call the hosted model.

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.