Approval Gates for Risky Agent Actions
My prompt told the agent to ask before deleting. It deleted the file anyway. Here is a gate in code that stopped it.
Video #24 ยท AI agents and MCP
Steps in the video
Files
- agent.py (39 lines)
- demo.py (27 lines)
- gate.py (26 lines)
- gate_checks.py (19 lines)
Tested with
Python 3.12.15 | ollama==0.6.3
What this does not show
One small local model, one request and one tool, fixed settings, one run. The person is a scripted stand-in that always says yes or always says no; real approval needs a screen, a timeout and someone who reads it. The gate decides whether a tool runs and does not check its arguments. The files are examples in a temporary folder.
Sources
Learning IT by Example.