Pre-launch · Training and the free Foundations exam are open now. Levels 1–5 open soon. Get notified on any level page.
20 min read
Giving a model tools turns it from a writer into an actor. It can query systems, send messages, move money, and change records. Capability is not permission. This module covers how to choose and scope tools, how to keep enforcement outside the model, and how to put a person in front of any action that matters before it happens.
Give the narrowest tool that does the job. A general shell or database console lets a model do anything its credentials allow, including things a hostile document talks it into. Replace broad access with named operations: lookup_invoice(id), draft_email(to, subject, body), issue_credit(invoice_id, amount). Run them in a sandbox with task-scoped credentials and no network access they don't need.
Enforce outside the model. The application checks every tool call: Is the caller permitted? Are the arguments valid types, in range, and on an allowlist? Does the action comply with current policy? A model instruction saying "never credit more than $500" is guidance. A check in the issue_credit function that rejects amounts over $500 is enforcement.
Validate structure and meaning. Tool outputs and model-produced arguments need schema checks (right fields, right types) and semantic checks (does this invoice exist, does this amount match the dispute). On failure, recover safely: retry once with the error, then stop and hand off. Never let the model invent a repair.
Bound the loop. Set a call budget, a retry limit per tool, and stop conditions: denied permission, budget exhausted, unresolved state. Record state durably so a crash doesn't lose progress or repeat steps.
Make side effects idempotent. Every consequential call uses a stable request ID. After a timeout, check whether the action completed before retrying, so one credit doesn't become two.
A person confirms consequential actions. Before sending an external message, spending money, or changing a record that matters, show a person the exact action: recipient, content, amount. If the recipient is missing or ambiguous, the agent asks. It doesn't pick the most likely address from a thread.
Use a calculator for numbers. Arithmetic goes to a deterministic tool with explicit inputs, and the result is checked against a rough estimate before use.
Evaluate the path, not just the outcome. An agent that reached the right answer by calling a tool it shouldn't have, or by retrying a denied action, failed. Score intermediate actions: tool choice, arguments, permission handling, stop behavior.
Ben Hartley leads finance automation at a 1,200-person software company. An agent handles vendor billing disputes: it reviews the invoice and contract, calculates any credit owed, emails the vendor, and records the credit. In testing, it ran a shell command to "find the contract faster," emailed a former vendor contact from an old thread, and recorded a credit twice after a timeout.
Before:
You have shell access and email. Resolve the billing dispute end to
end. Find whatever you need, email the vendor, and record the
credit.
After:
Tools (sandboxed, task-scoped credentials, no shell):
- get_invoice(invoice_id), get_contract(vendor_id): read-only
- calculate(expression): returns value; agent must state inputs
- draft_vendor_email(to, subject, body): creates a draft only
- propose_credit(invoice_id, amount_usd, reason, request_id)
Rules enforced by the application:
- 'to' must match the vendor's billing contact in the vendor master;
if missing, stop and ask.
- amount_usd must equal the calculator result and be at or below
the contract's dispute cap.
- propose_credit with a repeated request_id returns the existing
record, not a new one.
- Budget: 8 calls; 1 retry per read tool; stop on any denial.
Before anything leaves the system, the AP specialist sees the exact
email (recipient, subject, body) and credit (amount, invoice, reason)
and confirms each.
Why this is stronger. The shell is gone, so a hostile instruction in a contract can't run commands. Arguments are checked against systems of record outside the model. The recipient comes from the vendor master, not a guess. The credit can't be duplicated. A person confirms the exact email and amount. Ben's eval scores both the final outcome and each intermediate call.
Setup. Pick a task you'd consider handing to an agent, such as scheduling a meeting with an outside party or ordering supplies.
Task. List the tools it would need as narrow, named operations with their arguments. For each, write one check the application should enforce. Mark which actions need a person to confirm the exact details first, and what the agent should do if a required argument is missing.
What a good result looks like. No tool is broader than the task requires. Every consequential action has a confirmation step showing exact details. Missing recipients or amounts cause a stop and a question, not a guess.