QuestionQ71

VerifiedSecuring and governing agentic workflows

You are deploying a custom Antigravity CLI plugin to enforce enterprise data loss prevention compliance across developer workstations. You must configure an event hook that intercepts tool calls immediately before file execution, automatically redacts sensitive API keys from generated code diffs in transit, and stops tool execution if sanitization fails.

What should you do?

Explanation

Antigravity hooks are declared in a plugin's hooks.json, and the event that runs before a tool executes is PreToolUse; that handler receives the tool call as JSON and can rewrite its arguments (the overwrite merge into toolCall.args), which is how secrets are redacted in transit. Option A is the only choice that both binds to the pre-tool event and ties the outcome to the handler's result: it reads the payload, rewrites the parameters, and only then returns success, so a failed sanitization never yields the success result that lets the call proceed. C runs after execution (PostToolUse only observes and cannot change or block the call), so keys would already have been written. B only evaluates policy and edits strings in place, and D only mutates and returns the payload with no mechanism for halting on failure. Note that the Inspect/Decide/Transform names are exam abstractions, since the documented hook type is a command hook.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!