Google's Agent Development Kit (ADK) has rapidly become one of the default open-source frameworks for building multi-agent applications across Python, TypeScript, Go, Java, and Kotlin. Its clean separation between deterministic workflow agents (SequentialAgent, ParallelAgent, LoopAgent) and LLM-driven tool-calling agents makes it far easier to reason about control flow than ad-hoc prompt chains — and its container-friendly design lets teams deploy on Cloud Run, GKE, or any multi-cloud environment.
Once an ADK agent moves from local adk web testing to enterprise production, however, the security questions change completely. Framework callbacks run inside the same process as the agent, model credentials and MCP tool tokens often sit in environment variables, and multi-agent sub-agent delegation can quietly widen what an untrusted input can trigger. This guide maps what Google ADK's built-in hooks cover, where framework-level controls stop, and how to layer production-grade governance around ADK agents.
For Praesidia's current Google ADK profile, capability scope, and limitations, see the Google ADK runtime setup guide.
Where Google ADK's built-in controls shine — and where they stop
ADK exposes clean lifecycle hooks — before_model_callback, after_model_callback, before_tool_callback, and after_tool_callback — that let developers intercept prompts, inspect tool arguments, short-circuit disallowed calls, and sanitize tool responses before they re-enter context.
Those callbacks are valuable, especially for domain-specific business validation. They also share the structural limits of any in-process framework hook:
| Security concern | What native ADK callbacks handle | What requires an external control plane |
|---|---|---|
| Tool argument & output checks | Custom Python/TS validation per agent definition | Organization-wide policies applied uniformly across every ADK, LangGraph, and CLI agent without code deploys |
| MCP server tool scoping | Filtering exposed tools in client setup code | Centralized MCP gateway allow-lists, per-tool rate limits, and protection against post-approval server schema drift |
| Agent identity & credentials | Cloud IAM / workload identity inside a single GCP project | Per-agent enrollment credentials (pra_…), instant mid-flight revocation, and cross-cloud attribution |
| Spend caps & loop protection | Max-iteration limits on local LoopAgent code |
Real-time cross-provider spend budgets and hard cutoffs across OpenAI, Anthropic, Gemini, and self-hosted endpoints |
| Audit & compliance evidence | Application telemetry and Cloud Trace spans | Append-only, hash-chained decision records and offline-verifiable audit bundles for external reviewers |
| Human-in-the-loop approvals | Custom pause/resume state in application code | Policy-triggered holds on high-risk tool arguments with reviewer attribution and audit trail |
Pattern 1: Enforce fail-closed tool checks in before_tool_callback
Never rely on system prompt instructions to prevent an ADK agent from calling a destructive tool or passing untrusted arguments extracted from a retrieved document. Start by wiring a deterministic before_tool_callback that checks both tool name and argument structure before execution:
from typing import Any, Optional
from google.adk.tools.base_tool import BaseTool
from google.adk.tools.tool_context import ToolContext
ALLOWED_READ_TOOLS = {"search_tickets", "get_customer_summary"}
MAX_EXPORT_ROWS = 25
def guard_tool_call(
tool: BaseTool,
args: dict[str, Any],
tool_context: ToolContext,
) -> Optional[dict[str, Any]]:
# 1. Fail closed on unexpected tools
if tool.name not in ALLOWED_READ_TOOLS:
return {
"status": "denied",
"reason": f"Tool '{tool.name}' is not permitted for this agent.",
}
# 2. Enforce argument-level bounds (prevents bulk exfiltration via prompt injection)
limit = int(args.get("limit", 10))
if limit > MAX_EXPORT_ROWS:
return {
"status": "denied",
"reason": f"Requested limit {limit} exceeds maximum allowed ({MAX_EXPORT_ROWS}).",
}
# Returning None allows the tool to proceed
return None
Two rules make this pattern resilient:
- Default deny. Maintain an explicit allow-list rather than a deny-list so newly added MCP server tools never inherit execution rights silently.
- Validate tool results too. Use
after_tool_callback(and an external guardrail layer) to scan untrusted tool responses for PII leakage or indirect prompt-injection strings before the agent feeds them into its next turn.
Pattern 2: Isolate sub-agent delegation and session state
ADK makes multi-agent trees (sub_agents=[...]) easy to compose — and easy to over-privilege. When a root orchestrator delegates a task to a specialist agent:
- Avoid sharing one broad credential across all sub-agents. A research sub-agent reading public web pages should never share a service account or MCP connection with a finance sub-agent authorized to issue refunds or modify records.
- Treat transferred session state as untrusted data. If an upstream agent summarized an inbound email or support ticket into shared session state, downstream sub-agents reading that state face indirect prompt-injection risk — see threat model: indirect prompt injection and scoped tokens for sub-agent delegation.
- Prefer deterministic workflow agents for regulated pipelines. Use
SequentialAgentwhere step ordering is fixed (e.g., classify → validate → notify) instead of letting an LLM orchestrator improvise transitions.
Pattern 3: Route MCP servers and model calls through an out-of-band boundary
In-process callbacks stop accidental mistakes when every developer keeps them updated. Enterprise governance needs controls that stay active even when a team ships a new ADK service in Go or TypeScript or adds a third-party MCP server:
- Front remote and local MCP servers with a gateway. Keep upstream SaaS/database secrets inside the gateway so the ADK container never holds raw production tokens. Before rolling out any MCP server configuration, run it through our browser-local MCP config security checker.
- Route model traffic through a governed gateway for spend caps and bidirectional guardrails. Swapping the model endpoint lets platform teams enforce monthly spend caps, rate limits, PII redaction, and fail-closed
503protection without rewriting agent code — see the AI model gateway quickstart. - Record verifiable decision evidence for governed actions. For calls that pass through Praesidia, authorization decisions and guardrail evaluations are logged in an append-only, hash-chained audit trail (signed under the default configuration) that reviewers can verify offline — see verifiable audit evidence and runtime security controls.
- Benchmark against OWASP Agentic Top 10. Walk your ADK architecture across
ASI01(goal hijack) throughASI10(rogue agents) using the OWASP Agentic Top 10 readiness scorecard.
Production hardening checklist for Google ADK
Common questions
Are Google ADK's before_tool_callback hooks enough for enterprise security?
They are an important application-layer control for validating tool names and arguments, but because they live in each service's source code, they do not provide organization-wide policy updates without redeploys, cross-agent spend caps, centralized MCP credential isolation, or tamper-evident audit bundles. Pair ADK callbacks with an out-of-band gateway and control plane.
Can I govern Google ADK agents running outside Google Cloud? Yes. Because ADK agents are standard containerized services (Python, TypeScript, Go, Java, or Kotlin), routing their model traffic and MCP tool connections through an independent control plane enforces consistent identity, guardrails, budgets, and audit logging across GCP, AWS, Azure, and on-premises clusters.
How should I secure MCP servers connected to an ADK agent? Register each MCP server centrally, keep upstream API secrets off the ADK container, allow-list only the specific tools each sub-agent needs, constrain sensitive arguments, and monitor for post-approval tool schema changes. See the MCP server governance guide for the full architecture.
How does Praesidia work with Google ADK? Praesidia governs ADK agents through scoped runtime credentials, the model gateway, and the MCP gateway with bidirectional guardrails, tool allow-lists, and offline-verifiable audit evidence for calls routed through it. Check the Google ADK runtime setup guide for current profile details and limits.