Tool policy and approvals
The policy contract is a runtime authorization check, not a sandbox or standalone security boundary. The host remains responsible for authentication, execution, and enforcing permissions in the target system.
Recommended flow
- The host compiles policy from trusted configuration and creates a versioned
PolicySnapshotfor the run scope. - The engine evaluates a
ToolContractand model call. Decisions default to deny when a required capability is absent or invalid. - If policy requires approval, the host presents the request through an authenticated user channel.
- The host authenticates the approver and creates a receipt/grant; the engine validates its binding to run, turn, call, normalized arguments, scope, revision, and policy digest.
- Immediately before execution, the host rechecks that policy and grant remain valid and enforces capability, timeout, and isolation.
SqliteToolPolicyStore persists snapshots, evaluations, requests, and approval receipts while
revalidating the latest state. Host-supplied fields do not prove that a human approved; the engine
does not authenticate users, sign receipts, or execute adapters.
Do not reuse grants after arguments, scope, call, run, or policy changes. Handle expiration,
revocation, and replay according to the versioned contract and in the host. See
12-policy-and-approval.md
and
16-sqlite-durable-tool-policy.md.