Production Agent Tool Authorization: From Roles to Verifiable Execution
This guide details a production-grade authorization framework for agent tool calls, covering capability requests, trusted fact separation, delegation chains, policy evaluation with deny-overrides, execution credentials binding, CEL vs OPA trade-offs, caching with revocation, signed policy deployment, split audit logs, and phased rollout with acceptance testing.
Reading font

1. The Problem Is Not "Can the Tool Be Called" But "Can This Specific Operation Be Executed"
A user asks an ops agent to scale a production order service to 5 replicas. The platform already has an sre -> k8s_scale_deployment role mapping and the tool name passes validation. The real safety decision still depends on:
Does the target Deployment belong to the current tenant and is it the expected resource?
Do the initiating user, current agent, and delegation chain each retain sufficient permissions?
Are MFA, risk status, and approvals still valid and bound to the same operation?
During queuing, retries, or manual approval, have the target, parameters, or authorization state changed?
If policy allows, can the executor enforce audit, masking, rate limiting, and other obligations?
RBAC remains valid for stable responsibility baselines; ABAC adds resource and runtime conditions; delegation limits what an agent can do on whose behalf; Policy-as-Code enables versioned, testable, signed, and deployable rules. Together they serve a single concrete authorization request.
Using set intersection to describe effective permissions helps intuition:
But production implementation should not treat permissions as simple intersection of string sets. Instead, each call should be encoded as a structured capability request :
CapabilityRequest = {
subject, actor, delegation,
action, resource, parameters,
environment, authentication, risk, time
}Every dimension can only narrow the allowed scope, never expand it by switching to a higher-privilege agent, introducing an admin role, or repackaging a task. For unattended tasks, use explicitly authorized workload identities; do not fabricate an "original user."
The threat model assumes: model outputs, prompts, client fields, tool parameters, and queue messages are untrusted; attackers control ordinary tenant accounts, induce agent tool calls, or tamper with unprotected async payloads. The identity issuer, policy signing keys, resource catalog, and controlled executors form the trusted boundary. If those systems are compromised, credential isolation, host security, key rotation, and incident response are still needed; policy language alone cannot be the final backstop.
Production systems must uphold at least five invariants:
Identity, tenant, resource ownership, and risk results come only from trusted services; model outputs cannot override them.
Each delegation layer can only shrink capabilities, never expand them.
If not explicitly allowed, input is invalid, critical dependencies unavailable, or rules cannot decide, execution must not proceed.
Actual execution targets and parameters must be fully bound to the approved operation; mandatory obligations must be enforced by the executor.
Authorization decisions, execution intent, execution results, and target system facts are correlatable but not merged into a single event.
2. Build Trusted Facts First, Then Evaluate Policy
2.1 Model Intent and Authorization Context Must Be Separated
The model proposes "what it wants to do"; the platform proves "who can do what." These two data categories must not be merged directly into client-submittable JSON.
Field: tenant_id, subject_id Authoritative Source: Verified session or access token
Must Validate: issuer, audience, signature, expiry, account status
Field: actor_id, workload identity
Authoritative Source: Runtime identity system, mTLS, or controlled credentials
Must Validate: Current connection, running instance bound to credentials
Field: Delegation scope and chain
Authoritative Source: Delegation issuance service
Must Validate: audience, scope shrinkage, chain depth, expiry, revocation status
Field: tool_id, version, risk level
Authoritative Source: Tool registry and router
Must Validate: Do not accept model self-reported risk level
Field: Resource UID, owner, environment
Authoritative Source: Resource catalog or target system
Must Validate: Ownership, attribute version, read freshness
Field: Operation parameters
Authoritative Source: Strictly parsed request
Must Validate: Type, range, size, unknown fields, duplicate keys
Field: MFA, device, risk control
Authoritative Source: Identity and risk services
Must Validate: Evidence version, validity window, update time
Field: Time, correlation IDs
Authoritative Source: Gateway
Must Validate: Use server-side time; request_id and decision_id separated
Missing, expired, or conflicting attributes must be explicit states. For example, if resource environment cannot be confirmed, do not treat missing env as test environment; if user permission version cannot be confirmed, do not treat stale cache as current authorization.
For the scaling tool, parameters should go into a dedicated model, not a dynamic map:
type ScaleDeploymentArgs struct {
Cluster string
Namespace string
Deployment string
Replicas int32
}Reject string "5", float 5.7, null, overflow values, duplicate JSON keys, and unknown fields. Different tools have different schemas; do not let a "generic parameter object" bypass parsing, boundaries, and audit.
2.2 Resource Names Are Not Stable Authorization Anchors
cluster/namespace/deploymentare human-friendly locators, not final authorization anchors. A safer flow: controlled gateway uses locators to query trusted resource catalog, obtaining immutable resource_uid, owner_tenant_id, environment, and resource version; authorization, approval, and execution credentials bind to UID; before execution, reconfirm that UID still maps to the expected resource.
This binding still cannot eliminate all checks—race conditions exist: resources may change after recheck, permissions may be revoked during execution. High-risk operations should use target system supported resource version preconditions or transactional authorization checks; if unsupported, shorten windows, restrict resource change paths, and explicitly document residual risk.
2.3 Delegation Must Have Verifiable Evidence
delegation_chain: ["router", "ops-agent"]can only be used for logging, not to prove delegation occurred. A viable approach: Runtime exchanges user credentials and its own workload identity with a token service for short-lived, executor-specific delegation tokens. OAuth 2.0 Token Exchange with JWT act semantics can express subject relationships, but applications must define their own trust relationships, resource scopes, and revocation mechanisms. [1]
Each handoff must verify: is the current caller the authorized actor? Is the target audience correct? Are action and resource within scope? Is delegation expired or revoked? Has chain depth been exceeded? Historical actor chains are for traceability; they must not let any admin's permissions in the chain be automatically inherited by the current actor.
3. Describe User, Agent, and Delegation with "Capability Shrinkage"
To avoid "a boolean field represents all permissions," each authorization layer can be normalized to a candidate capability:
Capability = {
actions: {k8s_scale_deployment},
resources: tenant-a / prod / resource_uid set,
constraints: replicas in [1, 20], risk < 0.3,
obligations: AUDIT_BEFORE_EXECUTE,
valid_until: 2026-11-26T10:30:00Z
}User base permissions, agent workload permissions, and delegation permissions each produce a capability ceiling; policy evaluation only allows the narrower capability common to all. Approval is not a universal "add permissions back" flag, but short-lived evidence supplementing an already normalized high-risk operation.
For the example caller_can_scale, agent_can_scale, they must be explained as attributes computed by authoritative permission services based on subject, resource, action, and version—not booleans passed by the model. Each attribute must carry source, authz_epoch, generation time, and TTL; when source is unavailable, version stale, or field semantics ambiguous, treat as high-risk indeterminate. Otherwise the system merely shifts authorization complexity to an attribute service with an unspecified consistency model.
4. Policy Results Go Beyond ALLOW and DENY
Do not let a single ALLOW carry approval, obligations, and dependency exceptions. Distinguish:
Result: DENY Meaning: Explicitly not allowed
PEP Action: Stop call
Result: INDETERMINATE Meaning: Input, dependencies, or rules cannot safely decide
PEP Action: Reject externally; log reason internally
Result: REQUIRE_APPROVAL Meaning: Current evidence insufficient, additional approval needed
PEP Action: Suspend; re-authenticate after approval
Result: ALLOW Meaning: Policy permits, may carry obligations
PEP Action: Verify and fulfill all obligations before execution
Approval objects must bind at least approver_id, approval policy and version, action_digest, resource_uid, approval state version, expiry, and rationale. After approval, must re-read revocation, resource, and permission state; cannot treat "someone once agreed" as a long-term pass.
Obligations are not suggestions. If AUDIT_BEFORE_EXECUTE is required, executor must obtain corresponding persistent confirmation; if masking required, must complete before response leaves. Unrecognized obligations, illegal parameters, merge conflicts, or unsupported executor capabilities must result in non-executable, not "allow now, remediate later."
5. PDP, PEP, PIP, and Executor: Clear Responsibilities Prevent Bypass
PDP (Policy Decision Point) produces decisions, PIP (Policy Information Point) provides facts, PEP (Policy Enforcement Point) intercepts calls and enforces obligations. They may be co-located but responsibility boundaries must be clear. The executor extends PEP: it verifies authorization binding, calls downstream systems with least-privilege credentials, and records execution facts.
Gateway existence does not mean it cannot be bypassed. Target systems must accept only controlled executor identities, network egress must restrict direct connections, execution credentials must not be held by the agent. Otherwise any policy engine merely decorates a bypassable path.
5.1 Bind Policy Decisions to Actual Side Effects
Raw messages in async queues may be replaced; parameters may change after approval. For cross-process execution, issue short-lived execution credentials binding at least:
{
"decision_id": "dec-...",
"audience": "k8s-tool-executor",
"tenant_id": "tenant-a",
"subject_id": "user-42",
"actor_id": "ops-agent-7",
"tool_id": "k8s_scale_deployment",
"tool_version": "3",
"resource_uid": "deployment-uid-...",
"resource_version": "rv-...",
"action_digest": "sha256:...",
"approval_digest": "sha256:...",
"bundle_hash": "sha256:...",
"subject_authz_epoch": 83,
"expires_at": "...",
"obligations": ["AUDIT_BEFORE_EXECUTE"]
}Credentials must be signed or transported with equivalent protection. action_digest should cover versioned normalized action: tool and version, cluster, namespace, resource UID, all execution parameters, and semantically relevant defaults. Normalization must define number, string, default, field order, and duplicate key semantics; merely sorting raw JSON is insufficient for semantic consistency.
Executor recomputes digest, verifies audience, expiry, resource UID, approval binding, revocation state, and necessary current permissions. Idempotency keys and replay protection are separate: same safe retry can reuse idempotency key, but executor must persist deduplication state, not repeat side effects just because credential hasn't expired.
6. CEL vs OPA: Choose Engineering Responsibility, Not Performance Slogans
CEL suits embedding in host programs for compiling and reusing restricted, type-clear condition expressions; OPA provides Rego, policy data, distribution, testing, and decision logs as a more complete ecosystem. Both can participate in high-frequency authorization; real performance depends on rule shape, data scale, deployment, input construction, and external attribute paths. [2][3]
Dimension: Common Integration
CEL: Host registers variables, functions, types, then embeds evaluation
OPA / Rego: Service deployment or SDK integration, organizes rules and policy data
Dimension: Strengths
CEL: Parameter constraints, object property judgments, restricted condition expressions
OPA / Rego: Multi-rule inference, set relationships, policy data queries
Dimension: Type Safety
CEL: Relies on host declarations; dynamic JSON weakens field validation
OPA / Rego: Compile-time checks, type inference, can pair with Schema
Dimension: Host Still Owns
CEL: Trusted input, composition semantics, obligations, audit, execution binding
OPA / Rego: Same as left
Dimension: Validation Focus
CEL: Cost, input size, function boundaries, concurrency
OPA / Rego: Indexes, data structures, rule shapes, deployment overhead
If you have a Go tool gateway and rules are mainly parameter, resource, and attribute judgments, CEL is a viable starting point; if you have OPA assets and complex rule inference, prefer reusing OPA. Dual engines only when responsibilities are clear and testing thorough. No general equivalence translation from arbitrary Rego to CEL; custom DSLs must define supported subset and do differential validation. Kubernetes ValidatingAdmissionPolicy uses CEL for an admission scenario, not a replacement for external policy systems. [4]
7. Composition Semantics: Deny-First Must Be in the Algorithm
"Hit first rule by priority and return" can be implemented but does not equal global explicit deny-first. A newly added high-priority ALLOW might bypass tenant isolation. This guide adopts Platform Guard + Deny-Overrides + Default-Deny :
First run platform guards that cannot be overridden by tenant policies: identity valid, delegation valid, tenant isolation, input schema, revocation freshness.
Fix the immutable policy snapshot for this request.
Select candidate rules using index based only on static metadata; index must not miss potentially matching DENY due to dynamic conditions.
Evaluate all candidate rules. Any applicable rule evaluation error, non-boolean result, or unenforceable mandatory obligation makes this request non-executable.
Any DENY hit denies; if no DENY, at least one ALLOW must hit to allow; multiple ALLOW obligations merged per defined rules, conflict denies.
Example policies below. Variables like delegation_ok, caller_can_scale are computed by trusted services, never from the model.
apiVersion: policy.agent.example/v1
kind: PolicySet
metadata:
name: prod-scale
spec:
combiningAlgorithm: deny-overrides
defaultEffect: DENY
rules:
- id: deny-cross-tenant
effect: DENY
condition: tenant_id != resource_tenant_id
- id: deny-invalid-replicas
effect: DENY
condition: replicas < 1 || replicas > 20
- id: allow-prod-scale
effect: ALLOW
condition: >-
tool_id == 'k8s_scale_deployment' &&
resource_env == 'prod' &&
caller_can_scale && agent_can_scale && delegation_ok &&
mfa_fresh && risk_score >= 0.0 && risk_score < 0.3 &&
replicas >= 1 && replicas <= 20
obligations:
- type: AUDIT_BEFORE_EXECUTE1~20is just a business example. Real policies should also limit single change magnitude, call frequency, service capacity, and change windows; individually legal scale requests may still accumulate into dangerous operations.
8. Compilation, Evaluation, and Obligation Merging
8.1 Compilation Side Declares Types First
request: map<string, dyn>only checks partial syntax, cannot reliably catch nested field typos like request.subject.tennat_id. Use Protobuf / object type registration, or explicitly declare a few strongly typed variables. Below is a CEL core snippet, omitting imports, policy file parsing, and publishing interfaces; production must verify against locked versions. [5][6]
env, err := cel.NewEnv(
cel.Variable("tenant_id", cel.StringType),
cel.Variable("resource_tenant_id", cel.StringType),
cel.Variable("tool_id", cel.StringType),
cel.Variable("resource_env", cel.StringType),
cel.Variable("replicas", cel.IntType),
cel.Variable("caller_can_scale", cel.BoolType),
cel.Variable("agent_can_scale", cel.BoolType),
cel.Variable("delegation_ok", cel.BoolType),
cel.Variable("mfa_fresh", cel.BoolType),
cel.Variable("risk_score", cel.DoubleType),
)
if err != nil { return err }
ast, issues := env.Compile(rule.Condition)
if issues != nil && issues.Err() != nil { return issues.Err() }
if ast.OutputType() != cel.BoolType {
return fmt.Errorf("rule %s: boolean condition required", rule.ID)
}
program, err := env.Program(
ast,
cel.CostLimit(10_000), // example budget, must calibrate via load test
cel.InterruptCheckFrequency(32),
)
if err != nil { return err }Cost is a compute work metric, not microseconds; cannot replace memory, string, collection length, and rule count limits. ContextEval cancellation detection cannot forcibly terminate arbitrary blocking host functions, so hot paths must not expose extensions that can arbitrarily network, read files, or block indefinitely.
Bundle loading should also reject unknown YAML fields, duplicate rule IDs, empty conditions, illegal effects, unknown obligations, undeclared variables, and engine incompatibilities. Policy files must not change fixed default-deny semantics to ALLOW.
8.2 Evaluation Side Must Preserve Error Semantics
The algorithm below emphasizes: candidate index can only be generated from static metadata like tool, tenant, policy scope; dynamic conditions must be evaluated by the rule itself. This is not complete production code.
func evaluate(ctx context.Context, b *Bundle, vars map[string]any) Decision {
if b == nil { return indeterminate("BUNDLE_NOT_READY") }
allowed := false
var matched []string
var obligations []Obligation
for _, r := range b.StaticCandidateRules(vars) {
if err := ctx.Err(); err != nil {
return indeterminate("EVALUATION_CANCELLED")
}
out, _, err := r.Program.ContextEval(ctx, vars)
if err != nil || out == nil {
return indeterminate("RULE_EVALUATION_ERROR")
}
ok, isBool := out.Value().(bool)
if !isBool { return indeterminate("NON_BOOLEAN_RESULT") }
if !ok { continue }
matched = append(matched, r.ID)
switch r.Effect {
case "DENY":
return deny("EXPLICIT_DENY", matched)
case "ALLOW":
allowed = true // must continue checking subsequent DENY
obligations = append(obligations, r.Obligations...)
default:
return indeterminate("INVALID_EFFECT")
}
}
if !allowed { return deny("NO_ALLOW_RULE", matched) }
merged, err := validateAndMerge(obligations)
if err != nil { return indeterminate("OBLIGATION_CONFLICT") }
return allow(matched, merged)
}Entry maps INDETERMINATE to non-executable while retaining controlled internal reasons; do not mix policy faults into normal business rejection rates. Obligation merging must define semantics per type: e.g., multiple audit obligations can union, two mutually exclusive geo constraints must conflict, unknown obligations must fail closed.
9. Caching and Revocation: Prove Reuse Safety First
First version typically caches only compiled programs and versioned attribute snapshots, not ALLOW decisions. When expressions are fast enough, decision caching introduces revocation, time, and obligation complexity that may outweigh benefits.
If caching is needed, the cache object can only be "evaluation result under a specific input, attribute version, and policy snapshot"; cannot reuse approvals, audit confirmations, or execution permits. Cache key must cover real dependencies:
key = SHA256(canonical_encode(
schema_version, engine_semantics_version, bundle_hash,
tenant_id, subject_id, actor_id,
subject_authz_epoch, actor_authz_epoch, delegation_scope_digest,
tool_id, tool_version, action_digest,
resource_uid, resource_authz_epoch,
relevant_risk_and_authentication_attributes
))request_idmust not participate in policy semantics. If time participates in rules, cannot simply delete time to improve hit rate; disable decision caching or convert time condition to next possible change boundary.
Regardless of cache hit, every call must independently fulfill obligations, check revocation gates, and generate audit events. Security-sensitive keys should not use only truncated non-cryptographic hashes; use full cryptographic digests or compare full canonicalized input on hit.
9.1 Revocation Must Define Semantics and Partition Behavior First
Define timeline: t0 is authoritative service commits revocation, t1 is node observes revocation version, t2 is node last accepts old permission for new operations. Need to measure distribution of t2 - t0 and worst-case partition window. Side effects already in target system cannot be recalled by deleting cache; long tasks need cancellation points, step-wise rechecks, some businesses need compensation flows.
Mode: Bounded Staleness
Pre-allow Check: Local state + freshness lease
Partition Behavior: Reject protected calls after lease expiry
Committable Boundary: Limit old state usage window under lease and clock assumptions
Mode: Online Strict Check
Pre-allow Check: Read authoritative permission state before execution
Partition Behavior: Query failure denies high-risk calls
Committable Boundary: Define revocation semantics by authoritative read observation point, still has read-to-execution race
Only when node confirms it has caught up to authoritative watermark can lease renew. Connection alive does not equal state caught up; restart, sequence gaps, clock anomalies, cursor loss should all make node unready, recover snapshot and catch up before allowing.
Redis can carry revocation index, but pipeline lacks cross-operation atomicity, WAIT does not provide strong consistency. [7] Kafka same Consumer Group shares messages rather than broadcasts; if every gateway needs every revocation, need independent Group or dedicated distribution layer, bearing replay and cold-start costs. [8] Use "permission epoch and Outbox updated in same transaction, nodes monotonically consume version, gaps repaired by snapshot". Emergency revocation state must be independent of regular Bundle; policy rollback must not lower already observed revocation epoch.
10. Release, Canary, Rollback: Snapshot Consistency ≠ Global Sync
Control plane reviews and produces artifacts; data plane verifies and activates. Bundle must include policy digest, input schema version, engine and extension function versions, applicability scope, validity period, and signature.
Secure release process: strict decode → compile and static checks → unit and property tests → generate immutable artifact → sign → node download verify signature → compatibility and resource checks → atomic switch → report activation status.
Using atomic.Pointer to switch immutable Bundle guarantees a single evaluation reads a consistent snapshot, but cannot make all nodes switch simultaneously. New snapshot fully built before release; after release, must not modify shared maps, slices, or obligation objects; each request reads snapshot once, both cache key and actual evaluation use that snapshot.
Canary by tenant stable bucketing. Shadow evaluation compares decisions, reasons, obligations, and evaluation errors, without triggering approvals or real side effects. No shadow difference does not mean no false allows: must also cover high-risk boundaries, rare business, and actively crafted negative cases. Rollback should generate new release generation referencing old content, not let generation regress; before rollback still check expiry, compatibility, and minimum safety version.
11. Audit: Authorization Facts, Execution Intent, Execution Results Stored Separately
Recommend recording at least three event types:
Event: AUTHZ_DECISION Minimum Content: Subject/actor, input evidence digest, policy version, result, obligations, cache state
Answers: Why allowed or denied?
Event: EXECUTION_INTENT Minimum Content: decision_id, operation digest, UID, idempotency key, audit confirmation level
Answers: What is about to be executed?
Event: EXECUTION_RESULT Minimum Content: Success/failure/unknown, target request ID, actual impact, retry correlation
Answers: What actually happened?
High-risk side effects may require persisting decision and intent before execution, but must state confirmation level: local WAL fsync covers process crash, cannot guarantee recovery after node disk permanent loss; stronger guarantees need remote acknowledgment or replicated logs. If audit unavailable and cannot meet threshold, high-risk calls should be rejected.
Local logs and remote tools usually cannot atomically commit. If process crashes after writing intent, or remote succeeds but response lost, state should be "unknown, pending reconciliation"; converge via idempotency keys, target system records, and recovery tasks, not forge as execution failure.
Traceability ≠ replayability. Replaying decision requires original policy artifact, engine and extension versions, normalized input, then-current identity and resource attribute snapshots, evaluation time, revocation version, and external attribute evidence. Git SHA and input hash only verify consistency, cannot reconstruct lost input. Sensitive evidence should be encrypted, access controlled, separated from ordinary retrieval logs.
12. Parameter Safety Must Be Shared by Executor and Underlying System
SQL Tools
Do not use CEL regex to judge SQL safety. SQL AST analysis is only one layer; dialect, views, functions, stored procedures, external access, and session state can all expand impact. Prefer purpose-specific query tools; generic SQL should limit to single statement and AST types, use read-only or least-privilege accounts, set timeouts and result limits, and leverage database isolation mechanisms to constrain tenants.
File Tools
filepath.Clean()only does lexical processing, cannot alone defend symlinks and check-then-replace races. Use traversal-resistant APIs under restricted root, e.g., Go's os.Root, while checking file type, mount points, OS permissions, and container isolation. [9]
Resource Consumption and Regex
Regex risk depends on specific engine; cannot broadly claim CEL or OPA regex inevitably have catastrophic backtracking; OPA uses RE2 semantics for relevant built-ins. [10] This does not mean resources won't be exhausted by huge inputs, many rules, or expensive host functions; length, collection size, cost, concurrency, and timeout budgets remain essential.
13. Prove Boundaries with Acceptance Matrix and Property Tests
Scenario: tenant-a requests tenant-b resource
Expected Behavior: Deny, no target call
Verification Evidence: Trusted catalog ownership attribute and denial reason
Scenario: Client forges system Agent / MFA
Expected Behavior: Ignore forged values or deny
Verification Evidence: Identity, MFA sources traceable
Scenario: Same-name resource recreated
Expected Behavior: Reject execution with old UID
Verification Evidence: UID, resource version, pre-execution recheck
Scenario: ALLOW then hit DENY
Expected Behavior: Final deny
Verification Evidence: Combination algorithm unaffected by rule ordering
Scenario: Undeclared variable, non-bool, illegal effect
Expected Behavior: Bundle activation fails
Verification Evidence: Old snapshot still usable
Scenario: Approval then change target or replica count
Expected Behavior: Executor rejects
Verification Evidence: action_digest mismatches approval digest
Scenario: User/Agent permission changes but cache hits
Expected Behavior: Block per revocation mode
Verification Evidence: Epoch, watermark, check time
Scenario: Executor does not support masking obligation
Expected Behavior: Does not return raw data
Verification Evidence: Obligation fail-closed
Scenario: Revocation stream disconnects and exceeds lease
Expected Behavior: Stop protected calls
Verification Evidence: Freshness gate and unready state
Scenario: Hot update with concurrent evaluation
Expected Behavior: Each evaluation uses single snapshot
Verification Evidence: Bundle hash, cache key, decision consistent
Scenario: Audit facility unavailable
Expected Behavior: High-risk side effects blocked
Verification Evidence: Target system receives no execution request
Scenario: Timeout retry non-idempotent tool
Expected Behavior: No duplicate side effect
Verification Evidence: Persisted idempotency record and result reconciliation
Add property tests: adding deny rules cannot expand allow set; shrinking delegation cannot expand permissions; unknown obligations cannot allow; semantically different normalized operations cannot produce same digest; rollback Bundle cannot make already revoked subjects usable again.
Compilation and lint catch typos and some structural issues; samples and traffic replay find differences in covered behaviors; only after building formal model on restricted language subset is it appropriate to claim SMT provides stronger verification. Strings, regex, custom functions, and external attributes if not modeled cannot claim "policy fully proven."
14. Performance, Observability, and Phased Rollout
End-to-end authorization latency at minimum consists of:
Therefore, a single CEL expression taking tens of microseconds does not imply full authz P99 sub-millisecond. Load test must fix hardware, CPU quota, Go and engine versions, rule count, input size, attribute and cache hit rates, concurrency, audit level, revocation mode, and report throughput, P50/P95/P99, error rate, allocations, GC. Beyond normal load, also test cold start, cache stampede, complex deny rules, revocation storms, Bundle hot swap, audit backlog.
Recommended metrics: authz_requests_total{decision,reason_class,mode}: separate normal denials from indeterminate. authz_duration_seconds: observe latency by identity, attribute, evaluation, obligation stages. authz_bundle_activation_lag_seconds: observe release convergence. authz_revocation_freshness_seconds: observe node revocation state freshness. authz_obligation_failures_total: discover allowed but unexecutable obligations. audit_pending_records, audit_oldest_pending_seconds: observe audit backlog.
Detailed subject, resource, and rule info belong in access-controlled audit logs and Traces, not as high-cardinality time-series labels. Alerts cannot only watch denial rate: successful attack blocking raises denial rate, erroneous ALLOW may lower it. Combine with shadow diffs, synthetic privilege probes, business success rate, and attribute service errors.
Recommended three-phase rollout:
Minimum Trusted Loop : Pick one high-value tool, establish strong-typed parameters, trusted identity and resource UID; implement default-deny, deny-first, target system accepts only controlled executor, and decision-intent-result audit. No decision caching or dual engines at this stage.
Complete Change and Revocation : Policies versioned, signed, tested, canaried; implement approval-operation binding, watermarked revocation distribution, cold-start recovery, queue wait and pre-execution recheck; measure real revocation window via fault injection.
Optimize Cost with Evidence : After measuring full path, decide if attribute prefetch, candidate index, decision caching, or extra engine are worth introducing. When extending new tools, separately define schema, least privilege, obligations, and acceptance matrix; do not copy a generic ALLOW rule.
A credible Agent authorization platform should answer with evidence: who delegated to whom, which immutable resource is allowed to be affected, with what parameters, based on which policy and attribute versions, when it expires, whether obligations are fulfilled, and what the target system ultimately did. Policy-as-Code value lies not in writing permissions as code, but in turning these boundaries into reviewable, testable, revocable, and sustainably evolvable engineering facts.
References
RFC 8693: OAuth 2.0 Token Exchange
CEL Official Overview: Type Checking and Compiled Reuse
OPA: Policy Performance
Kubernetes: Validating Admission Policy
CEL Go Official Repository and Import Paths
CEL Go API: Program, CostLimit, ContextEval, Interrupt Check
Redis: WAIT Consistency Boundaries
Apache Kafka: Consumer Group Message Distribution Semantics
Go: Traversal-resistant File APIs
OPA: Regular Expressions Built-ins
For questions about attribution, corrections or content rights, please contactand we will review it promptly.