28.8 How today's tools realize it
- Approved by
- Panaversity ·
Reference. Where today's products put each tier of guard. Skim it now, and come back when you choose a runtime or port the guard.
In everyday life. A bank has a branch, a website and a phone line, and each checks you its own way. At the branch a clerk checks your card. On the website a password page checks you. On the phone someone asks your date of birth. Move to another bank, and every check has a new name and a new place. You learn where the new bank puts each one.
What you will learn. You practice this in Lab 28, Task 6.
- How sure is each claim?
- Where does each tier live in Claude's products?
- What do OpenAI's tools add?
- What does OpenCode add, and how do you run it safely?
- Where does a guard that decides on every route live?
Why it matters. Products differ in which tier each guard is, in what happens when it breaks, and in what it leaves out.
At work. Before Lab 28's port, you sort the OpenAI Agents SDK's checks by tier, and note what you must still build yourself.
How sure is each claim?
Every fact on this page was read on the product owner's own pages on November 30, 2026, and none is yet tested in a lab run. A line marked from an earlier chapter is one this book already prints, with that chapter's own date, and was not read again.
Where does each tier live in Claude's products?
28.7 sorts Claude Code, the Agent SDK and Managed Agents by tier. Three lines from Anthropic's pages add to it.
- Anthropic screens two tools itself. For the computer use and browser use tools, "Anthropic runs additional classifiers on what the tools return, such as screenshots or page text."1 That screen lowers the odds, and you do not set it.
- A hosted platform's settings stop at your code. "The settings do not secure your custom tools, your MCP servers, or your self-hosted infrastructure."2 So a custom tool such as the hosted worker's
flag_invoicehas only one guard, its own code (28.7). - Every hosted decision is on the record. "each
agent.tool_useandagent.mcp_tool_useevent carriesevaluated_permission, the outcome of the call's permission check:"allow","ask", or"deny"."3
What do OpenAI's tools add?
The Agents SDK checks inputs, outputs and tool calls with guardrails, and pauses for approvals. Codex guards your coding sessions with a sandbox and approvals.
The OpenAI Agents SDK. Here a guardrail is a check that trips a tripwire, in the sense of 22.6. The SDK's page says, "The runner immediately raises an InputGuardrailTripwireTriggered or OutputGuardrailTripwireTriggered exception and halts agent execution."4 There are three kinds. "Input guardrails run only for the first agent in the chain." "Output guardrails run only for the agent that produces the final output." "Tool guardrails run on every guarded function-tool invocation".4 Three facts decide a guardrail's tier.
- What it checks with. A guardrail that asks a model "does this look like an attack?" lowers the odds. Code that refuses a payment call with no matching approval decides, on this runner's route.
- When it runs. By default an input guardrail runs beside the agent, and "if the guardrail's tripwire is triggered, the agent may have already consumed tokens and executed tools" before it is canceled.4 In TypeScript,
runInParallel: false"runs the guardrail before calling the model, preventing token spend and tool execution when the guardrail blocks the request."5 A guard that must stop a tool sets that. - What it leaves out. "Hosted tools (WebSearchTool, FileSearchTool, HostedMCPTool, CodeInterpreterTool, ImageGenerationTool) and built-in execution tools (ComputerTool, ShellTool, ApplyPatchTool, LocalShellTool) do not use this guardrail pipeline".4 So a connector reached as a hosted tool passes no tool guardrail of yours.
A person decides through an approval, as 22.5 showed. "You can define a tool that requires approval by setting the needsApproval option to true or to an async function that returns a boolean." The function decides whether a call needs a person's approval. It approves nothing itself. When a call needs one, "the SDK pauses the run, returns interruptions, and lets you resume later from the same RunState." When the model's tool arguments are malformed JSON, the SDK does not call the function. "Malformed JSON and non-object values fail closed: the SDK requests approval without invoking the callback or executing the tool." The page does not say what happens when the function itself throws. One setting stops the asking. "Pass { alwaysApprove: true } or { alwaysReject: true } if the same tool should stay approved or rejected for the rest of the run."6 An approval decides on one route, and the person who answers it may be the attacker (28.3).
Codex. Section 12.8 showed Codex's two controls (from an earlier chapter, October 30, 2026). The sandbox sets what commands can reach, and approvals set when Codex stops to ask. The lines for looking things up:
- Sandbox modes:
read-only,workspace-writeanddanger-full-access. "By default, the agent runs with network access turned off."7 - Approval policies: "With
on-request, commands allowed by the sandbox can run without approval".neverturns the prompts off. Agranularpolicy "lets you keep specific approval prompt categories interactive while automatically rejecting others". And "Codex and ChatGPT Work no longer supportapproval_policy = "untrusted"."7 - The starting point: for a folder under version control, Codex recommends "
Auto(workspace write + on-request approvals)".7 - The setting to refuse:
--dangerously-bypass-approvals-and-sandbox, also called--yolo, means no sandbox and no approvals, and Codex marks it "not recommended".7
Codex's sandbox and approvals decide on one route: the commands your coding agent runs on your computer. They guard you while you build. They do not guard the worker's payment, which never passes through Codex.
What does OpenCode add, and how do you run it safely?
OpenCode's permission rules decide on one route, and the last matching rule wins. Every agent starts allowed to do everything, so you write the rules first.
The order is the opposite of Claude Code's deny first: "The last matching rule wins, so the specific exceptions follow the broad rule."8 So a broad allow placed after your deny undoes it. Each rule has an action, a resource, and an effect of allow, ask or deny. A connector's tool is an action named <server>_<tool>. The base policy's first rule is { "action": "*", "resource": "*", "effect": "allow" }, and its only asks are for reading .env files.8
To run it safely, set three things before the first session.
- A short shell allowlist, not a list of bad commands. "
shellruns with the host user's filesystem, process, and network authority", so "prefer a narrow shell allowlist instead of patterns intended to recognize every dangerous command."8 - An ask for folders outside the project. "Because no default rule asks for external_directory, reads and edits outside the Location and worktree proceed without a prompt."8
- A container around it. A harness with a shell still belongs in a container (from an earlier chapter, 22.10, November 26, 2026).
Where does a guard that decides on every route live?
In no product. It lives in your connector's own code, which every route reaches.
| Anthropic | OpenAI | Open source: OpenCode | |
|---|---|---|---|
| Lowers the odds | The model itself, a small-model screen and text kept as data (28.3), Anthropic's classifiers on two tools | A guardrail whose check is a model's answer | The pages read name no screen |
| Decides on one route | A hook, a deny rule, a permission policy, a sandbox's host list (28.7) | A tool guardrail in code, needsApproval, Codex's sandbox and approvals | A permission rule, the last one that matches |
| When the guard breaks | A hook lets the call go ahead unless set to block (28.6) | Malformed tool arguments ask for approval. The page does not say what a callback that throws does. A guardrail beside the agent may finish after tools ran | The page read does not say |
| Decides on every route | Your connector's own code | Your connector's own code | Your connector's own code |
The last row is this chapter's answer, and it is the same in every column. The token's scope, an approvals row that a person wrote, and an unused run key are checked in the schedule_payment handler, whatever product proposed the payment. A product's guard can change with its next release. A port to another SDK adds one more route to that handler. It does not move the check.
The operating rule: before you port, sort each guard the new product offers into its tier, and write down what it does when it breaks. Then leave the payment's own checks exactly where they are.
Exam note. The developer exam's guide asks for guards "so that destructive actions cannot execute even under adversarial instruction". It examines Claude. OpenAI and open source are on this page for practice only.
Do this now. Open the documentation of the agent SDK or coding agent you use most, and give your coding agent this prompt.
Read the pages I name about guardrails, permissions and approvals. Make a table with one row for each guard the product offers. For each, say whether it lowers the odds, decides on one route, or could decide on every route. Say what it does when it breaks or times out, and what it leaves out. Quote the page's own sentence for each cell, and write "the page does not say" where it is silent.
Each row that says "the page does not say" is a guard you test yourself before you rely on it.
Check yourself
Question 1 / 8
0 answered
On the OpenAI Agents SDK, an input guardrail runs with its default setting and its tripwire triggers. What may already have happened?
Sources
- Owner
- Panaversity