How LLMs and agents work
Tokens, prompts, RAG, tools and agents. Build a small assistant, so you know what you will secure.
How to use the lab files
The zip keeps the files of each lesson apart, and the lessons work in one flat folder. After you unzip it, sh kr-lab.sh LESSON FOLDER builds that folder as it stands after a lesson, for example sh kr-lab.sh 00-set-up-your-lab ~/krlab/llms-and-agents.
You will build
You need
A computer with Linux, macOS, or Windows with WSL. No GPU, no cloud account and no paid tool.
Next course
- 00Set up your lab for How LLMs and agents workCreate the lab folder of the courseSet-up15 min
- 01Build a model that predicts the next wordCount which token follows which in a text and use the counts as a modelBuild35 min
- 02Count tokens and test the limit of a context windowSplit text into tokens and learn sub-word pieces with a small tokenizer35 min
- 03Run a language model on your own machineInstall Ollama the careful way and pull a small model that runs on a CPU40 min
- 04Write prompts with roles, examples and JSON outputExplain that system, user and assistant messages become one long text45 min
- 05Measure how often a model invents factsWrite a quiz with known answers and score a model as right, wrong or "does not know"45 min
- 06Give a model your own documents with retrievalBuild a search over six documents with TF-IDF and cosine similarity50 min
- 07Let a model use tools, and check every requestExplain that a model only writes a request and your program runs the tool50 min
- 08Build an agent loop and read an MCP messageBuild a loop that lets a model use tools for several steps, with a step limit and a traceBuild55 min
- 09Compute attention and shrink a model's weightsCompute the attention weights of a short text and say which token gets the weight60 min
- 10Build the KR Books assistantCombine retrieval, a checked tool, a step limit and a trace in one programBuild55 min
- 11Review a shop assistant before it goes liveFind what a retrieval step puts into the prompt, including text that should not be thereTest90 min
Work roles
Work roles this course supports
The course helps you to prepare for these roles of the NICE Workforce Framework for Cybersecurity (NIST SP 800-181 Rev. 1). No single course covers a whole role, and KaliRange is not a certification body.
- Secure Software Development
DD-WRL-003a supporting skillYou build a small assistant with retrieval and checked tools, and see its weak points.