Hooks and filters
Updated October 31, 2026
2 min read
Ability Gate filters#
| Filter | Arguments | Purpose |
|---|
abgate_is_gated | $gated, $actor, $name, $ability | Whether a call is gated (decided by policy) or only logged. |
abgate_actor | $actor | Change the detected caller (AbGate_Actor). |
abgate_dispatcher_abilities | $names | Abilities that dispatch other abilities and are not gated themselves. Default mcp-adapter/execute-ability. |
abgate_mcp_route_prefixes | $prefixes | REST route prefixes treated as MCP. Default /mcp. |
abgate_risk | $result, $ability | Change a risk result: score, level, reasons, external. |
abgate_auditor_findings | $counts, $ability | Ability Auditor finding counts (critical, high) used for risk. |
abgate_rate_limits | $limits, $key | Hourly calls and writes for one agent key. 0 means unlimited. |
abgate_approver_emails | $emails | Addresses for approval and budget emails. |
abgate_budget_caller | $plugin, $trace | Which plugin an AI Client call is attributed to. |
Guardrails filters#
| Filter | Arguments | Purpose |
|---|
ankgr_policy_decision | $decision, $request | allow, approve or deny. Default allow. |
ankgr_capability | $capability | Capability that manages requests. Default manage_options. |
ankgr_pending_ttl | $seconds | How long a held request waits. Ability Gate sets it from Settings. |
ankgr_retention_days | $days | How long history is kept. Ability Gate sets it from Settings. |
ankgr_redact_keys | $keys | Key names redacted in the audit trail. |
ankgr_recorder_max_rows | $max_rows | Most rows one statement’s pre-image may hold. Default 5000; above it the snapshot is partial. |
ankgr_recorder_ignore_table | $ignore, $table | Tables the recorder skips. Default: its own tables. |
ankgr_rollback_flush_cache | $flush, $table, $before, $after | Whether to flush the object cache after restoring a row of an unknown table. |
ankgr_db_nested_transactions | $nested | Use savepoints because an outer transaction exists (for tests). |
Guardrails actions#
| Action | Arguments | Fires when |
|---|
ankgr_loaded | none | The library has booted. Register actions here. |
ankgr_request_created | $request | A request is stored. |
ankgr_request_pending | $request | A request is held for approval. |
ankgr_request_approved | $request | A request is approved. |
ankgr_request_rejected | $request | A request is rejected. |
ankgr_request_expired | $request | A held request expired. |
ankgr_request_executed | $request, $result | A request ran successfully. |
ankgr_request_failed | $request | A request ran and failed. |
ankgr_request_rolled_back | $original, $rollback | A request was rolled back. |
ankgr_audit_logged | $id, $event, $row | An audit event was written. |
ankgr_export_page_written | $last_id | A page of an export was written. |
ankgr_request_screen_actions | $request | Inside the request screen’s decision card, to add buttons. |
Example: tighter limits for one agent#
add_filter( 'abgate_rate_limits', function ( $limits, $key ) {
if ( 'app_password:5f0c9a1e-0000-0000-0000-000000000000' === $key ) {
$limits['writes'] = 20;
}
return $limits;
}, 10, 2 );
Example: notify a team inbox#
add_filter( 'abgate_approver_emails', function ( $emails ) {
$emails[] = 'ops@example.com';
return $emails;
} );