Skip to content

Latest commit

 

History

History
377 lines (287 loc) · 13.1 KB

File metadata and controls

377 lines (287 loc) · 13.1 KB

Startup Due Diligence Platform

A multi-agent AI system that conducts comprehensive due diligence analysis on startups using LangGraph orchestration and Claude's Agent SDK.

The idea is simple: Input a startup name → Get a complete investment analysis report

The initial version created as part of a workshop by: Khaled El Fakharany. I highly recommend you check it out!

Overview

This platform automates the startup evaluation process using 11 specialized AI agents organized into a 3-layer processing pipeline:

  • Layer 1: Research - 5 agents gather data from multiple sources
  • Layer 2: Analysis - 4 agents perform deep analysis
  • Layer 3: Synthesis - 2 agents generate reports and investment decisions

Architecture

Multi-Agent System

The system uses 11 specialized agents orchestrated through a LangGraph StateGraph:

Research Layer (5 agents)

  1. Company Profiler - Researches company background, founding, operations
  2. Market Researcher - Analyzes market opportunity, TAM/SAM/SOM, trends
  3. Competitor Scout - Identifies competitors and competitive landscape
  4. Team Investigator - Researches founders and key team members
  5. News Monitor - Tracks recent news and media coverage

Analysis Layer (4 agents)

  1. Financial Analyst - Evaluates financial health, funding, burn rate
  2. Risk Assessor - Identifies business, market, and regulatory risks
  3. Tech Evaluator - Assesses technical architecture and innovation
  4. Legal Reviewer - Reviews legal and compliance concerns

Synthesis Layer (2 agents)

  1. Report Generator - Creates comprehensive due diligence reports
  2. Decision Agent - Generates investment recommendations with confidence scores

Workflow

The workflow follows this graph structure:

init → research → validate_research → analysis → synthesis → output
         ↑             |
         └─────────────┘ (retry if incomplete)

Stages:

  1. Init - Validates input and initializes state
  2. Research - All 5 research agents run in parallel
  3. Validate Research - Checks research completeness (retries if needed)
  4. Analysis - All 4 analysis agents run in parallel on research data
  5. Synthesis - Report generator and decision agent create final outputs
  6. Output - Returns complete results

State Management

The workflow uses a central DueDiligenceState object that flows through all nodes:

  • Inputs: startup_name, startup_description, funding_stage
  • Research outputs: Results from all research agents
  • Analysis outputs: Results from all analysis agents
  • Final outputs: full_report, investment_decision
  • Metadata: current_stage, errors, retry_count

Installation

Prerequisites

  • Python 3.8+
  • Claude API key (set as environment variable or in config)

Setup

  1. Clone the repository:
git clone <repository-url>
cd startup-due-diligence
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your Claude API key:
export ANTHROPIC_API_KEY="your-api-key-here"  # On Windows: set ANTHROPIC_API_KEY=your-api-key-here

If you're using Claude Code and working on your local machine then you don't actually need to set this - it'll simply use your existing Claude configuration (subscription or API).

Usage

Command Line Usage

Run the main script with command line arguments to analyze any startup:

python main.py "Company Name" "Company Description" [--stage FUNDING_STAGE]

Arguments:

  • company_name (required): Name of the startup to analyze
  • company_description (required): Brief description of what the startup does
  • --stage (optional): Funding stage of the startup. Default: Growth
    • Supported stages: Seed, Series A, Series B, Series C, Series D, Growth, Pre-IPO

Examples:

# Analyze Stripe (uses default "Growth" stage)
python main.py "Stripe" "Stripe is a payment infrastructure company"

# Analyze OpenAI at Series B stage
python main.py "OpenAI" "OpenAI develops large language models" --stage "Series B"

# Analyze Anthropic at Series C stage
python main.py "Anthropic" "Anthropic is an AI safety company" --stage "Series C"

# View help and examples
python main.py --help

Programmatic Usage

You can also use the platform programmatically in your own Python code:

import asyncio
from src.workflow import run_due_diligence

async def analyze_startup():
    result = await run_due_diligence(
        startup_name="Your Startup Name",
        startup_description="Description of what the startup does...",
        funding_stage="Seed"  # Optional: Seed, Series A, Series B, Growth, etc.
    )

    # Access results
    print(result["investment_decision"])
    print(result["full_report"])
    print(result["research_outputs"])
    print(result["analysis_outputs"])

asyncio.run(analyze_startup())

Testing Individual Agents

You can test individual agents using test_agent.py:

python test_agent.py

Modify the script to test different agents from src/agents/.

Project Structure

startup-due-diligence/
├── main.py                          # Main entry point
├── test_agent.py                    # Agent testing utility
├── requirements.txt                 # Python dependencies
├── README.md                        # This file
│
├── reports/                         # Auto-generated reports (created on first run)
│   └── *.md                         # Timestamped markdown reports
│
├── src/
│   ├── __init__.py
│   │
│   ├── agents/                      # All agent implementations
│   │   ├── __init__.py
│   │   ├── base.py                  # Base agent wrapper with error handling
│   │   │
│   │   ├── research/                # Layer 1: Research agents
│   │   │   ├── company_profiler.py
│   │   │   ├── market_researcher.py
│   │   │   ├── competitor_scout.py
│   │   │   ├── team_investigator.py
│   │   │   └── news_monitor.py
│   │   │
│   │   ├── analysis/                # Layer 2: Analysis agents
│   │   │   ├── financial_analyst.py
│   │   │   ├── risk_assessor.py
│   │   │   ├── tech_evaluator.py
│   │   │   └── legal_reviewer.py
│   │   │
│   │   └── synthesis/               # Layer 3: Synthesis agents
│   │       ├── report_generator.py
│   │       └── decision_agent.py
│   │
│   ├── config/                      # Configuration
│   │   ├── settings.py              # Model mappings
│   │   └── agent_configs.py         # Agent configurations
│   │
│   ├── state/                       # State management
│   │   ├── schema.py                # DueDiligenceState definition
│   │   └── enums.py                 # Enumerations
│   │
│   └── workflow/                    # LangGraph workflow
│       ├── graph.py                 # Graph definition
│       ├── nodes.py                 # Node implementations
│       └── routing.py               # Conditional routing logic

Configuration

Model Selection

Agents use different Claude models based on their complexity:

  • Haiku (claude-haiku-4-5-20251001) - Fast, cost-effective for research and simple analysis
  • Sonnet (claude-sonnet-4-20250514) - Balanced for complex analysis and report generation
  • Opus (claude-opus-4-5-20251101) - Most capable for final investment decisions

Model assignments are configured in src/config/agent_configs.py.

Agent Configuration

Each agent has:

  • Model: Which Claude model to use
  • Tools: Available tools (WebSearch, WebFetch, etc.)
  • Timeout: Execution timeout in seconds (default: 120s for research/analysis, 180s for synthesis)
  • System prompt: Specialized instructions for the agent

Example from src/config/agent_configs.py:

COMPANY_PROFILER = AgentConfig(
    name="company_profiler",
    model="haiku",
    tools=["WebSearch", "WebFetch"],
    timeout_seconds=120,  # Extended timeout for reliable web research
    system_prompt="You are a company research specialist..."
)

Timeout Configuration:

  • Research agents (5): 120 seconds each
  • Analysis agents (4): 120 seconds each
  • Synthesis agents (2): 180 seconds each

Output Format

The workflow returns a DueDiligenceState object containing:

Investment Decision

{
    "recommendation": "invest" | "pass" | "conditional_invest",
    "confidence": 0.0 - 1.0,
    "key_factors_for": ["reason 1", "reason 2", ...],
    "key_factors_against": ["concern 1", "concern 2", ...],
    "summary_rationale": "Overall reasoning..."
}

Full Report

A comprehensive markdown report including:

  • Executive summary
  • Company overview
  • Market analysis
  • Competitive landscape
  • Team assessment
  • Financial analysis
  • Risk evaluation
  • Technical assessment
  • Legal review
  • Investment recommendation

Report Storage: All reports are automatically saved to the reports/ directory with timestamps and sanitized company names (e.g., reports/stripe_20260123_143022.md). Each report includes the investment decision at the top followed by the detailed analysis.

Research & Analysis Outputs

Individual results from each agent, including success status, execution time, and output data.

Key Features

  • Command-Line Interface: Analyze any startup via CLI arguments without editing code
  • Parallel Execution: Research and analysis agents run concurrently for speed
  • Fault Tolerance: Handles agent failures gracefully, continues workflow
  • Retry Logic: Automatically retries research layer if incomplete (up to 2 retries)
  • Automatic Report Storage: All reports saved to reports/ directory with timestamps
  • Extended Timeouts: Research and analysis agents run with 120-second timeouts for reliable web research
  • Standardized Output: All agents return consistent AgentResult format
  • Timeout Protection: Each agent has configurable timeout
  • Structured State: TypedDict-based state with type safety

Technical Stack

  • LangGraph 1.06 - Workflow orchestration and state management
  • Claude Agent SDK 0.1.20 - AI agent execution
  • Python 3.8+ - Core language
  • Pydantic - Data validation
  • Asyncio - Asynchronous execution

Error Handling

The system includes multiple layers of error handling:

  1. Agent-level: Each agent call wrapped in try-catch with timeout
  2. Node-level: Workflow nodes handle agent failures gracefully
  3. State-level: Errors accumulated in state for debugging
  4. Validation: Research completeness check with retry mechanism

Development

Adding a New Agent

  1. Create agent file in appropriate layer directory
  2. Define agent configuration in src/config/agent_configs.py
  3. Implement agent using run_agent() from src/agents/base.py
  4. Add to agent list in config
  5. Update workflow nodes to include new agent

Modifying the Workflow

Edit src/workflow/graph.py to:

  • Add new nodes
  • Modify edges
  • Update conditional routing
  • Change workflow stages

Performance

Typical execution times with 120s timeouts (depends on agent complexity and API response):

  • Research layer: 60-120 seconds (5 agents in parallel, with web research)
  • Analysis layer: 60-120 seconds (4 agents, 3 parallel + 1 sequential)
  • Synthesis layer: 120-180 seconds (2 agents sequential)
  • Total: ~4-7 minutes for complete analysis

Retry behavior: If research agents fail (less than 50% success rate), the system will automatically retry up to 2 times before proceeding with available data.

Troubleshooting

Common Issues

Agent Timeouts

  • Research and analysis agents have 120-second timeouts
  • If agents consistently timeout, check your internet connection
  • Web research can take longer for less-known companies

Tech Evaluator Failures

  • The Tech Evaluator now has web search tools to research patents and technical details
  • For very new or stealth startups, it will make reasonable estimates based on industry norms

Risk Assessor Failures

  • The Risk Assessor processes up to 8000 characters of context to avoid token limits
  • Ensure at least 50% of research agents succeed to provide adequate data

Validation Counter Issues

  • Fixed in latest version: retry attempts now correctly count only the most recent 5 research outputs
  • Validation no longer accumulates counts across retries

Report Not Saved

  • The reports/ directory is created automatically on first run
  • Check file permissions if saving fails
  • Reports are saved with sanitized company names and timestamps

Limitations

  • Requires active internet connection for research agents
  • API costs scale with usage (especially Opus model)
  • Research quality depends on publicly available information
  • Real-time data may be limited by search capabilities

License

See LICENSE file for details.