A multi-agent system built with Google's Agent Development Kit (ADK) to find, analyze, and compare insurance policy documents from the web.
This project demonstrates a sophisticated agentic workflow where a hierarchy of AI agents collaborates to perform a complex task. The root agent orchestrates sub-agents responsible for searching the web for insurance policy PDFs, extracting their content, and performing detailed comparative analysis.
- Overview
- Key Features
- Why Google ADK?
- Architecture
- Getting Started
- How to Deploy and Run
- Potential Customers & Use Cases
The Insurance Policy Comparison Agent is designed to automate the manual and time-consuming process of researching and comparing insurance policies. A user can provide a natural language query, such as "Compare home insurance policies from Allstate and Progressive", and the agent system will:
- Formulate a detailed web search query to find relevant policy documents.
- Search the web, prioritizing PDF files which often contain detailed policy wordings.
- Extract the full text from these PDF documents.
- Analyze the content of the policies.
- Generate a comparative summary, a SWOT analysis, or even suggest a new, innovative insurance product based on gaps in the current market offerings.
- Automated Web Research: Uses the Brave Search engine to find insurance policy documents (PDFs) across the internet.
- PDF Text Extraction: Intelligently extracts text content from PDF documents found at a URL.
- Multi-Agent System: Utilizes a hierarchical structure of specialized agents for searching, analysis, and reporting.
- Comparative Analysis: Capable of performing in-depth comparisons and SWOT analyses of different policies.
- Product Innovation: Can identify market gaps from its analysis to propose new insurance products.
- Secure API Key Management: Leverages Google Cloud Secret Manager to securely handle API keys.
Google's Agent Development Kit (ADK) was chosen as the framework for this project for several key reasons:
- Simplified Agent Creation: ADK provides a clean and intuitive
Agentclass, making it straightforward to define an agent's model, tools, instructions, and metadata. - Seamless Multi-Agent Orchestration: The project's power comes from its multi-agent hierarchy (
root_agentdelegating tobrave_search_agnet,analysis_agent, etc.). ADK handles the complex orchestration, reasoning, and routing of requests between these agents automatically. - Effortless Tool Integration: Integrating custom Python functions as tools for the agents is as simple as adding them to a list. ADK manages the schema generation and function-calling logic, allowing agents to use tools like
brave_search_toolreliably. - Scalability and Extensibility: The modular nature of ADK makes it easy to add new agents with new capabilities (like the
box_report_agent) or to integrate additional tools without refactoring the entire system. - Built-in Development & Deployment: The ADK CLI provides commands like
adk devfor a rapid local development loop andadk deployfor straightforward deployment to a supported Google Cloud environment.
The system is built around a root_agent that acts as an orchestrator. It delegates tasks to specialized sub-agents:
-
root_agent(Insurance Policy Analysis Agent): The main entry point. It receives the user's request and decides which sub-agent to use to fulfill it. -
brave_search_agnet: This agent's sole purpose is to use thebrave_search_tool. It takes a query, searches the web for insurance policy PDFs, and returns the extracted text from those documents. -
analysis_agent: This agent receives the policy text from the search agent. Its instructions are to perform a detailed comparison, summarize the findings, and, if requested, ideate a new insurance product by identifying market gaps. -
box_report_agent: This agent specializes in structuring the analysis into a specific format, such as a 4-box SWOT (Strengths, Weaknesses, Opportunities, Threats) report.
graph TD
A[User Query] --> B(root_agent);
B -->|Delegates Search Task| C(brave_search_agnet);
C -->|Uses Tool| D[brave_search_tool];
D -->|Returns Policy Text| C;
C -->|Returns Policy Text| B;
B -->|Delegates Analysis Task| E(analysis_agent);
B -->|Delegates Report Task| F(box_report_agent);
E -->|Returns Analysis| B;
F -->|Returns Report| B;
B --> G[Final Response];
- Python 3.9+
- A Google Cloud Platform (GCP) project.
- The
gcloudCLI installed and authenticated. - A Brave Search API Key.
-
Clone the repository:
git clone <your-repo-url> cd insurancesearchagentdemo
-
Set up a virtual environment:
python -m venv venv source venv/bin/activate -
Install dependencies: The
requirements.txtfile should be updated to include all necessary packages. See the recommendedrequirements.txtfile in this project.pip install -r requirements.txt
-
GCP Authentication: Log in with your user credentials for local development.
gcloud auth application-default login gcloud config set project YOUR_GCP_PROJECT_ID -
Enable APIs: Ensure the Secret Manager API is enabled for your project.
gcloud services enable secretmanager.googleapis.com -
Store API Key in Secret Manager: Store your Brave Search API key in Google Cloud Secret Manager.
echo "YOUR_BRAVE_API_KEY" | gcloud secrets create bravesearchkey --data-file=-
Grant your principal (user or service account) access to this secret.
The ADK provides a local development server that hot-reloads on code changes, making it easy to test your agent.
-
Start the dev server: From the root directory of the project (
insurancesearchagentdemo), run:adk dev . -
Interact with the agent: Once the server is running, you can send requests to it. You will interact with the
root_agent, which isinsurance_policy_analysis_agent.# In a new terminal adk send 'Compare auto insurance policies from Geico and Progressive for a family in California, focusing on liability coverage and included benefits. Search for PDF documents.' --agent insurance_policy_analysis_agent
You can deploy the agent to a supported Google Cloud environment (like Cloud Run) using the ADK CLI.
-
Deploy the agent: From the root directory, run:
adk deploy .The CLI will guide you through the deployment process, including selecting the region and service account.
-
Invoke the deployed agent: Once deployed, you can invoke the agent using its deployed name and your project ID.
adk send 'Create a SWOT analysis comparing life insurance term policies from Prudential and MetLife.' --agent insurance_policy_analysis_agent --project YOUR_GCP_PROJECT_ID
-
Insurance Companies (Product Development Teams): Analyze competitor policies to identify market gaps, understand feature trends, and design new, competitive insurance products. The
analysis_agentis specifically instructed to assist with this. -
Insurance Brokers & Agencies: Quickly and automatically compare policies from different carriers for their clients. This allows them to provide more informed, data-driven recommendations and highlight key differentiators in coverage.
-
Corporate Risk Managers: Evaluate complex commercial insurance policies (e.g., D&O, E&O, Cyber) from multiple providers to ensure their organization has the most comprehensive and cost-effective coverage.
-
Financial Analysts & Insurtechs: Conduct large-scale market research on insurance products, track changes in policy wordings over time, and build datasets for further analysis.
-
Regulators and Compliance Teams: Monitor the market for compliance with regulations, compare policy language against standards, and identify potentially unfair or deceptive clauses.