Untrusted tool output: when an agent believes what a web page or API says
Agents read tool results such as web pages, search hits, and API responses, and those results can contain instructions or false data. How to label tool output, constrain follow-up actions, and validate results.
Diagram
A tool result steering the next step
Step 1 of 4
Tool call
The agent fetches a vendor status page.
fetch_url("https://status.vendor.example/incident")The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Chained actions
- What fails
- A tool result leads directly to another tool call.
- Who is affected
- Systems the second tool can change.
- What you would notice
- Write actions taken right after reading external content.
- What you change
- Require confirmation when external content precedes a write.
Wrong data
- What fails
- APIs and search results can simply be false.
- Who is affected
- Decisions made from the answer.
- What you would notice
- Answers that cite one source for a critical claim.
- What you change
- Validate structured results and show sources.
Testing with a staged page
Host a page in your lab with visible content and a hidden harmless canary instruction. Ask the agent to summarize it. If the canary shows up, hidden content reaches the model and you should strip or label it.
Check yourself
Recognition and the fix. Nothing here is a procedure.
A summary includes a link that is only in hidden markup. What is the fix?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.
This page stands on its own. The lab and the glossary card are the next reading.