The Sunday Letter
The Sunday Letter · No. 15 · Agents

Put the rule in the tool, not the prompt

“Never run a write query” is a request. A tool that rejects write queries is a rule. If breaking it would cost you, enforce it where the model can’t talk its way past.

The 60-second version
  • An instruction in a prompt is a request. The model usually follows it, and that is not the same as always.
  • A check in the tool holds whatever the model decides, including when a prompt injection changes its mind.
  • Amazon’s planning teams built this: query tools that accept only SELECT and reject writes before they reach the data lake.
  • Put access control in one shared layer, so every agent gets it without each one being trusted to get it right.
  • Keep the prompt for judgement. Put anything that must never happen in code.

Most agent safety lives in the system prompt. Never delete records. Only read from these tables. Always ask before sending. It reads like a policy, and most of the time the model follows it.

Most of the time is the problem. A prompt is a request, and a tool is a rule. If breaking the instruction would cost you a table, a customer or a weekend, it shouldn't depend on what the model decides to do on that particular run.

What a rule looks like

AWS described a useful example this week. Planning teams at Amazon's North America Sort Centers wanted agents to query their data lake, so the team built one MCP server between the agents and the data. Its Athena tools accept only SELECT queries and reject write operations at the tool level, before they reach the data lake.

Notice what that does. The model can be confused, or misled by text hidden in a document, or simply wrong. It can write a DELETE. The DELETE still goes nowhere.

Don't ask the model to respect a limit you can enforce yourself.

One gate, not one per agent

The second choice in that design matters just as much. Access control sits in the server, not in each agent. Any MCP client can connect, and all of them get the same limits. Every tool call is logged in one place, so security teams have a single point to audit.

If each agent carries its own rules, the next agent someone builds is the one that forgets them. A shared gate means a new agent starts with the limits already in place.

What the prompt is still for

This doesn't make prompts useless. They are the right place for judgement: how to phrase a reply, when a question is ambiguous, which of two reasonable options fits. Those are things you can't write as a check. The test is simple. If a failure would merely be disappointing, a prompt is fine. If it would be expensive, write code.

What to do this week

Read your agent's system prompt and underline every "never", "always" and "only". For each one, ask whether a tool could enforce it: a read-only database role, an allowlist of recipients, a spending limit in the payment call. Move the most expensive one into code this week, then test it by asking the agent to break it.

Architecture as described by AWS.

Get the next letter.

A new essay arrives every Sunday.