Policy Presets
Complete API reference for all 8 policy presets in governance-sdk.
8 built-in presets that cover 90% of governance needs. Each returns a PolicyRule you pass to createGovernance.
blockTools
Block specific tools by name. Any action targeting a listed tool returns a block outcome. The most common policy preset.
allowOnlyTools
Allowlist mode. Only the listed tools are permitted — every other tool is blocked. Inverse of blockTools.
requireApproval
Human-in-the-loop gate. Takes an array of PolicyAction objects. Instead of blocking, returns a "requires_approval" outcome so your application can prompt a human reviewer before proceeding. Priority 80.
tokenBudget
Enforce a per-session token budget. Once the cumulative token count exceeds the limit, subsequent actions are blocked.
rateLimit
Declarative threshold check. The SDK compares a caller-supplied action count against the configured maximum. It does not track counts itself.
Warning: This is a declarative check, not server-side rate limiting. For production use, pair it with Upstash or Redis to track actual counts.
requireLevel
Require agents to meet a minimum governance score level (L0–L4) before acting. Agents below the threshold are blocked.
requireSequence
Enforce tool prerequisites. The target tool is blocked until all prerequisite tools have been called in the current session. Useful for CI/CD-style pipelines.
timeWindow
Restrict actions to specific time windows. Actions outside the window are blocked.
Composing Presets
Presets return standard PolicyRule objects. Pass multiple to createGovernance and they evaluate in priority order.
Note: Rules are evaluated in priority order. Use
composePoliciesfromgovernance-sdk/policy-composefor cross-team merging with conflict resolution.