✦ Want a lab built just for you? ✦
Request a Lab ↗

Building a Compliance-Guarded Financial Advisor with Google ADK

About this lab

You are a junior developer at a fintech startup building an AI-powered wealth management platform. The compliance team has flagged a critical requirement: any AI advisor making investment recommendations must have multiple layers of safety guardrails to comply with financial regulations. Your task is to build a financial advisor agent that can analyze portfolios, recommend investments, and check market data, but every interaction must pass through compliance checks that prevent unauthorized advice, block restricted securities, and maintain a complete audit trail.

In this lab, you will use Google's Agent Development Kit (ADK) to create a compliance checker agent and wrap it as an AgentTool so the main advisor can call it like a regular function. You will implement all four ADK callback types to intercept agent behavior at every stage: injecting compliance context before LLM calls, scanning responses for unauthorized advice, blocking blacklisted tickers before tool execution, and logging every action for regulatory audits. By the end, you will know how to add production-grade safety guardrails to any ADK agent using AgentTool for agent composition and callbacks for behavior interception.

Lab details

  • Level: Intermediate
  • Cloud: GCP
  • Domain: AI Engineering
  • Duration: 90 minutes

What you will learn

  • Build financial analysis tools that work with portfolio and market data
  • Create a compliance checker agent with regulatory rule enforcement
  • Wrap an agent as a callable tool using AgentTool
  • Implement before_model_callback to inject context into LLM requests
  • Implement after_model_callback to scan responses for unauthorized patterns
  • Implement before_tool_callback to block restricted inputs and after_tool_callback for audit logging

Concepts covered

  • Google ADK
  • AgentTool
  • Callbacks
  • Guardrails
  • Compliance
  • before_model_callback
  • after_model_callback
  • before_tool_callback
  • after_tool_callback

Technologies used

  • Google ADK
  • AgentTool
  • ADK Callbacks
  • Gemini 2.5 Flash

Prerequisites

  • Completed Labs 1-2 or intermediate Google ADK knowledge
  • Basic Python knowledge

Topics

  • Google ADK
  • AgentTool
  • Callbacks
  • Guardrails
  • Financial
  • Compliance
  • Gemini
  • Python
  • GCP