Hooks System
Hooks are safety guardrails that enforce governance and best practices in SignalPilot. They let you define boundaries for AI behavior while still enabling autonomous investigation—ensuring that agentic systems operate within your organization’s constraints.Why Hooks Matter
Agentic AI systems can execute code and run queries autonomously. This power needs boundaries:Hook Types
SignalPilot supports four types of hooks:1. Pre-Execution Hooks
Run before code or queries execute. Can block, modify, or approve.| Use Case | Example Rule |
|---|---|
| Time-based access | ”Only query prod between 9am-5pm” |
| Query safety | ”Add LIMIT 1000 to SELECT * queries” |
| Resource protection | ”Block queries without WHERE clause on large tables” |
| Approval gates | ”Require approval for DELETE/UPDATE operations” |
2. Post-Execution Hooks
Run after code executes. Validate results and flag issues.| Use Case | Example Rule |
|---|---|
| Data quality | ”Warn if null percentage > 5%“ |
| Anomaly detection | ”Flag if row count changed > 20%“ |
| Result validation | ”Check that dates are within expected range” |
| Consistency checks | ”Verify sum matches expected total” |
3. Code Quality Hooks
Validate generated code against team standards.| Use Case | Example Rule |
|---|---|
| Performance | ”Use vectorized pandas, never iterrows()“ |
| Style | ”All functions must have docstrings” |
| Security | ”Never hardcode credentials” |
| Best practices | ”Use parameterized queries, not string concat” |
4. Audit Hooks
Log all operations for compliance and debugging.| What’s Logged | Details |
|---|---|
| Data access | Tables queried, columns accessed |
| Code execution | What ran, when, by whom |
| Context resolution | What MCP sources were queried |
| Results | Summary of outputs (not raw data) |
Configuring Hooks
Basic Configuration
Python Configuration
Common Hook Patterns
Production Database Protection
Query Cost Control
Data Quality Validation
Best Practices
Start Permissive, Tighten Over Time
Begin with warnings rather than blocks. Review warnings to understand patterns before enforcing strict rules.
Explain Blocks Clearly
When blocking an operation, provide clear explanation and suggested alternatives.
Test Hooks in Development
Use a staging database and test notebooks to verify hooks work as expected before enabling in production.