feat(ask-a-sailor): add any-guardrail content safety layer#27
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
- Add any-guardrail>=0.3.0 to root and ask-a-sailor requirements.txt - Create src/safety/guardrail.py with ContentGuardrail and GuardedAgent - GUARDRAIL_BACKEND env var: llama_guard | shield_gemma | none (CI) - GuardedAgent wraps AskASailorAgent.answer() with input+output checks - Safe fallback message when content is blocked - 16 tests with mocked guardrail backends (no GPU needed) Co-authored-by: fullharbor <237832340+fullharbor@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add mozilla-ai/any-guardrail for youth content safety
feat(ask-a-sailor): add any-guardrail content safety layer
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ask a Sailor serves families with children 6–18. This adds mozilla-ai/any-guardrail as a content safety layer that checks every user message before RAG and every response before return.
Changes
src/safety/guardrail.py— Two classes:ContentGuardrail: wrapsany_guardrail.AnyGuardrail, lazy-imports GPU deps only when a real backend is selectedGuardedAgent: drop-in wrapper aroundAskASailorAgent.answer()with input/output safety checks and a safe fallbackGUARDRAIL_BACKENDenv var —llama_guard|shield_gemma|none(default, passthrough for CI)requirements.txt(root + ask-a-sailor) — addedany-guardrail>=0.3.0tests/test_guardrail.py— 16 tests, fully mocked, no GPU neededUsage
Set
GUARDRAIL_BACKEND=llama_guardin production; omit or set tononefor CI/local dev.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.