Stage 2 · Lesson 4 of 7
The agent loop as an attack surface
An runs a loop: the model reads the context, asks for a tool call, your code runs it, the result goes back into the context, and the loop repeats until the task is done. Each turn of the loop is a new chance for untrusted text to enter, because tool results, such as a fetched web page or a file listing, are read as context.
Without tools, a fooled model can only say something wrong. With tools, it can do something wrong, with whatever permissions those tools hold, and later steps can build on an earlier mistake. Loops can also run away, burning money or hammering an .
The Model Context Protocol () makes adding tools easy, which is why stage five is all about it.
Common trapreviewing the first prompt carefully and never looking at what enters on step seven.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Prompt Engineering for Software Engineers
Design Gurus · Beginner · Subscription
How system prompts, context and structured output really work, the ground every LLM risk stands on
- CourseFreeHugging Face Learn
Hugging Face · Intermediate
Free courses on how language models, embeddings and agents work, at an engineer's level