GCP – Build a multi-agent KYC workflow in three steps using Google’s Agent Development Kit and Gemini
Know Your Customer (KYC) processes are foundational to any Financial Services Institution’s (FSI) regulatory compliance practices and risk mitigation strategies. KYC is how financial institutions verify the identity of their customers and assess associated risks. But as customers expect instant approvals, FSIs face pressure to streamline their manual, time-consuming and error-prone KYC processes.
The good news: As LLMs get more capable and gain access to more tools to perform useful actions, employing a robust ‘agentic’ architecture to bolster the KYC process is just what FSIs need. The challenge? Building robust AI agents is complex. Google’s Agent Development Kit (ADK) gives you essential tooling to build multi-agent workflows. Plus, combining ADK with Search Grounding via Gemini can help give you higher fidelity and trustworthiness for tasks requiring external knowledge. Together, this can give FSIs:
-
Improved efficiency: Automate large portions of the KYC workflow, reducing manual effort and turnaround times.
-
Enhanced accuracy: Leverage AI for consistent document analysis and comprehensive external checks.
-
Strengthened compliance: Improve auditability through clear reporting and source attribution (via grounding).
To that end, this post illustrates how Google Cloud’s cutting-edge AI technologies – the Agent Development Kit (ADK), Vertex AI Gemini models, Search Grounding, and BigQuery – can be leveraged to build such a multi-agent KYC solution.
- aside_block
- <ListValue: [StructValue([(‘title’, ‘$300 in free credit to try Google Cloud AI and ML’), (‘body’, <wagtail.rich_text.RichText object at 0x3e64ec38b8e0>), (‘btn_text’, ‘Start building for free’), (‘href’, ‘http://console.cloud.google.com/freetrial?redirectPath=/vertex-ai/’), (‘image’, None)])]>
Tech stack from Google Cloud
This multi-agent architecture we’ll show you today effectively utilizes several key Google Cloud services:
-
Agent Development Kit (ADK): Simplifies the creation and orchestration of agents. ADK handles agent definition, tool integration, state management, and inter-agent communication. It’s a platform and model-agnostic agentic framework which provides the scaffolding upon which complex agentic workflows can be built.
-
Vertex AI & Gemini models: The agents are powered by Gemini models (like gemini-2.0-flash) hosted on Vertex AI. These models provide the core reasoning, instruction-following, and language understanding capabilities. Gemini’s potential for multimodal analysis (processing images in IDs or documents) and multilingual support further enhances the KYC process for diverse customer bases.
-
Search Grounding: The google_search tool, used by the Resume_Crosschecker and External_Search agents, leverages Gemini’s Google Search grounding capabilities. This connects the Gemini model’s responses to real-time information from Google Search, significantly reducing hallucinations and ensuring that external checks are based on up-to-date, verifiable public data. The agents are instructed to cite sources (URIs) provided by the grounding mechanism, enhancing transparency and auditability.
-
BigQuery: The search_internal_database custom tool demonstrates direct integration with BigQuery. The KYC_Agent uses this tool early in the workflow to check if a customer profile already exists within the institution’s internal data warehouse, preventing duplicate entries and leveraging existing information. This showcases how agents can securely interact with internal, structured datasets.
Deep dive: How to build a KYC agent in three steps
Our example KYC solution utilizes a root agent (KYC Agent) that orchestrates several specialized sub-agents:
-
Document Checker: Analyzes uploaded documents (ID, proof of address, bank statements, etc.) for consistency, validity, and potential discrepancies across documents.
-
Resume Crosschecker: Verifies information on a customer’s resume against public sources like LinkedIn and company websites using grounded web searches.
-
External Search: Conducts external due diligence, searching for adverse media, Politically Exposed Person (PEP) status, and sanctions list appearances using grounded web searches.
-
Wealth Calculator: Assesses the client’s financial position by analyzing financial documents, calculating net worth, and verifying the source of wealth legitimacy.
The root KYC_Agent manages the overall workflow, calling these child agents sequentially and handling tasks like checking if the customer is already present in internal databases and generating unique case IDs to track KYC requests.
Diagram showing the KYC Agent’s structure with sub-agents and tools
Step 1: Define your root agent (which receives the initial request from the user) and the child agents which handle the specialised tasks involved in the KYC process.
- code_block
- <ListValue: [StructValue([(‘code’, ‘# kyc_agent/agent.py (Illustrative Snippet)rnrn# Child Agents Definitions (Simplified)rndocument_checker_agent = Agent(rn model=MODEL, # e.g. gemini-2.0-flash-001rn name=”Document_Checker”,rn description=’Analyses documents and finds discrepancies…’,rn instruction=instructions_dict[‘Document_Checker’],rngenerate_content_config=GenerateContentConfig(temperature=0.27),rn)rnrnresume_crosschecker = Agent(rn model=MODEL,rn name=’Resume_Crosschecker’,rn description=’Uses `google_search` tool for verifying resume…’,rn instruction=instructions_dict[‘Resume_Crosschecker’],rn tools=[google_search], # Leverages Search Groundingrn generate_content_config=GenerateContentConfig(temperature=0.27),rn)rnrnexternal_search_agent = Agent(rn model=MODEL,rn name=”External_Search”,rn description=’Uses `google_search` tool to find negative news…’,rn instruction=instructions_dict[‘External_Search’],rn tools=[google_search], # Leverages Search Groundingrn generate_content_config=GenerateContentConfig(temperature=0.27),rn)rnrnwealth_calculator_agent = Agent(rn model=MODEL,rn name=”Wealth_Calculator”,rn description=”Assesses the client’s financial position…”,rn instruction=instructions_dict[‘Wealth_Calculator’],rn generate_content_config=GenerateContentConfig(temperature=0.27),rn)rnrn# Wrap Resume_Crosschecker Agentrnresume_crosschecker_tool = AgentTool(agent=resume_crosschecker_agent)rnrn# Wrap External_Search Agentrnexternal_search_tool = AgentTool(agent=external_search_agent)rnrn# Root KYC Agent orchestrating the workflowrnroot_agent = Agent(rn model=MODEL,rn name=”KYC_Agent”,rn description=”KYC Onboarding Assistant”,rn # Add the AgentTool wrappers to the tools list, alongside the original toolsrn tools=[rn generate_case_id,rn search_internal_database,rn resume_crosschecker_tool, # AgentToolrn external_search_tool # AgentToolrn ],rn sub_agents=[rn document_checker_agent,rn wealth_calculator_agentrn ],rn generate_content_config=GenerateContentConfig(temperature=0.27),rn instruction=instructions_dict[‘KYC_Agent’], # Instructions should still guide the LLM to call the tools by namern global_instruction=’You will always give detailed responses and follow instructions’rn)’), (‘language’, ‘lang-py’), (‘caption’, <wagtail.rich_text.RichText object at 0x3e64ec38b8b0>)])]>
Step 2: Define the tools needed by your agents in order to perform their respective tasks
- code_block
- <ListValue: [StructValue([(‘code’, ‘# kyc_agent/custom_tools.py (Illustrative Snippet)rnrndef search_internal_database(input_name: str) -> Dict[str, Any]:rn “””rn Finds names in an internal BigQuery table…rn “””rn try:rn client = bigquery.Client(project=PROJECT_ID)rn query = f”””rn SELECT `Full Name`, `UID`, `Risk Level`, `Citizenship`, `Networth`rn FROM `{TABLE_NAME}` # Defined in constants.pyrn WHERE LOWER(`Full Name`) LIKE LOWER(‘%{input_name}%’)rn “””rn query_job = client.query(query)rn results = query_job.result()rn df = results.to_dataframe()rn return df.to_dict(‘records’)rn except Exception as e:rn error_message = f”An error occurred with BigQuery: {e}”rn # Handle errors, potentially fallback to alternate data sourcern # Fallback logic would go here if neededrn return {“error”: error_message}’), (‘language’, ‘lang-py’), (‘caption’, <wagtail.rich_text.RichText object at 0x3e64ec38ba30>)])]>
Step 3: Run your agent locally using the command “adk web”. ADK provides a built-in UI for developers to visualise and debug the agent during the development process:
Screenshot of the ADK Dev UI used for developing agents
Start building now
This multi-agent KYC architecture demonstrates the power of combining ADK, Gemini, Search Grounding, and BigQuery. It provides a blueprint for building intelligent, automated solutions for complex business processes.
-
Learn more: Dive deeper into the technologies used:
Build your own: Adapt this pattern to your specific KYC requirements and integrate it with your existing systems on Google Cloud using services like Cloud Run for deployment.
Contact us: Reach out to Google Cloud Sales for a deeper discussion on implementing AI-driven KYC solutions tailored to your organization.
By embracing a multi-agent approach powered by Google Cloud’s AI stack, FSIs can transform their KYC processes, achieving greater efficiency, accuracy, and compliance in an increasingly digital world.
Read More for the details.