Guidance vs. Enforcement for the Professional Agentic Architect Exam

GCP Study Hub
November 14, 2026

An instruction in a prompt, a tool docstring, or a rule file is guidance. A model will usually follow it, but nothing guarantees that it will do so on every request. When an architecture requires that a rule always be enforced, or that a specific action never happen, the control has to live outside the model. That distinction between guidance and enforcement appears repeatedly on the Professional Agentic Architect exam, where options that tell the agent how to behave are typically distractors whenever hard enforcement is required.

Enforced controls fall into three categories: code inside the agent framework, configuration around the runtime or tools, and managed Google Cloud services. There is also a second architectural boundary. When a requirement calls for enforcement outside the agent's own code, even in-code controls are ruled out in favor of a platform layer that the agent code cannot change.

Why prompt instructions do not provide enforcement

System instructions, tool docstrings, Antigravity rules, and skills all steer model behavior, yet each one depends on the model choosing to comply. Generation settings do not cross into enforcement either. Lowering temperature or supplying stronger examples can make outputs more consistent, but a consistent wrong value is still wrong, and neither stops a model from calling an unintended tool or repeating restricted text. We treat prompts and rules as guidance for normal behavior, while placing non-negotiable constraints in deterministic controls.

In-code controls in ADK and the Antigravity SDK

When enforcement belongs in code, ADK and the Antigravity SDK offer deterministic safeguards that run before a tool executes or control how execution flows:

  • Tool filtering: With McpToolset (for instance, paired with StreamableHTTPConnectionParams for a remote server), setting tool_filter exposes only the named MCP tools to the model, whereas listing allowed tools in an instruction still hands the model every tool on the server.
  • Pre-execution callbacks: ADK invokes before_tool_callback with the tool, its arguments, and the tool context before execution. Returning a dict skips the tool and passes that dictionary to the model as the tool result, blocking actions such as protected deletions without modifying the tool function while giving the model an explanation to relay. Returning None lets the tool run normally, while after_tool_callback runs too late to prevent an action.
  • Argument validation: Decorating a tool with Pydantic's @validate_call and constrained types checks arguments before the function body runs. Catching ValidationError and returning its details blocks invalid inputs, such as a bad refund amount, before downstream API calls and lets the model retry. By contrast, output_schema shapes only the agent's final response.
  • Tool confirmation: Wrapping a tool in FunctionTool with require_confirmation pauses for approval through the ADK web interface or the ADK server's REST API in reply to adk_request_confirmation, accepting True or a conditional function on the arguments. This feature is experimental and does not yet support DatabaseSessionService or VertexAiSessionService, so it runs with ADK's in-memory session service.
  • Graph-based workflows: A graph-based Workflow in ADK 2.0 defines conditional branching in code using agent, tool, or plain Python nodes and edges mapped from a router node's Event route value, rather than relying on a long prompt.
  • Antigravity SDK policies: Passing declarative deny, allow, and ask_user policies in LocalAgentConfig enforces tool access in the SDK runtime, such as denying * first and selectively opening tools or sending calls to a custom approval handler.

Configuration controls: hooks, sandboxes, and fixed queries

Other safeguards operate through configuration around the runtime rather than code inside the agent.

In Antigravity, workspace-level hooks in .agents/hooks.json at the project root apply to everyone who opens the repository and run outside the model. A PreToolUse hook matched to run_command inspects commands before execution. It can return deny to block commands such as terraform apply and log blocked attempts, or return allow with an overwrite object that rewrites arguments before the command runs, with Antigravity prepending a notice naming the changed keys to the tool result. A PostToolUse hook runs only after execution finishes.

In the Antigravity app, the Default permission preset runs routine project commands without prompts inside an OS-level terminal sandbox that can write to project folders and temporary directories, blocks sensitive paths such as ~/.ssh and .env, hides unmounted files, and blocks outbound network access except for domains granted under read_url. Both Turbo and Request Review leave the sandbox off.

For databases, MCP Toolbox for Databases defines custom tools such as postgres-sql in tools.yaml with typed parameters and fixed SQL statements, grouped into reusable toolsets with connection pooling and IAM-based authentication. This avoids both the unrestricted reach of execute_sql and building SQL from model output.

The second level: enforcement outside the agent's code

The Professional Agentic Architect exam also separates in-code controls from controls enforced outside the agent's code. Safeguards such as tool_filter or calling a screening API from a callback enforce rules against the model, but a code change inside the agent can still alter or remove them. When central controls must hold regardless of agent code, enforcement moves to managed services:

  • Inbound prompt screening: A Client-to-Agent gateway in front of an agent on Agent Runtime uses a same-region Model Armor template to screen incoming prompts for prompt injection and jailbreak attempts before the agent sees them. An Agent-to-Anywhere gateway governs outbound traffic instead, and calling the sanitize API from a callback leaves enforcement inside the agent's code.
  • Pattern-based masking: Advanced Sensitive Data Protection in Model Armor pairs a custom regex infoType with a de-identify template to mask structured patterns consistently while passing the rest of the reply through.
  • Per-identity MCP tool policies: An Agent-to-Anywhere gateway parses MCP traffic so egress policies can target individual tools for an Agent Identity, such as testing iap.googleapis.com/mcp.tool.isReadOnly to limit one identity to read-only tools while others keep full access. Neither project IAM roles nor VPC Service Controls can inspect individual MCP tool names.
  • Document access control in Agent Search: Enabling data source access control when creating an Agent Search data store (it cannot be enabled later) enforces document permissions in the search service, using ACL metadata listing reader principals for Cloud Storage data, instead of asking the model to drop results. When external user identities are not synced to Google, Workforce Identity Federation lets Agent Search recognize end users.

Choosing the right layer

Two architectural questions usually settle which control belongs in a design. First, is the rule a preference that prompt guidance can shape, or a hard requirement that must be enforced outside the model? Second, if enforcement is needed, can it live in the agent's code or local configuration, or must a managed service enforce it independently of the agent's codebase? Keeping those boundaries clear helps separate prompt instructions, ADK and Antigravity controls, and managed Google Cloud services.

Our Professional Agentic Architect practice exams test guidance versus enforcement alongside ADK tool controls and Agent Gateway policies, with detailed explanations that drill these distinctions.

Get tips and updates from GCP Study Hub

arrow