Cheat sheets / Guardrails and fallbacks

Download PDFMarkdown

Guardrails and fallbacks

Controls at each layer, and the ladder for when things fail.

DesignerDeveloperQA

Guardrail layers

LayerExamples
InputPII redaction, abuse and off-topic checks, length and rate limits
RetrievalAccess filters, current-version filter, relevance threshold
PromptRole, scope, refusal style
ToolAllowlist, schema validation, confirmation, budgets, separate environments
OutputProfanity, policy and claims checks, PII redaction, citation checks
ConversationTurn and cost caps, loop detection, kill switch

Remember

  • A prompt instruction asks. A guardrail in code guarantees
  • Hard rules in deterministic checks; nuance in classifiers and judges
  • Measure false positives and false negatives
  • Log every rule that fires with the policy version

Fallback ladder

  • Retry safely, with backoff and jitter
  • Clarify with a specific question
  • Offer two or three choices
  • Switch mode or channel
  • Static or cached answer
  • Human handoff
  • Callback or ticket when no one is available

Principles

  • Fail safe, fail visible, fail forward
  • Count failures; never loop
  • Idempotent writes; timeouts everywhere
  • Route anomaly reports to people, not explanations