A housing agent previously used unconstrained fetch_url for policy PDFs. What safer tool design validates civic document sources?
Select an answer to reveal the explanation.
Short Explanation
Open-ended fetch_url is a wild west for housing PDFs. Swap in load_document that only accepts validated municipal URLs.
Full Explanation
A housing agent that previously used unconstrained fetch_url for policy PDFs should replace fetch_url with load_document that validates municipal document URLs before retrieval. Constrained loaders reduce unsafe or irrelevant fetches by allowing only approved civic document hosts and schemes, protecting policy interpretation from random internet content.
URL validation works because housing policy must come from authoritative municipal sources. A dedicated load_document tool encodes allowlists, content-type checks, and size limits in the tool boundary—stronger than hoping the model picks safe URLs with an open fetch.
Keeping fetch_url and allowing any internet URL without checks exposes the agent to untrusted PDFs and prompt-injection via documents. Blocking all document loading including approved municipal hosts removes legitimate policy access the housing agent needs. Pasting PDF bytes into the system prompt with no retrieval tool bloats context, skips freshness, and does not scale across policy libraries.
Exam caveat: validation should fail closed with a structured non-retryable or permission-style error for disallowed URLs. Operational check: attempt load_document on an approved municipal policy URL (success) and on an arbitrary external URL (rejected), confirming fetch_url is no longer exposed.