Enterprise agent governance: 4-layer control plane, OPA gateways & binding agent.yaml specs
P59.agent-boundaries.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Sandboxing & isolation, Policy evaluation & least privilege
P59.agent-boundaries.03 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Sandboxing & isolation, Policy evaluation & least privilege
The gate from module 01 and the sandbox from module 02 protect one agent, built by one team that remembered to wire them. A company with twenty teams building agents cannot rely on twenty teams remembering. This module moves the gate out of each agent and into a control plane: the shared layers, owned by platform and security engineering, that every agent's calls pass through whether its developer wired a hook or not. The rule underneath is old: the one who acts does not also write the rules that check the action.
Separation of duties means the person or program that does a job is never the one that checks it. For agents, it means an agent, or the one team that built it, never governs its own hooks (the code that runs before or after each tool call to allow, block or log it) in-process, that is, inside the same program the agent runs in. Code in the same process can be edited, skipped or rewritten by that agent or that team. The checks therefore live in four layers outside it:
| Layer | Where it runs | What it guarantees | Owned by |
|---|---|---|---|
| L1 — Managed IDE / CLI hooks | the developer's coding tool (an IDE, the app a developer writes code in, or a CLI, a command-line tool), from an org-managed file such as /etc/claude-code/managed-settings.json | hooks that a repository's or user's own settings cannot override: no reading .env, no force-push | IT / platform |
| L2 — Central AI / MCP Gateway | one proxy every model and tool call passes through | holds the credentials; checks each caller by workload identity (OIDC / SPIFFE); evaluates policy-as-code out of process (OPA / Rego or Cedar); redacts PII (personal data such as names and addresses) | security + platform ops |
| L3 — Paved-road SDK | an internal library, e.g. a GovernedAgent base class | compaction, scratchpad, tracing and the gateway client come pre-wired, so a team does not write them | AI platform team |
| L4 — Git / CI gates | the repository and its merge checks | CODEOWNERS (a file naming who must review changes to each path) on .claude/, policies/, harness/; protected main: an agent opens a pull request, never merges one | DevSecOps + security reviewers |
Workload identity means the agent proves which service it is with a short-lived token (OIDC) or certificate (SPIFFE), never with a stored password. A typical L4 setup: a change to the agent rule files under .claude/ needs a security reviewer's approval, and only a person can merge it.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Now write the gateway's binding. Run checks the visible tests: a bound spec allows, gates and budgets calls, and a spec with no pinned digest is refused. Submit grades the hidden cases: a spec the registry does not know, a spec edited after approval, and an approval that tries to grant a tool the spec never declared.
Loading exercise…
/etc/claude-code/managed-settings.json, not overridable) · L2 AI / MCP Gateway (credentials, OIDC / SPIFFE identity, OPA / Rego or Cedar out of process, PII redaction) · L3 paved-road SDK (GovernedAgent) · L4 Git / CI (CODEOWNERS on .claude/, policies/, harness/; protected main).agent.yaml: approved at design time, its SHA-256 digest pinned in the registry (production also signs it, e.g. Sigstore / cosign), bound at gateway boot; unpinned, unknown or edited specs are refused; edited agent code changes nothing, the gateway applies the registered spec.opa test · Semgrep / AST linters · MCP manifest scans (tool poisoning) · PyRIT / Garak red-teaming · Kyverno / Gatekeeper admission + OpenTelemetry → SIEM audit.Loading your notes...