All lessons

Watch this lesson

Enter your work email to unlock every lesson in Hoop University. One email, full access. No spam.

No spam. One email, full access to every lesson.

Platform Fundamentals · Lesson 04

Guardrails: Real-Time Query Policy Enforcement

Block destructive queries at the protocol layer before they hit your database

5 min·intermediate·Platform Engineer
  • intermediate
  • guardrails
  • policy
  • ai-agents
  • compliance
  • postgres

What you’ll learn

Outcomes and concepts.

Learning objectives

  1. 01Create a custom guardrail rule and assign it to one or more resources
  2. 02Choose between preset rules and custom pattern-matching rules
  3. 03Demonstrate that a destructive query is blocked at the protocol layer with a clear user-facing message
  4. 04Confirm that blocked queries leave the underlying database unchanged
  5. 05Inspect the audit trail to see the blocked query, the user, the triggered rule, and the timestamp
  6. 06Map guardrail logs to SOC 2, HIPAA, and PCI DSS evidence requirements
  7. 07Understand that guardrails apply equally to queries from human engineers and AI agents

Key concepts

Guardrail

A real-time execution policy that sits at the protocol layer and evaluates every query before it executes. If a query matches the rule, it is blocked instantly.

Pattern matching

A guardrail rule type that compares incoming queries against a defined pattern. Matching queries are blocked at the protocol layer before reaching the database.

Preset rules

Built-in guardrail templates available out of the box, intended to cover common destructive query patterns without requiring custom configuration.

Custom rules

User-defined guardrail rules. The host uses one to prevent mass deletion in this lesson.

Resource scoping

Each guardrail rule is assigned to one or more specific resources. The rule only enforces on those resources.

Equal coverage for humans and AI agents

Guardrails evaluate queries regardless of origin. A query from an AI agent goes through the same protocol-layer policy check as a query from a human engineer.

Block-and-log

When a guardrail blocks a query, the user receives a clear message, the database is not touched, and the attempt is logged in the session audit trail.

Check what you learned

4 questions. No score, no clock.

Answer each one to reveal the explanation. You can change your selection any time.

00Ready when you are

Answer 4 short questions about this lesson.

Ask AI to summarize this lesson