Why it matters

Untrusted agents can generate anything. Guardrails constrain output. Understanding shapes safety.

Advertisement

The architecture

Input guardrails: check prompt for injection, policy violations.

Output guardrails: check response for harmful content, PII.

Guardrail layersInput guardsbefore LLMOutput guardsafter LLMAction guardsbefore tool execCombining Gemini safety filters + custom checks + policies gives defense-in-depth
Guardrail placement.
Advertisement

How it works end to end

Gemini safety filters: built-in harassment, hate speech, sexual, dangerous content filters.

Custom guards: business-specific rules (no financial advice, etc.).

Action guards: block destructive tool calls without confirmation.