Retrieval and Boundaries for Agent Runs
Lesson 4 of 4
A Gate Between Reading and Acting
Estimated time: 10 minutes
A Gate Between Reading and Acting
An agent that reads untrusted content and then acts on it needs a check in between, or a hostile input becomes a hostile action.
Gate on the way in and the way out
Classify content before it can steer a tool call, and again before output leaves. The inbound gate protects actions; the outbound gate protects readers.
def decide(verdict):
if verdict == "unsafe":
return "block"
if verdict == "unclear":
return "flag"
return "allow"
Record the decision
Whenever a gate stops work, record the decision and the reason so a reviewer can see why the agent halted. For an ambiguous input, abstain or escalate rather than guessing in either direction.