Hooks that guard your system.
Intercept every AI tool call.
Attach Bash scripts, HTTP webhooks, or templated prompts to AI lifecycle events. Veto sensitive tool calls before execution touches your machine.
delete_pathBLOCK: AbortedDeterministic security control.
How Nia hooks enforce policy before, during, and after tool execution.
The BLOCK: Veto Contract
When a beforeToolCall hook outputs a string starting with BLOCK: <reason>, the execution loop aborts tool execution immediately. The agent receives the reason without running the tool.
Regex Tool Matchers
Target specific tool names or pattern match using Regex (e.g. ^git_.* or delete_path).
Template Variables
Inject {{toolName}}, {{args}}, {{result}}, and {{error}} directly into commands.
Three Command Dispatch Modes
Choose between local Bash Shell Scripts (15s timeout), HTTP Webhooks (POST payload, 10s timeout), or Templated Prompts fed back into the conversation context.
Lifecycle Event Triggers
Select an event to inspect its execution timing, behavior, and example hook script.
Pre-Execution Security Guard
Runs before any tool call executes. Supports the BLOCK: veto contract to stop sensitive operations before they touch your system.
# beforeToolCall hook script if [ "$TOOL_NAME" = "delete_path" ]; then echo "BLOCK: File deletion tools are restricted by security policy." exit 0 fi
Real-world guardrail examples.
Inspect sample hooks for email restrictions, HTTP audit logging, and prompt validation.
# beforeToolCall — Prevent sending emails to external domains
if [ "$TOOL_NAME" = "send_email" ]; then
RECIPIENT=$(echo '$ARGS' | jq -r '.to // ""')
if [[ "$RECIPIENT" != *"@company.com" ]]; then
echo "BLOCK: Emails can only be sent to internal @company.com addresses."
exit 0
fi
fiProtect your system with Hooks
Configure before/after tool hooks, setup webhooks, and enforce custom security policies in the dashboard.
Go to Hooks Dashboard