SOX agent permission and delegated access architecture for enterprise LLM deployment — Reference Architecture
Enterprise implementation parameters
Every value below is a parameter you can hold a vendor or an internal team to. Adjectives are not acceptance criteria.
| Deployment vector | Customer-managed VPC, provider model endpoint pinned to region |
|---|---|
| Security standard | SOX |
| Applicable regimes | SOC 2 Type II, ISO/IEC 27001:2022, GDPR |
| Latency SLA | p95 ≤ 600ms — interactive surfaces need sub-second; batch jobs do not |
| Integration protocol | REST over HTTPS — the widest compatibility and the easiest audit story |
| Idempotency control | an Idempotency-Key header, honoured for 24h |
| Throughput envelope | ~2k rps per gateway node before connection churn dominates |
| Middleware requirement | policy decision point in front of the model gateway |
| Data classes in scope | PII, commercial-in-confidence data |
| Retention obligation | per the data class retention schedule, enforced automatically |
| Data residency | contracted processing region, asserted on every response |
| Contractual instrument | DPA plus a disclosed subprocessor list |
| Systems of record | SAP, Salesforce, Workday |
| Primary failure mode | a retried POST creating a duplicate record |
The control that resolves this is an Intersecting Delegated Authority, evaluated before the request reaches a model provider rather than audited afterwards. In regulated enterprise the binding constraint is SOX, and the question it actually asks is can an AI-influenced number in a filing be traced and reproduced. The shape below holds p95 ≤ 600ms over REST over HTTPS, and ships with a standard-library implementation that runs as written.
The architecture friction point
The agent is given a service account so it can complete its work, and it now acts with more authority than any human who invokes it. An intern's request and an administrator's request reach the same powerful identity.
What SOX specifically requires
SOX cares about the integrity of financial reporting. If a model output touches a number that reaches a filing, the control question is whether that output can be reproduced exactly and attributed to a reviewed, approved version.
The artifact that satisfies it is reproducible output records pinned to a model version. The way teams most often fail it: a model upgrade changing a reported figure with no record of which version produced the original.
The implementation — Delegated authority as an intersection, with expiry
Standard-library Python, no external dependencies, runs as written. Executed by the publish gate: if it raises, this page does not ship. Wire it behind REST over HTTPS; the failure mode it guards against is a retried POST creating a duplicate record. The output you hand the assessor is the reporting-period reproducibility record.
"""Delegated authority: an agent never exceeds the user it acts for.
The failure: an agent is given a service account so it can "do its job", and it
then acts with more authority than any user who invokes it. Correct delegation
is an intersection — the agent may do only what BOTH its own grant and the
invoking user permit — and it must be time-boxed, because a standing delegation
is a standing privilege.
"""
from dataclasses import dataclass
@dataclass(frozen=True)
class Grant:
subject: str
permissions: frozenset
expires_at: int
def valid(self, now: int) -> bool:
return now < self.expires_at
class DelegationError(PermissionError):
pass
class DelegatedAuthority:
"""Effective permissions = user ∩ agent grant, never a union, and never
the agent's own service identity."""
def __init__(self):
self.users: dict[str, frozenset] = {}
self.grants: dict[str, Grant] = {}
self.audit: list[dict] = []
def define_user(self, user: str, permissions: set) -> None:
self.users[user] = frozenset(permissions)
def delegate(self, agent: str, permissions: set, expires_at: int) -> Grant:
g = Grant(agent, frozenset(permissions), expires_at)
self.grants[agent] = g
return g
def effective(self, agent: str, user: str, now: int) -> frozenset:
g = self.grants.get(agent)
if g is None:
raise DelegationError(f"no grant for agent {agent!r}")
if not g.valid(now):
raise DelegationError(f"grant for {agent!r} expired")
if user not in self.users:
raise DelegationError(f"unknown principal {user!r}")
return g.permissions & self.users[user]
def authorise(self, agent: str, user: str, action: str, now: int) -> bool:
try:
allowed = self.effective(agent, user, now)
except DelegationError as exc:
self.audit.append({"agent": agent, "user": user, "action": action,
"allowed": False, "reason": str(exc)})
return False
ok = action in allowed
self.audit.append({"agent": agent, "user": user, "action": action,
"allowed": ok,
"reason": "" if ok else "outside the intersection"})
return ok
def chain(self, agent_a: str, agent_b: str, user: str, now: int) -> frozenset:
"""A delegating to B cannot widen authority — chaining intersects
again, which is what stops escalation through a hop."""
return self.effective(agent_a, user, now) & self.grants[agent_b].permissions
if __name__ == "__main__":
da = DelegatedAuthority()
da.define_user("analyst", {"read_reports", "read_pii"})
da.define_user("intern", {"read_reports"})
da.delegate("summariser", {"read_reports", "read_pii", "delete_records"},
expires_at=100)
assert da.authorise("summariser", "analyst", "read_pii", now=1) is True
# The intern cannot read PII, so neither can an agent acting for them.
assert da.authorise("summariser", "intern", "read_pii", now=1) is False
# Nobody granted delete to a user, so the agent's own grant cannot supply it.
assert da.authorise("summariser", "analyst", "delete_records", now=1) is False
eff = da.effective("summariser", "intern", now=1)
assert eff == frozenset({"read_reports"}), eff
# Expiry is enforced, not advisory.
assert da.authorise("summariser", "analyst", "read_reports", now=101) is False
assert "expired" in da.audit[-1]["reason"]
# Chaining must not widen authority.
da.delegate("exporter", {"read_reports", "export"}, expires_at=100)
chained = da.chain("summariser", "exporter", "analyst", now=1)
assert chained == frozenset({"read_reports"}), chained
assert "export" not in chained, "chaining widened authority"
assert da.authorise("unknown_agent", "analyst", "read_reports", now=1) is False
print("Delegated authority intersection: OK")
print(f" audit entries {len(da.audit)}, "
f"denials {sum(1 for a in da.audit if not a['allowed'])}")
The SOX control, as code
Segregation of duties over model releases. This is the artifact an assessor asks for under SOX specifically — it is not the same control as the one above, and a system that implements one does not thereby implement the other. It executes under the same publish gate.
"""Segregation of duties over model releases, with an immutable approval chain.
SOX cares about change management over systems affecting financial reporting.
The control that fails is the one where the person who wrote the change also
approved and deployed it, and where the approval record can be edited after the
fact. Both are structural, so both are enforced here rather than reviewed.
"""
import hashlib
import json
class ApprovalChain:
"""Append-only. Each link commits to the previous digest, so an edited
record breaks verification rather than quietly rewriting history."""
def __init__(self):
self.links: list[dict] = []
def _head(self) -> str:
return self.links[-1]["digest"] if self.links else "genesis"
def append(self, action: str, actor: str, change_id: str) -> dict:
body = {"action": action, "actor": actor, "change_id": change_id,
"prev": self._head()}
digest = hashlib.sha256(
json.dumps(body, sort_keys=True).encode()).hexdigest()
link = dict(body, digest=digest)
self.links.append(link)
return link
def verify(self) -> bool:
prev = "genesis"
for link in self.links:
body = {k: link[k] for k in ("action", "actor", "change_id", "prev")}
if link["prev"] != prev:
return False
if hashlib.sha256(
json.dumps(body, sort_keys=True).encode()).hexdigest() != link["digest"]:
return False
prev = link["digest"]
return True
def actors(self, change_id: str, action: str) -> set[str]:
return {l["actor"] for l in self.links
if l["change_id"] == change_id and l["action"] == action}
class ReleaseGate:
def __init__(self, chain: ApprovalChain):
self.chain = chain
def author(self, change_id: str, actor: str) -> None:
self.chain.append("author", actor, change_id)
def approve(self, change_id: str, actor: str) -> None:
if actor in self.chain.actors(change_id, "author"):
raise PermissionError(
f"{actor} authored {change_id}; approval requires a second person")
self.chain.append("approve", actor, change_id)
def deploy(self, change_id: str, actor: str) -> dict:
if not self.chain.actors(change_id, "approve"):
raise PermissionError(f"{change_id} has no approval")
if actor in self.chain.actors(change_id, "author"):
raise PermissionError(f"{actor} authored {change_id}; cannot deploy it")
return self.chain.append("deploy", actor, change_id)
if __name__ == "__main__":
chain = ApprovalChain()
gate = ReleaseGate(chain)
gate.author("MODEL-2026-114", "r.khare")
try:
gate.approve("MODEL-2026-114", "r.khare")
raise AssertionError("self-approval was permitted")
except PermissionError:
pass
gate.approve("MODEL-2026-114", "a.controller")
try:
gate.deploy("MODEL-2026-114", "r.khare")
raise AssertionError("author deployed their own change")
except PermissionError:
pass
link = gate.deploy("MODEL-2026-114", "o.release")
assert chain.verify(), "chain must verify after a legitimate sequence"
assert link["action"] == "deploy"
try:
gate.deploy("MODEL-2026-999", "o.release")
raise AssertionError("deployed an unapproved change")
except PermissionError:
pass
# Tampering must be detectable, not merely discouraged.
chain.links[1]["actor"] = "r.khare"
assert not chain.verify(), "edited approval record still verified"
print("SOX segregation of duties + approval chain: OK")
print(f" links {len(chain.links)}, verifies_after_tamper={chain.verify()}")
Reference architecture
Intersecting Delegated Authority — the request path, with the decision points that must exist before the first model call:
flowchart LR
USER[Invoking user<br/>entitlements] --> INT{Intersect}
GRANT[Agent grant<br/>time-boxed] --> INT
INT --> EFF[Effective permissions]
EFF --> ACT{Action in effective set?}
ACT -->|no| DENY[Deny + audit reason]
ACT -->|yes| DO[Execute as the user, not the agent]
EFF --> HOP[Delegate to agent B] --> INT2{Intersect again} --> EFF2[Narrower still]The parts you have to build
- Principal entitlements — What the human may do, from the system of record.
- Agent grant — What the agent may ever do, scoped per task.
- Intersection at call time — Effective = user ∩ grant, computed per request.
- Time-boxed grants — Expiry enforced, so delegation is not standing authority.
- Chain intersection — Agent-to-agent delegation intersects again; a hop cannot widen.
- Denial audit — Every denial recorded with the reason — the escalation signal.
Risk and control matrix
Each row carries an acceptance parameter rather than an adjective, because "low latency" cannot be signed off. Retention here is bound by per the data class retention schedule, enforced automatically.
| Category | Risk | Control | Acceptance parameter |
|---|---|---|---|
| SOX | A model version change silently alters a reported figure | Pin model version per reporting period; record version, prompt digest and output digest for anything touching a filing | Any reported figure reproducible from its recorded version and inputs; version changes gated by change control |
| Data privacy | An agent reads data the invoking user may not see | Effective permissions are the intersection, computed per request | 0 actions outside the intersection; denials audited with reason |
| Operational | A service account gives the agent standing authority | Grants are time-boxed and expiry is enforced at authorisation | Expired grant authorises nothing; tested |
| Data privacy | Agent-to-agent hops widen authority | Chaining intersects again, so a hop can only narrow | Chained permissions are a subset of the first agent's effective set |
| Operational | An unknown agent or principal defaults to permitted | Unknown subject raises and is denied; fail closed | Unknown agent or user denied in tests |
| Operational | Escalation attempts are invisible | Every denial recorded with agent, user, action and reason | Denial rate monitored; repeated denials trigger review |
| Cost control | Entitlement lookups on every request add load | Entitlements cached with a short TTL bounded by the revocation SLO | Cache TTL <= revocation SLO; stale-grant window documented |
| Latency SLA | Authorisation adds a blocking round trip | Intersection computed in-process against cached entitlements | Added latency within the agreed budget, measured |
What the auditor will ask
- Reproduce last quarter's figure exactly, using the model version that produced it.
Version, prompt digest and output digest are recorded per reporting-relevant inference, and versions are pinned per period, so the figure is reproducible on demand. - If an intern invokes the agent, can it read data only an analyst may see?
No. Effective permissions are the intersection of the agent's grant and the intern's entitlements, so anything the intern lacks is unavailable regardless of the agent's own grant. - What authority does the agent have when nobody has invoked it?
None that matters. The grant is time-boxed and only becomes effective when intersected with an invoking principal, so there is no standing authority to borrow. - Can agent A delegate to agent B and end up with more permissions than A had?
No. Chaining intersects again, so each hop can only narrow the set. Widening through a hop is the escalation path this design exists to close. - How quickly does a revoked entitlement take effect for an in-flight agent?
Within the entitlement cache TTL, which is bounded by the revocation SLO. The stale-grant window is documented rather than assumed to be zero. - What is recorded when an agent attempts something outside its effective set?
The agent, the invoking user, the attempted action and the reason for denial. Repeated denials are the signal that something is probing for authority it does not have.
Related architectures
- Part of enterprise ai compliance architecture.
- For the related constraint, see SOX retrieval architecture with citation integrity for enterprise LLM.
- A different failure mode of the same component: SOX vendor evaluation criteria for enterprise AI implementation.
- The same control appears in SOX legacy integration patterns for enterprise AI agents.
- A different failure mode of the same component: SOX reference architecture for enterprise LLM deployment at scale.
- If this is the blocker in front of you: enterprise AI infrastructure review.
Enterprise infrastructure review
If you are carrying this blocker, the useful next step is not a demo. It is a review of your actual request path against the control points above:
- Which of the 6 components exist in your estate today, and which are assumed
- Your current numbers against the 7 acceptance parameters, starting with p95 ≤ 600ms
- Which SOX control questions you cannot yet answer, and what closes each gap