On November 23, Reuters reported that several large and mid-sized US banks are tightening controls on their own AI agents. The trigger: OpenAI disclosed that models in its July security tests bypassed controls meant to isolate them from the internet and reached outside systems. According to Reuters' sources, the banks are now limiting how long agents run, keeping passwords out of their reach, restricting which systems they can touch and reviewing kill switches.
The same week, Google published the design of Agent Compute Engine, its managed runtime for agents. The key idea, as Google's engineers put it, is that the orchestration harness (the brain) runs completely outside the execution sandbox (the hands). API keys and OAuth tokens never enter the sandbox. A gateway outside it authenticates each request and injects the secret.
You don't need a bank's budget or Google's cloud to copy this. Here is the pattern in under 50 lines of Python: a gateway that sits between your agent and its tools, holds the secrets, enforces limits and has a kill switch.
agent (model + prompt) never sees a key
|
v tool name + args
+-------------------------+
| GATEWAY | allowlist, per-tool limits,
| secrets live here | call and time budget,
| kill switch checked | audit log, output redaction
+-------------------------+
|
v real API call with the injected key
Stripe / DB / email
If the agent is tricked by a prompt injection, the worst it can do is ask the gateway for something. It cannot leak a key it never had.
import os, re, time
SECRETS = {"STRIPE_KEY": os.environ.get("STRIPE_KEY", "sk_test_demo_123")} # lives only here
ALLOW = {"stripe.refund": {"needs": "STRIPE_KEY", "max_amount": 50}}
LIMITS = {"max_calls": 5, "max_seconds": 30}
KILL_FILE = "KILL_AGENT" # touch this file and every agent stops on its next call
class Gateway:
def __init__(self):
self.calls, self.started, self.log = 0, time.time(), []
def run(self, tool, args):
if os.path.exists(KILL_FILE):
return self._deny(tool, "kill switch on")
if self.calls >= LIMITS["max_calls"] or time.time() - self.started > LIMITS["max_seconds"]:
return self._deny(tool, "budget spent")
rule = ALLOW.get(tool)
if not rule:
return self._deny(tool, "tool not allowed")
if args.get("amount", 0) > rule["max_amount"]:
return self._deny(tool, "amount over limit, needs a human")
self.calls += 1
secret = SECRETS[rule["needs"]] # injected here, never sent to the agent
result = fake_stripe(args, secret)
self.log.append(("ok", tool, args))
return self._redact(result)
def _deny(self, tool, why):
self.log.append(("deny", tool, why))
return {"ok": False, "error": why}
def _redact(self, result):
text = str(result)
for s in SECRETS.values():
text = text.replace(s, "[secret]")
return re.sub(r"sk_(live|test)_\w+", "[secret]", text)
def fake_stripe(args, key):
return {"ok": True, "refunded": args["amount"], "debug": f"auth={key}"}
if __name__ == "__main__":
gw = Gateway()
print(gw.run("stripe.refund", {"amount": 20}))
print(gw.run("stripe.refund", {"amount": 900}))
print(gw.run("db.drop_table", {"name": "users"}))
open(KILL_FILE, "w").close()
print(gw.run("stripe.refund", {"amount": 10}))
os.remove(KILL_FILE)
print(gw.log)
Output:
{'ok': True, 'refunded': 20, 'debug': 'auth=[secret]'}
{'ok': False, 'error': 'amount over limit, needs a human'}
{'ok': False, 'error': 'tool not allowed'}
{'ok': False, 'error': 'kill switch on'}
Secrets stay in the gateway. The agent sends stripe.refund with an amount. The gateway looks up which secret that tool needs and adds it at call time. The agent's context never contains the key, so it can't print it, paste it into a reply or send it to an attacker.
Allowlist, not blocklist. db.drop_table is denied because it is not on the list, not because someone remembered to ban it. New tools are off until a person adds them.
Per-tool limits that route to a human. Refunds up to 50 go through. A 900 refund is denied with a reason the agent can pass on: this needs a person. That is the same "limit how much work an agent can do" control the banks are adding.
A call and time budget. After five calls or 30 seconds the gateway stops answering. Runaway loops end on their own instead of at the end of the month on your bill.
A kill switch anyone can pull. Creating one file stops every agent on its next call. In production that is a feature flag or a row in a database that your on-call person can flip from their phone.
Redaction on the way back. The fake Stripe response leaks the key in a debug field, as real APIs and error messages sometimes do. The gateway scrubs known secrets and anything shaped like a key before the agent sees the result.
An audit log. Every allow and deny is recorded with the reason. When something goes wrong, you can answer "what did the agent do and why was it allowed?" in minutes.
Banks are adding these controls after the fact. If you are building an agent today, it costs about 50 lines to start with them.
At Axionry we build AI agents with this kind of gateway, limits and audit trail from day one, and we ship in weeks. If you are putting an agent near money or customer data, book a call.