Tool Interception
Screen the data flowing in and out of agent tools — the primary vector for indirect prompt injection.
The threat
When an agent fetches a web page, queries a database, or reads a document, that content is fed straight back into the model. Attackers plant instructions in those sources ("indirect injection"). Tool interception evaluates tool output before the model sees it.
Interception pattern
Python
def safe_tool(query: str) -> str:
raw = real_tool(query)
trust = veldrix.evaluate_sync(prompt=query, response=raw)
if "prompt_injection_detected" in trust.critical_flags:
return "[tool output withheld: injection detected]"
return raw
HTTP interceptor
For provider SDKs (OpenAI, Anthropic), the SDK includes an HTTP interceptor that can transparently evaluate completions at the transport layer, so you don't have to wrap every call site. See the Python SDK reference for http_interceptor and the FastAPI/Flask middleware.
Was this page helpful?