100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
feat: Add AI Due Diligence Agent with multi-agent pipeline for startup investment analysis, including company research, market analysis, financial modeling, risk assessment, and report generation.
Shubhamsaboo6494e19060a5
diff --git a/README.md b/README.mdindex a00c2037..39c21798 100644--- a/README.md+++ b/README.md@@ -108,8 +108,9 @@ A curated collection of **Awesome LLM apps built with RAG, AI Agents, Multi-agen* [πΈοΈ Web Scraping AI Agent (Local & Cloud SDK)](starter_ai_agents/web_scrapping_ai_agent/)### π Advanced AI Agents-* [ποΈ π AI Home Renovation Agent with Nano Banana](advanced_ai_agents/multi_agent_apps/ai_home_renovation_agent)+* [ποΈ π AI Home Renovation Agent with Nano Banana Pro](advanced_ai_agents/multi_agent_apps/ai_home_renovation_agent)* [π AI Deep Research Agent](advanced_ai_agents/single_agent_apps/ai_deep_research_agent/)+* [π AI Due Diligence Agent with Gemini 3 and Nano Banana Pro](advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent)* [π¬ AI Research Planner & Executor (Google Interactions API)](advanced_ai_agents/single_agent_apps/research_agent_gemini_interaction_api)* [π€ AI Consultant Agent](advanced_ai_agents/single_agent_apps/ai_consultant_agent)* [ποΈ AI System Architect Agent](advanced_ai_agents/single_agent_apps/ai_system_architect_r1/)diff --git a/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/README.md b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/README.mdnew file mode 100644index 00000000..00147e8b--- /dev/null+++ b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/README.md@@ -0,0 +1,342 @@+# π AI Due Diligence Agent++A multi-agent AI pipeline for startup investment analysis, built with [Google ADK](https://google.github.io/adk-docs/), Gemini 3 Pro, Gemini 3 Flash and Nano Banana Pro.++**Works with any startup** - from early-stage unknowns to well-funded companies. Just provide a company name, website URL, or both.++## Features++- π **Live Research** - Real-time web search for company and market data+- π **URL Support** - Analyze any startup by their website URL+- π **Revenue Charts** - Bear/Base/Bull projection charts with matplotlib+- π§ **Deep Risk Analysis** - Comprehensive risk assessment across 5 categories+- π **Professional Reports** - McKinsey-style HTML investment reports+- π¨ **Visual TL;DR** - AI-generated infographic summary for quick review++## What It Does++Given a startup name or URL, the pipeline automatically:++1. **Researches the company** - Founders, funding, product, traction+2. **Analyzes the market** - TAM/SAM, competitors, positioning+3. **Builds financial models** - Revenue projections, unit economics+4. **Assesses risks** - Market, execution, financial, regulatory, exit+5. **Generates investor memo** - Structured investment thesis+6. **Creates HTML report** - Professional due diligence document+7. **Generates infographic** - Visual summary for quick review++## Quick Start++### 1. Clone & Navigate+```bash+git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git+cd awesome-llm-apps/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent+```++### 2. Set Environment+```bash+export GOOGLE_API_KEY=your_api_key+# Or create .env file:+echo "GOOGLE_API_KEY=your_api_key" > .env+```++### 3. Install & Run+```bash+pip install -r requirements.txt+adk web+```++### 4. Try It+Open `http://localhost:8000` and try:+- *"Analyze https://agno.com for Series A investment"*+- *"Due diligence on Lovable - the AI app builder"*+- *"Evaluate Cursor IDE at https://cursor.com"*++## Example Prompts++Works with company names, URLs, or both:++| Input Type | Prompt |+|------------|--------|+| URL only | "Analyze https://agno.com for investment" |+| Name only | "Due diligence on Lovable AI" |+| Both | "Evaluate Cursor IDE at https://cursor.com" |+| Early-stage | "Research https://v0.dev - Vercel's AI tool" |+| Unknown startup | "Check out this startup: https://replit.com" |++---++## Pipeline Architecture++```+User Query: "Analyze https://agno.com for Series A"+ β+ βΌ+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+β DueDiligencePipeline (SequentialAgent) β+β β+β βββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β+β β Stage 1 β β Stage 2 β β Stage 3 β β+β β Company βββββΆβ Market βββββΆβ Financial β β+β β Research β β Analysis β β Modeling β β+β βββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β+β β β β β+β βΌ βΌ βΌ β+β βββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β+β β Stage 4 β β Stage 5 β β Stage 6 β β+β β Risk βββββΆβ Investor βββββΆβ Report β β+β β Assessment β β Memo β β Generator β β+β βββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β+β β β+β βΌ β+β ββββββββββββββββββββ β+β β Stage 7 β β+β β Infographic β β+β β Generator β β+β ββββββββββββββββββββ β+βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+ β+ βΌ+Artifacts: revenue_chart.png, investment_report.html, infographic.png+```++---++## Agent Details++### Stage 1: Company Research Agent++**Purpose:** Gathers comprehensive company information through web search.++| Property | Value |+|----------|-------|+| Model | `gemini-3-flash-preview` |+| Tools | `google_search` |+| Output Key | `company_info` |++**What it researches:**+- **Company Basics** - What they do, founding date, HQ location, team size+- **Founders & Team** - Key people, backgrounds, LinkedIn profiles+- **Product/Technology** - Core offering, how it works, target customers+- **Funding History** - Rounds raised, investors, amounts+- **Traction** - Customers, partnerships, growth signals+- **Recent News** - Press coverage, product launches, announcements++**For early-stage startups:** Checks website, LinkedIn, Crunchbase, AngelList, founder interviews, and notes when information is limited.++---++### Stage 2: Market Analysis Agent++**Purpose:** Analyzes market size, competition, and positioning.++| Property | Value |+|----------|-------|+| Model | `gemini-3-flash-preview` |+| Tools | `google_search` |+| Input | `{company_info}` |+| Output Key | `market_analysis` |++**What it analyzes:**+- **Market Size** - TAM, SAM, growth rate from industry reports+- **Competitors** - Who else is in the space, their funding/traction+- **Positioning** - How the company differentiates+- **Trends** - Market drivers, emerging tech, regulatory changes++**For early-stage:** Focuses on broader market category, identifies well-funded competitors, looks for market validation signals.++---++### Stage 3: Financial Modeling Agent++**Purpose:** Builds revenue projections and generates financial charts.++| Property | Value |+|----------|-------|+| Model | `gemini-3-pro-preview` |+| Tools | `generate_financial_chart` |+| Input | `{company_info}`, `{market_analysis}` |+| Output Key | `financial_model` |++**What it calculates:**+- **Current Metrics** - Estimated ARR, growth stage+- **Growth Scenarios** (5-year projections):+ - Bear Case: Conservative growth rates+ - Base Case: Expected trajectory+ - Bull Case: Optimistic scenario+- **Return Analysis** - Exit valuations, MOIC, IRR estimates++**Stage benchmarks:**+- Seed: $0.1-0.5M ARR, 3-5x growth+- Series A: $1-3M ARR, 2-3x growth+- Series B: $5-15M ARR, 1.5-2x growth++**Artifact:** Saves `revenue_chart_TIMESTAMP.png` with Bear/Base/Bull projections.++---++### Stage 4: Risk Assessment Agent++**Purpose:** Conducts deep risk analysis across multiple categories.++| Property | Value |+|----------|-------|+| Model | `gemini-3-pro-preview` |+| Tools | None (extended reasoning) |+| Input | `{company_info}`, `{market_analysis}`, `{financial_model}` |+| Output Key | `risk_assessment` |++**Risk categories analyzed:**+1. **Market Risk** - Competition, timing, adoption barriers+2. **Execution Risk** - Team gaps, technology challenges, scaling+3. **Financial Risk** - Burn rate, fundraising, unit economics+4. **Regulatory Risk** - Compliance, legal, geopolitical+5. **Exit Risk** - Acquirer landscape, IPO viability++**For each risk provides:**+- Severity (Low/Medium/High/Critical)+- Description with evidence+- Mitigation strategy++**Final output:**+- Overall Risk Score (1-10)+- Top 3 risks that could kill the investment+- Recommended protective terms++---++### Stage 5: Investor Memo Agent++**Purpose:** Synthesizes all findings into a structured investment memo.++| Property | Value |+|----------|-------|+| Model | `gemini-3-pro-preview` |+| Tools | None |+| Input | All previous stages |+| Output Key | `investor_memo` |++**Memo structure:**+1. **Executive Summary** - Company one-liner, recommendation, key highlights+2. **Company Overview** - What they do, team, product/technology+3. **Funding & Valuation** - History, estimated valuation range+4. **Market Opportunity** - Size, growth, competitors, differentiation+5. **Financial Analysis** - Revenue, unit economics, runway+6. **Risk Analysis** - Top risks with severity, overall score+7. **Investment Thesis** - Why invest, concerns, return scenarios+8. **Recommendation** - Final verdict, suggested next steps++**Recommendations:** Strong Buy / Buy / Hold / Pass++---++### Stage 6: Report Generator Agent++**Purpose:** Creates a professional HTML investment report.++| Property | Value |+|----------|-------|+| Model | `gemini-3-flash-preview` |+| Tools | `generate_html_report` |+| Input | `{investor_memo}` |+| Output Key | `html_report_result` |++**Report features:**+- McKinsey/Goldman Sachs styling+- Dark blue (#1a365d) and gold (#d4af37) color scheme+- Executive summary at top+- Clear section headers with professional typography+- Data tables for metrics+- Print-friendly layout++**Artifact:** Saves `investment_report_TIMESTAMP.html` viewable in any browser.++---++### Stage 7: Infographic Generator Agent++**Purpose:** Creates a visual summary infographic using AI image generation.++| Property | Value |+|----------|-------|+| Model | `gemini-3-flash-preview` |+| Tools | `generate_infographic` (uses `gemini-3-pro-image-preview`) |+| Input | `{investor_memo}` |+| Output Key | `infographic_result` |++**Infographic includes:**+- Company name prominently displayed+- Key metrics in large, bold numbers+- Market size visualization+- Risk score indicator (1-10 scale)+- Investment recommendation badge+- Professional investment banking aesthetic++**Artifact:** Saves `infographic_TIMESTAMP.png` for quick visual review.++---++## Project Structure++```+ai_due_diligence_agent/+βββ __init__.py # Exports root_agent+βββ agent.py # All 7 agents + pipeline defined here+βββ tools.py # Custom tools (chart, report, infographic)+βββ outputs/ # Generated artifacts saved here+βββ requirements.txt # Python dependencies+βββ README.md # This file+```++## Generated Artifacts++All artifacts are saved to the **Artifacts tab** in ADK web and the **`outputs/`** folder:++```+outputs/+βββ revenue_chart_20260104_143030.png # Financial projections+βββ investment_report_20260104_143052.html # Full HTML report+βββ infographic_20260104_143105.png # Visual TL;DR+```++| Artifact | Format | Description |+|----------|--------|-------------|+| Revenue Chart | PNG | Bear/Base/Bull 5-year projections |+| Investment Report | HTML | Full due diligence document |+| Infographic | PNG/JPG | Visual summary one-pager |++---++## ADK Features Demonstrated++| Feature | Usage |+|---------|-------|+| **SequentialAgent** | 7-stage pipeline orchestration |+| **LlmAgent** | All specialized agents |+| **google_search** | Real-time company/market research |+| **Custom Tools** | Chart generation, HTML reports, infographics |+| **Artifacts** | Saving and versioning generated files |+| **State Management** | Passing data between pipeline stages via `output_key` |+| **Multi-modal Output** | Text analysis + image generation |++## Models Used++| Agent | Model | Why |+|-------|-------|-----|+| CompanyResearch | `gemini-3-flash-preview` | Fast web search |+| MarketAnalysis | `gemini-3-flash-preview` | Fast web search |+| FinancialModeling | `gemini-3-pro-preview` | Complex calculations |+| RiskAssessment | `gemini-3-pro-preview` | Deep reasoning |+| InvestorMemo | `gemini-3-pro-preview` | Synthesis quality |+| ReportGenerator | `gemini-3-flash-preview` | Fast HTML generation |+| InfographicGenerator | `gemini-3-flash-preview` | Orchestration |+| Infographic Tool | `gemini-3-pro-image-preview` | Image generation |++---++## Learn More++- [Google ADK Documentation](https://google.github.io/adk-docs/)+- [Multi Agent Patterns in ADK](https://developers.googleblog.com/developers-guide-to-multi-agent-patterns-in-adk/)+- [Gemini API](https://ai.google.dev/gemini-api/docs)+- [Gemini Image Generation](https://ai.google.dev/gemini-api/docs/image-generation)diff --git a/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/__init__.py b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/__init__.pynew file mode 100644index 00000000..a02b1724--- /dev/null+++ b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/__init__.py@@ -0,0 +1,5 @@+"""AI Due Diligence Agent - Multi-Agent Pipeline for Startup Investment Analysis"""++from .agent import root_agent++__all__ = ["root_agent"]diff --git a/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/agent.py b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/agent.pynew file mode 100644index 00000000..430f5780--- /dev/null+++ b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/agent.py@@ -0,0 +1,386 @@+"""AI Due Diligence Agent - Multi-Agent Pipeline for Startup Investment Analysis++This demonstrates ADK's SequentialAgent pattern with Gemini's capabilities:+- Web search for company and market research+- Code execution for financial modeling+- Extended reasoning for risk assessment+- Structured output for investor memos+- Image generation for visual summaries++Pattern Reference: https://google.github.io/adk-docs/agents/multi-agents/#sequentialagent+"""++from google.adk.agents import LlmAgent, SequentialAgent+from google.adk.tools import google_search+from google.adk.code_executors import BuiltInCodeExecutor+from .tools import generate_html_report, generate_infographic, generate_financial_chart+++# ============================================================================+# Stage 1: Company Research Agent+# ============================================================================++company_research_agent = LlmAgent(+ name="CompanyResearchAgent",+ model="gemini-3-flash-preview",+ description="Researches company information using web search",+ instruction="""+You are a senior investment analyst conducting company research.++The user may provide:+- A company name (e.g., "Agno AI")+- A website URL (e.g., "https://agno.com")+- Or both++**RESEARCH STRATEGY:**++1. If URL provided: Start by searching for information about that specific URL/domain+2. If only company name: Search for "[company name] startup funding" and similar queries+3. For lesser-known startups: Search for their domain, LinkedIn, Crunchbase, news mentions++**GATHER THIS INFORMATION:**++1. **Company Basics**: What they do, founded when, HQ location, team size+2. **Founders & Team**: Key people, their backgrounds, LinkedIn profiles+3. **Product/Technology**: Core offering, how it works, target customers+4. **Funding History**: Any rounds raised, investors, amounts (if available)+5. **Traction**: Customers, partnerships, growth signals+6. **Recent News**: Any press coverage, product launches, announcements++**FOR EARLY-STAGE/UNKNOWN STARTUPS:**+- Check their website, LinkedIn company page, Twitter/X+- Look for Crunchbase, PitchBook, or AngelList profiles+- Search for founder interviews or podcast appearances+- Note if information is limited (that's useful data too)++Be thorough but realistic about what's publicly available for early-stage companies.+""",+ tools=[google_search],+ output_key="company_info",+)+++# ============================================================================+# Stage 2: Market Analysis Agent+# ============================================================================++market_analysis_agent = LlmAgent(+ name="MarketAnalysisAgent",+ model="gemini-3-flash-preview",+ description="Analyzes market size, competitors, and positioning",+ instruction="""+You are a market research analyst.++COMPANY RESEARCH (from previous stage):+{company_info}++Use google_search to research the market this company operates in:++1. **Market Size**: TAM, SAM, growth rate (use industry reports)+2. **Competitors**: Who else is in this space? Their funding/traction+3. **Positioning**: How does this company differentiate?+4. **Trends**: Market drivers, emerging tech, regulatory changes++**FOR EARLY-STAGE COMPANIES:**+- Focus on the broader market category they're in+- Identify well-funded competitors in the same space+- Look for market validation signals+- Note if they're creating a new category++Be specific with numbers where available. For early-stage, estimate based on comparable markets.+""",+ tools=[google_search],+ output_key="market_analysis",+)+++# ============================================================================+# Stage 3: Financial Modeling Agent (with Code Execution)+# ============================================================================++financial_modeling_agent = LlmAgent(+ name="FinancialModelingAgent",+ model="gemini-3-pro-preview",+ description="Builds financial models and generates projection charts",+ instruction="""+You are a financial analyst building investment models.++COMPANY RESEARCH:+{company_info}++MARKET ANALYSIS:+{market_analysis}++**YOUR TASKS:**++1. **Estimate Current Metrics** based on available data:+ - Current ARR (in millions)+ - Growth stage and trajectory++2. **Define Growth Scenarios** (5-year YoY multipliers):+ - Bear Case: Conservative (e.g., 1.5, 1.3, 1.2, 1.1, 1.1)+ - Base Case: Expected (e.g., 3.0, 2.5, 2.0, 1.8, 1.5)+ - Bull Case: Optimistic (e.g., 4.5, 3.5, 2.5, 2.0, 1.8)++3. **Generate the Chart** using the generate_financial_chart tool:+ - company_name: The company name+ - current_arr: Current ARR in millions (number only, e.g., 1.2)+ - bear_rates: Comma-separated rates like "1.5,1.3,1.2,1.1,1.1"+ - base_rates: Comma-separated rates like "3.0,2.5,2.0,1.8,1.5"+ - bull_rates: Comma-separated rates like "4.5,3.5,2.5,2.0,1.8"++4. **Calculate Returns** (in your response, not code):+ - Exit valuations at 10x, 15x, 25x ARR multiples+ - MOIC and IRR estimates++**FOR EARLY-STAGE COMPANIES:**+- Seed: Estimate $0.1-0.5M ARR, use 3-5x growth rates+- Series A: Estimate $1-3M ARR, use 2-3x growth rates+- Series B: Estimate $5-15M ARR, use 1.5-2x growth rates++**OUTPUT FORMAT:**+Provide a clean summary with your assumptions, then call the chart tool.+Do NOT write or show any Python code. Just use the tool.+""",+ tools=[generate_financial_chart],+ output_key="financial_model",+)+++# ============================================================================+# Stage 4: Risk Assessment Agent (with Extended Reasoning)+# ============================================================================++risk_assessment_agent = LlmAgent(+ name="RiskAssessmentAgent",+ model="gemini-3-pro-preview",+ description="Conducts deep risk analysis using extended reasoning",+ instruction="""+You are a senior risk analyst at a top-tier VC firm.++COMPANY RESEARCH:+{company_info}++MARKET ANALYSIS:+{market_analysis}++FINANCIAL MODEL:+{financial_model}++Think deeply and analyze risks across these categories:++1. **Market Risk**: Competition, timing, adoption barriers+2. **Execution Risk**: Team gaps, technology challenges, scaling+3. **Financial Risk**: Burn rate, fundraising, unit economics+4. **Regulatory Risk**: Compliance, legal, geopolitical+5. **Exit Risk**: Acquirer landscape, IPO viability++For each risk, provide:+- Severity (Low/Medium/High/Critical)+- Description with evidence+- Mitigation strategy++End with:+- Overall Risk Score (1-10, where 10 is highest risk)+- Top 3 risks that could kill the investment+- Recommended protective terms (board seat, milestones, etc.)+""",+ output_key="risk_assessment",+)+++# ============================================================================+# Stage 5: Investor Memo Agent+# ============================================================================++investor_memo_agent = LlmAgent(+ name="InvestorMemoAgent",+ model="gemini-3-pro-preview",+ description="Synthesizes all findings into a structured investor memo",+ instruction="""+You are a senior investment partner writing the investment memo.++COMPANY RESEARCH:+{company_info}++MARKET ANALYSIS:+{market_analysis}++FINANCIAL MODEL:+{financial_model}++RISK ASSESSMENT:+{risk_assessment}++Create an INVESTOR MEMO:++## Executive Summary+- Company name and one-liner+- Recommendation: **Strong Buy / Buy / Hold / Pass**+- Key highlights (3-4 bullets)++## Company Overview+- What they do, when founded, team+- Founders and backgrounds+- Product/technology++## Funding & Valuation+- Funding history (or "Pre-seed/Bootstrapped" if none)+- Estimated valuation range++## Market Opportunity+- Market size and growth+- Key competitors+- Differentiation++## Financial Analysis+- Revenue/growth if known, or stage-appropriate estimates+- Unit economics assessment+- Runway considerations++## Risk Analysis+- Top 3-5 risks with severity+- Overall risk score (1-10)++## Investment Thesis+- Why invest (strengths)+- Key concerns+- Return scenarios++## Recommendation+- Final verdict+- Suggested next steps++**NOTE:** For early-stage companies with limited public data, clearly note what's estimated vs. confirmed. That's valuable information for investors.+""",+ output_key="investor_memo",+)+++# ============================================================================+# Stage 6: Report Generator Agent+# ============================================================================++report_generator_agent = LlmAgent(+ name="ReportGeneratorAgent",+ model="gemini-3-flash-preview",+ description="Generates professional HTML investment report",+ instruction="""+You create professional investment reports.++INVESTOR MEMO:+{investor_memo}++Use the generate_html_report tool to create a polished HTML report.++Pass the complete investor memo as the report_data parameter.+The tool will generate a McKinsey/Goldman-style HTML report with:+- Executive Summary+- Company Overview+- Market Opportunity+- Financial Analysis+- Risk Assessment+- Investment Recommendation++After generating, confirm the report was saved as an artifact.+""",+ tools=[generate_html_report],+ output_key="html_report_result",+)+++# ============================================================================+# Stage 7: Infographic Generator Agent+# ============================================================================++infographic_generator_agent = LlmAgent(+ name="InfographicGeneratorAgent",+ model="gemini-3-flash-preview",+ description="Creates visual investment summary infographic",+ instruction="""+You create visual investment summaries.++INVESTOR MEMO:+{investor_memo}++Use the generate_infographic tool to create a visual infographic.++Prepare a data summary with key metrics:+- Company name, founding date, HQ+- Total funding raised, valuation+- Market size (TAM), growth rate+- Risk score (1-10)+- Investment recommendation++Pass this summary to the generate_infographic tool.+The tool will create a professional infographic saved as an artifact.++Confirm the infographic was generated successfully.+""",+ tools=[generate_infographic],+ output_key="infographic_result",+)+++# ============================================================================+# Due Diligence Pipeline (SequentialAgent)+# ============================================================================++due_diligence_pipeline = SequentialAgent(+ name="DueDiligencePipeline",+ description="Complete due diligence pipeline: Research β Market β Financials β Risks β Memo β Report β Infographic",+ sub_agents=[+ company_research_agent,+ market_analysis_agent,+ financial_modeling_agent,+ risk_assessment_agent,+ investor_memo_agent,+ report_generator_agent,+ infographic_generator_agent,+ ],+)+++# ============================================================================+# Root Agent (Coordinator)+# ============================================================================++root_agent = LlmAgent(+ name="DueDiligenceAnalyst",+ model="gemini-3-flash-preview",+ description="AI-powered due diligence analyst for startup investments",+ instruction="""+You are a senior investment analyst helping evaluate startup investment opportunities.++**WHAT YOU ACCEPT:**+- Company name: "Analyze Agno AI"+- Website URL: "Due diligence on https://agno.com"+- Both: "Check out Lovable at https://lovable.dev"++**WHEN USER PROVIDES A COMPANY/URL TO ANALYZE:**+β transfer_to_agent to "DueDiligencePipeline"++The pipeline will:+1. Research the company (works for both well-known and early-stage startups)+2. Analyze market and competitors+3. Build financial models+4. Assess investment risks+5. Generate investor memo, HTML report, and infographic++**EXAMPLES TO ROUTE TO PIPELINE:**+- "Analyze https://agno.com for seed investment"+- "Due diligence on Lovable - the AI app builder"+- "Evaluate Cursor IDE as a Series A opportunity"+- "Check out https://replit.com for investment"+- "Research this startup: https://v0.dev"++**FOR GENERAL QUESTIONS:**+Answer directly about VC, due diligence, or how you can help.++After analysis, summarize key findings and mention the generated artifacts.+""",+ sub_agents=[due_diligence_pipeline],+)+++__all__ = ["root_agent"]diff --git a/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/requirements.txt b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/requirements.txtnew file mode 100644index 00000000..60c2c581--- /dev/null+++ b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/requirements.txt@@ -0,0 +1,4 @@+google-adk>=1.0.0+google-genai>=1.0.0+python-dotenv>=1.0.0+matplotlib>=3.8.0diff --git a/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/tools.py b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/tools.pynew file mode 100644index 00000000..6aa7f35a--- /dev/null+++ b/advanced_ai_agents/multi_agent_apps/ai_due_diligence_agent/tools.py@@ -0,0 +1,280 @@+"""Custom tools for the Due Diligence Pipeline.++Provides HTML report generation, financial charts, and infographic creation.+"""++import logging+import io+from pathlib import Path+from datetime import datetime+from google.adk.tools import ToolContext+from google.genai import types, Client++logger = logging.getLogger("DueDiligencePipeline")++# Create outputs directory for generated files+OUTPUTS_DIR = Path(__file__).parent / "outputs"+OUTPUTS_DIR.mkdir(exist_ok=True)+++async def generate_financial_chart(+ company_name: str,+ current_arr: float,+ bear_rates: str,+ base_rates: str,+ bull_rates: str,+ tool_context: ToolContext+) -> dict:+ """Generate a revenue projection chart and save as ADK artifact.++ Args:+ company_name: Name of the company being analyzed+ current_arr: Current ARR in millions (e.g., 1.2 for $1.2M)+ bear_rates: Comma-separated YoY growth rates for bear case+ base_rates: Comma-separated YoY growth rates for base case+ bull_rates: Comma-separated YoY growth rates for bull case+ tool_context: ADK tool context for artifact saving++ Returns:+ dict with status and artifact info+ """+ try:+ import matplotlib.pyplot as plt+ import matplotlib+ matplotlib.use('Agg')++ # Parse growth rates+ bear = [float(x.strip()) for x in bear_rates.split(",")]+ base = [float(x.strip()) for x in base_rates.split(",")]+ bull = [float(x.strip()) for x in bull_rates.split(",")]++ # Calculate projections+ years = list(range(2025, 2025 + len(base) + 1))++ def project_arr(start, rates):+ arr = [start]+ for rate in rates:+ arr.append(arr[-1] * rate)+ return arr++ bear_arr = project_arr(current_arr, bear)+ base_arr = project_arr(current_arr, base)+ bull_arr = project_arr(current_arr, bull)++ # Create professional chart+ plt.style.use('seaborn-v0_8-whitegrid')+ fig, ax = plt.subplots(figsize=(10, 6))++ ax.plot(years, bear_arr, 'o-', color='#dc2626', linewidth=2, markersize=8, label='Bear Case')+ ax.plot(years, base_arr, 's-', color='#1a365d', linewidth=3, markersize=10, label='Base Case')+ ax.plot(years, bull_arr, '^-', color='#16a34a', linewidth=2, markersize=8, label='Bull Case')+ ax.fill_between(years, bear_arr, bull_arr, alpha=0.1, color='#1a365d')++ ax.set_title(f'{company_name} - Revenue Projection Analysis', fontsize=16, fontweight='bold', color='#1a365d')+ ax.set_xlabel('Year', fontsize=12)+ ax.set_ylabel('ARR ($ Millions)', fontsize=12)+ ax.legend(loc='upper left', fontsize=11)++ for x, y in zip(years, base_arr):+ ax.annotate(f'${y:.1f}M', (x, y), textcoords="offset points",+ xytext=(0, 10), ha='center', fontsize=9, color='#1a365d')++ ax.grid(True, linestyle='--', alpha=0.7)+ plt.tight_layout()++ # Save to bytes buffer+ buffer = io.BytesIO()+ plt.savefig(buffer, format='png', dpi=150, bbox_inches='tight', facecolor='white')+ buffer.seek(0)+ image_bytes = buffer.read()+ plt.close()++ # Save as ADK artifact (MUST await)+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")+ artifact_name = f"revenue_chart_{timestamp}.png"+ chart_artifact = types.Part.from_bytes(data=image_bytes, mime_type="image/png")++ version = await tool_context.save_artifact(filename=artifact_name, artifact=chart_artifact)+ logger.info(f"Saved chart artifact: {artifact_name} (version {version})")++ # Also save to outputs folder+ filepath = OUTPUTS_DIR / artifact_name+ filepath.write_bytes(image_bytes)++ return {+ "status": "success",+ "message": f"Chart saved as '{artifact_name}' - view in Artifacts tab",+ "artifact": artifact_name,+ "version": version,+ "summary": {+ "year_5_bear": f"${bear_arr[-1]:.1f}M",+ "year_5_base": f"${base_arr[-1]:.1f}M",+ "year_5_bull": f"${bull_arr[-1]:.1f}M"+ }+ }++ except Exception as e:+ logger.error(f"Error generating chart: {e}")+ return {"status": "error", "message": str(e)}+++async def generate_html_report(+ report_data: str,+ tool_context: ToolContext+) -> dict:+ """Generate a professional HTML investment report.++ Args:+ report_data: The investor memo content to format as HTML+ tool_context: ADK tool context for artifact saving++ Returns:+ dict with status and artifact info+ """+ current_date = datetime.now().strftime("%B %d, %Y")++ prompt = f"""Generate a professional investment due diligence report in HTML format.++**IMPORTANT: Use this exact date: {current_date}**++Style it like a McKinsey or Goldman Sachs investment memo with:+- Clean, professional design with dark blue (#1a365d) and gold (#d4af37) colors+- Executive summary at the top with DATE: {current_date}+- Clear section headers with good typography+- Data tables for metrics+- Print-friendly layout++DATA TO FORMAT:+{report_data}++SECTIONS TO INCLUDE:+1. Executive Summary (Date: {current_date})+2. Company Overview+3. Market Opportunity+4. Financial Analysis+5. Risk Assessment+6. Investment Recommendation++Generate complete, valid HTML with embedded CSS."""++ try:+ client = Client()+ response = await client.aio.models.generate_content(+ model="gemini-3-flash-preview",+ contents=prompt,+ )++ html_content = response.text++ # Clean up markdown wrapping if present+ if "```html" in html_content:+ start = html_content.find("```html") + 7+ end = html_content.rfind("```")+ html_content = html_content[start:end].strip()+ elif "```" in html_content:+ start = html_content.find("```") + 3+ end = html_content.rfind("```")+ html_content = html_content[start:end].strip()++ # Save as ADK artifact (MUST await)+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")+ artifact_name = f"investment_report_{timestamp}.html"+ html_artifact = types.Part.from_bytes(+ data=html_content.encode('utf-8'),+ mime_type="text/html"+ )++ version = await tool_context.save_artifact(filename=artifact_name, artifact=html_artifact)+ logger.info(f"Saved HTML artifact: {artifact_name} (version {version})")++ # Also save to outputs folder+ filepath = OUTPUTS_DIR / artifact_name+ filepath.write_text(html_content, encoding='utf-8')++ return {+ "status": "success",+ "message": f"Report saved as '{artifact_name}' - view in Artifacts tab",+ "artifact": artifact_name,+ "version": version+ }++ except Exception as e:+ logger.error(f"Error generating HTML report: {e}")+ return {"status": "error", "message": str(e)}+++async def generate_infographic(+ data_summary: str,+ tool_context: ToolContext+) -> dict:+ """Generate an investment infographic using Gemini's image generation.++ Args:+ data_summary: Key metrics and data to visualize+ tool_context: ADK tool context for artifact saving++ Returns:+ dict with status and artifact info+ """+ prompt = f"""Create a professional investment infographic.++Style: Clean, modern, investment banking aesthetic+Colors: Dark blue (#1a365d) primary, gold (#d4af37) accent, white background++Content to visualize:+{data_summary}++Include:+1. Company name prominently at top+2. Key metrics in large, bold numbers+3. Market size visualization+4. Risk score indicator (1-10 scale)+5. Investment recommendation badge++Make it look like a Goldman Sachs one-pager. Professional, data-rich."""++ try:+ client = Client()+ response = await client.aio.models.generate_content(+ model="gemini-3-pro-image-preview",+ contents=prompt,+ config=types.GenerateContentConfig(+ response_modalities=["TEXT", "IMAGE"]+ )+ )++ # Look for image in response+ for part in response.candidates[0].content.parts:+ if part.inline_data and part.inline_data.mime_type.startswith("image/"):+ image_bytes = part.inline_data.data+ mime_type = part.inline_data.mime_type++ # Save as ADK artifact (MUST await)+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")+ ext = "png" if "png" in mime_type else "jpg"+ artifact_name = f"infographic_{timestamp}.{ext}"++ image_artifact = types.Part.from_bytes(data=image_bytes, mime_type=mime_type)+ version = await tool_context.save_artifact(filename=artifact_name, artifact=image_artifact)+ logger.info(f"Saved infographic artifact: {artifact_name} (version {version})")++ # Also save to outputs folder+ filepath = OUTPUTS_DIR / artifact_name+ filepath.write_bytes(image_bytes)++ return {+ "status": "success",+ "message": f"Infographic saved as '{artifact_name}' - view in Artifacts tab",+ "artifact": artifact_name,+ "version": version+ }++ return {+ "status": "partial",+ "message": "Image generation not available",+ "description": response.text if response.text else "No content"+ }++ except Exception as e:+ logger.error(f"Error generating infographic: {e}")+ return {"status": "error", "message": str(e)}