Gate tool execution
A model can ask your program to run a tool, such as searching documents or sending an email. That request is only a proposal. The text the model read may contain instructions planted by someone else, which is called prompt injection. So the model's wish is never a reason to act. Your code decides. A simple gate asks two questions: is this tool allowed at all, and if it changes something, has the user confirmed it?
About this lesson
Words to know
- tool call
- A model's request that your program run a function for it, with a name and arguments.
- allowlist
- The list of things that are permitted. Anything not on it is refused.
- prompt injection
- Text in a document, a web page or a message that tries to give the model new instructions.
Why it matters
The second portfolio project is a support workflow whose send action must pass this gate. Asking the model to behave is not a safety measure; a check in your own code is.
With a year
How it works, a worked example, the exercise with its tests, three hints and the explained solution are in the app, with a year of Algo150 for $19. The first chapter, Model foundations, is free for everyone: start with Vector dot product.