The Adapter Workflow
The inline enforcement adapter is the intended host-integration pattern. It validates, decides, logs, and returns effect data for the host to execute — never executing tools itself.
Required Fields on Every Request
- Non-empty caller ID — identifies the host making the request
- Retry-stable correlation ID — preserves identity across retries
- Absolute Unix-millisecond deadline — policy can reject expired calls
Why This Design?
The adapter pattern ensures:
- The policy engine never has an executor callback — it's purely decision-focused
- *The host controls how and when to execute allowed effects*
- Failed authorization is fail-closed — no effect returned means the host must handle it
- Audit records are written before the decision is returned, ensuring durability
Adapter Code Pattern
request = EnforcementRequest(
caller_id="my-host",
correlation_id="request-42",
deadline_unix_ms=time.time_ns() // 1_000_000 + 5_000,
call=PolicyCall(tool="read_file", args=["README.md"]),
)
response = adapter.authorize(request)
if response.effect is not None:
host_execute(response.effect)
else:
handle_terminal_policy_decision(response.decision)