How Do You Control AI Agent Permissions in 2026? Schema, Sandbox, Tool Policy, and a Four-Layer JSON Security Model
Permissions are not one allow list. In 2026, steering AI agents with JSON usually means four layers: Schema on tool_use.input, tool permission (allow / ask / deny, managed sub-agents, SDK permission_mode), runtime sandbox (Claude Bash sandbox, OpenShell network_policies per binary), and agent identity + audit events you can diff. This is the full-stack follow-up to the coding-agent permission post—not a repeat of the OpenShell MCP L7 deep dive.
Before you read
| Layer | 2026 product fact | What to read in JSON |
|---|---|---|
| ① Schema | Host validates input with draft 2020-12 (etc.) before execute; Agents API and MCP expose parameters | pattern, additionalProperties, required |
| ② Tool policy | Claude Code permissions JSON; managed agents always_allow / always_ask / auto; SDK permission_mode | allow, ask, deny, eval_order |
| ③ Sandbox | Session Bash sandbox; OpenShell per-binary egress + Landlock at create (network hot-reload) | per_binary, egress_default, sandbox_id |
| ④ Audit | Each tool decision logs agent id, session, sandbox, per-layer verdict | layers.schema, layers.permission, outcome |
| Harness | Keep schema, manifest, policy, audit in separate files—not one blob | messages vs state |
Facts through 2026-11-07: Claude Code permissions and Bash sandbox docs, OpenAI Agents SDK permission_mode, NVIDIA OpenShell network_policies and openshell-sandbox. Order A-1042, sb_agent_demo_7f3a, and sample events are fictional.
Agent permission control = Schema + policy + sandbox + audit—four JSON layers
The intro post covers session allow / ask / deny on Bash, Read, and Git—that is the harness gate. The model can still emit bad order_id values, spawn a sub-agent that widens tools, or let a runner hit an unlisted host. A 2026 full stack chains four layers:
- Schema layer: one JSON Schema per tool,
additionalProperties: falseplus patterns likeA-1042; failures never reach permission evaluation. - Policy layer: manifest patterns evaluated deny → ask → allow; managed Explore / Plan agents use always_allow / always_ask / auto; the SDK adds modes like acceptEdits.
- Sandbox layer: IDE Bash sandbox scopes the workspace; production workers run under OpenShell where
network_policiesbind egress to which binary—chat Allow does not replace outbound registration. - Audit layer: record schema result, permission match, sandbox egress, and
agent.identityin one event for compliance and diffing.
Permission basics: the coding-agent permission model. OpenShell runtime and MCP egress depth: OpenShell runtime sandbox (this piece only cites per-binary network JSON). Harness state split: agent harness and JSON state. Why Schema: why AI needs JSON Schema. Agents API shapes: OpenAI Agents API and JSON Schema.
Outermost audit wraps sandbox wraps policy—Schema runs first
Schema targets the argument object, not the tool name: validate MCP arguments and Claude tool_use.input on the host before dispatch. Permission targets tools and command patterns: Bash(git push *) stays deny-before-allow; mcp__orders may default allow but does not replace Schema. Sandbox targets process and network facts: even after IDE Allow, an unlisted /opt/agent/runner cannot egress to a new host; Landlock pins at create, unlike hot-reloaded network rules. Identity / audit targets traceability: CI bots, human sessions, and sub-agents need agent.id and session_id or you cannot attribute incidents. Claude Code’s Bash sandbox (workspace-write, etc.) patches the dev laptop; OpenShell is server runtime—keep both JSON surfaces, do not merge into one allow rule.
One JSON artifact per layer—do not stuff them into one message
1. Tool input Schema (layer 1). Bind at tool registration or MCP capabilities; validate lookup_order input before execute:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "lookup_order_input",
"type": "object",
"additionalProperties": false,
"required": ["order_id"],
"properties": {
"order_id": {
"type": "string",
"pattern": "^[A-Z]-[0-9]{4}$",
"description": "Warehouse order id, e.g. A-1042"
},
"include_line_items": {
"type": "boolean",
"default": false
}
}
}
2. Permission manifest (layer 2). Repo- or session-scoped; includes managed sub-agents and SDK mode. Note eval_order:
{
"version": "2026-09",
"permission_mode": "default",
"eval_order": ["deny", "ask", "allow"],
"managed_agents": {
"Explore": "always_allow",
"Plan": "always_ask",
"BashReview": "auto"
},
"tools": {
"Bash": {
"default": "ask",
"sandbox": "workspace-write",
"rules": [
{ "pattern": "git status", "decision": "allow" },
{ "pattern": "git diff *", "decision": "allow" },
{ "pattern": "git push *", "decision": "deny" }
]
},
"Edit": { "default": "ask" },
"mcp__orders": { "default": "allow" }
},
"sdk": {
"permission_mode": "acceptEdits",
"bypass_permissions": false
}
}
3. OpenShell network_policies excerpt (layer 3). Per-binary egress; Landlock is not hot-patched here—see the OpenShell post:
{
"network_policies_version": "2026.11",
"hot_reload": true,
"per_binary": [
{
"binary": "/opt/agent/runner",
"egress_default": "deny",
"allow": [
{ "host": "orders.example.com", "port": 443, "path_prefix": "/mcp" }
]
},
{
"binary": "/usr/bin/python3",
"egress_default": "deny",
"allow": [
{ "host": "pypi.org", "port": 443 }
]
}
],
"landlock_note": "filesystem_policy applies at sandbox create, not via this file"
}
4. Audit event (layer 4). One successful call with all layer verdicts, aligned to harness tool_use:
{
"event_id": "evt_9c2f8a01",
"ts": "2026-11-07T06:22:11Z",
"agent": {
"id": "agt_codereview_v3",
"session_id": "sess_7f3a",
"identity": "service-account:ci-bot",
"sandbox_id": "sb_agent_demo_7f3a",
"supervisor": "openshell-sandbox"
},
"layers": {
"schema": { "tool": "lookup_order", "valid": true, "validator": "draft-2020-12" },
"permission": { "decision": "allow", "matched": "mcp__orders", "rule": "default" },
"sandbox": { "binary": "/opt/agent/runner", "egress": "allowed" }
},
"tool_use_id": "toolu_order_01",
"input_digest": "sha256:8f3e…",
"outcome": "executed"
}
Schema, policy, sandbox, audit—do not let one layer pretend to be the stack
Teams often treat “strict Schema” or “permissions deny git push” as complete security. Map each layer to what it actually gates and what breaks if you stop there:
| Layer | What it gates | If this is all you have |
|---|---|---|
| JSON Schema | input / arguments shape and enums |
Valid args can still git push or egress from an unlisted runner |
| Tool permission | Tool names, Bash patterns, managed agents, SDK mode | One IDE Allow does not register outbound binaries |
| Runtime sandbox | Process, Landlock, per-binary egress | Sandbox does not check order_id patterns—that is Schema |
| Audit / identity | Who, which session/sandbox, per-layer results | No audit means no proof and no diff when misconfigured |
Session permissions: the coding-agent permission model. Outbound and openshell-sandbox lifecycle: OpenShell runtime sandbox. Argument philosophy: why AI needs JSON Schema—layers stack, they do not replace each other.
Five steps to version all four layers as JSON
Run fictional order A-1042 in staging before widening policy:
- One Schema file per tool, synced with OpenAPI / MCP definitions; CI validates sample inputs.
- Check in the permission manifest; deny before allow; managed sub-agents explicitly always_ask—do not rely on defaults.
- Split session vs runtime sandbox: Claude Bash sandbox and workspace roots locally; OpenShell FS at create, version network_policies separately.
- Append-only audit stream (or immutable object store); fixed sub-objects for schema/permission/sandbox for JSONPath.
- Rejections across four layers: schema_valid, permission decision, sandbox egress, identity matches expected bot.
When all five land on diffable JSON, you can tell malformed order_id, deny rules, unlisted binaries, and dropped audit events apart.
When a tool is denied or “allowed but not run,” lay out four JSON surfaces
Do not stare only at model tool_use; pull manifest, network_policies snapshot, and latest audit in parallel.
- format Schema, manifest, policy, audit; Schema validate for
A-1042on inputs. - JSONPath extract for
$.tools.Bash.rules[*].pattern,$.per_binary[*].binary,$.layers.permission.matched. - JSON Diff manifest and policy before/after changes; watch deny and egress_default, not system prompts.
- Claude:
/permissionsor exported JSON; OpenShell:openshell logs --tail --source sandbox. - redact tokens in audit and manifest; JSONSort runs locally in the browser.
When the four align, you know whether Schema blocked a bad ID, deny beat allow, a binary was unlisted, or a sub-agent used always_allow against parent intent.
Common traps
- Schema only, no permission manifest. Valid parameters can still run dangerous Bash or MCP.
- SDK bypass_permissions in production. Isolated eval only—not a substitute for four JSON layers.
- Chat Allow instead of OpenShell registration. Harness does not register runner binaries; egress still dies at the proxy.
- Managed agents default to always_allow. Explore sub-agents widen tools; parent manifest should set always_ask.
- Audit stores only tool_result text. Without layers.* you cannot prove Schema and sandbox passed at execution time.
- Use this post instead of the OpenShell MCP L7 article for egress. Full stack + per-binary network only; L7 tools/call matching belongs in the OpenShell post.
FAQ
How is this different from ai-coding-agent-permissions-json?
That post is session-permission basics (Shell / Git / FS). This one adds Schema, runtime sandbox, managed agents, SDK modes, and audit JSON—a full stack, not another allow list.
Schema on the model side or the host?
Host (or gateway) only. Model strict output reduces bad shapes but cannot replace server-side additionalProperties and patterns.
Claude Bash sandbox or OpenShell?
Both, different objects: workspace write scope on the dev machine; runner processes, Landlock, and per-binary egress on the server. Store JSON separately.
What is managed_agents auto?
Product-defined automation between always_ask and always_allow. In production, set Plan / BashReview sub-agents to always_ask or explicit tool denylists.
How long to keep audit JSON?
Per compliance; technically keep enough to diff again (tool_use_id, agent.identity, layers, outcome). Redact PII before long-term storage.
Conclusion
Stable AI agent permission control needs four JSON layers: Schema on arguments, policy on tools and managed boundaries, sandbox on process and egress, audit on identity and proof.
Align with the intro model in the permission post, then split files as here; read OpenShell for L7 egress and harness/schema posts on their own—do not merge into one mega-allow.
Further reading
- Coding-agent permission model allow / ask / deny basics
- OpenShell runtime sandbox openshell-sandbox, Landlock, MCP egress—this post only cites per-binary network
- Agent harness and JSON state Loop, state, where tool_use lives
- Why AI needs JSON Schema Arguments are the second gate
- OpenAI Agents API and JSON Schema Managed agents and parameters shape
- JSONSort local toolbox Format, validate, diff, Schema
- All posts More notes on JSON and AI development
Changelog: First published