GCP Agent Safety Gatekeeper
Agent Buildinggcp-agent-safety-gatekeeperGCP Agent Safety Gatekeeper is an Agent Skill for agent building published in the GoogleCloudPlatform/devrel-demos repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Implements the "Defense-in-Depth" integration pattern in Python (intercepting prompts, parsing filter results).
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/GoogleCloudPlatform/devrel-demos/blob/HEAD/ai-ml/dev-signal/.agent/skills/gcp-agent-safety-gatekeeper/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/gcp-agent-safety-gatekeeper, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
gcp-agent-safety-gatekeeper
This skill implements the Python integration layer for Model Armor. Grounded in security_blog.md, it provides the safety_util functions needed to intercept prompts, sanitize them against your security policy, and handle safety triggers in your FastAPI backend.
Usage
Ask Antigravity to:
- "Add a safety gatekeeper to my agent backend"
- "Implement Model Armor prompt sanitization in Python"
- "Create a safety utility to parse Model Armor findings"
- "Handle prompt injection errors in my FastAPI app"
Integration Pattern
- Client Initialization: Configures the
ModelArmorClientwith the correct regional endpoint. safety_util.py: A robust parser that convertsSanitizeUserPromptResponseinto a list of human-readable security triggers (e.g., "Prompt Injection", "PII: Person names").- Application Interception: Logic to block or sanitize prompts before they reach the GenAI model or agent orchestrator.
Boilerplate Implementation
Refer to scripts/safety_util.py for the core parsing logic.