Black Friday: 79% off every plugin Shop the sale →

Hooks and filters

Ability Gate filters#

FilterArgumentsPurpose
abgate_is_gated$gated, $actor, $name, $abilityWhether a call is gated (decided by policy) or only logged.
abgate_actor$actorChange the detected caller (AbGate_Actor).
abgate_dispatcher_abilities$namesAbilities that dispatch other abilities and are not gated themselves. Default mcp-adapter/execute-ability.
abgate_mcp_route_prefixes$prefixesREST route prefixes treated as MCP. Default /mcp.
abgate_risk$result, $abilityChange a risk result: score, level, reasons, external.
abgate_auditor_findings$counts, $abilityAbility Auditor finding counts (critical, high) used for risk.
abgate_rate_limits$limits, $keyHourly calls and writes for one agent key. 0 means unlimited.
abgate_approver_emails$emailsAddresses for approval and budget emails.
abgate_budget_caller$plugin, $traceWhich plugin an AI Client call is attributed to.

Guardrails filters#

FilterArgumentsPurpose
ankgr_policy_decision$decision, $requestallow, approve or deny. Default allow.
ankgr_capability$capabilityCapability that manages requests. Default manage_options.
ankgr_pending_ttl$secondsHow long a held request waits. Ability Gate sets it from Settings.
ankgr_retention_days$daysHow long history is kept. Ability Gate sets it from Settings.
ankgr_redact_keys$keysKey names redacted in the audit trail.
ankgr_recorder_max_rows$max_rowsMost rows one statement’s pre-image may hold. Default 5000; above it the snapshot is partial.
ankgr_recorder_ignore_table$ignore, $tableTables the recorder skips. Default: its own tables.
ankgr_rollback_flush_cache$flush, $table, $before, $afterWhether to flush the object cache after restoring a row of an unknown table.
ankgr_db_nested_transactions$nestedUse savepoints because an outer transaction exists (for tests).

Guardrails actions#

ActionArgumentsFires when
ankgr_loadednoneThe library has booted. Register actions here.
ankgr_request_created$requestA request is stored.
ankgr_request_pending$requestA request is held for approval.
ankgr_request_approved$requestA request is approved.
ankgr_request_rejected$requestA request is rejected.
ankgr_request_expired$requestA held request expired.
ankgr_request_executed$request, $resultA request ran successfully.
ankgr_request_failed$requestA request ran and failed.
ankgr_request_rolled_back$original, $rollbackA request was rolled back.
ankgr_audit_logged$id, $event, $rowAn audit event was written.
ankgr_export_page_written$last_idA page of an export was written.
ankgr_request_screen_actions$requestInside 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;
} );
Was this article helpful?