dealflow-ai / src /tasks /analysis_tasks.py
PeterBot22's picture
feat: DealFlow AI MVP — 3-agent CrewAI due diligence system on HF Spaces
8dcf472 verified
"""Financial analysis task."""
from __future__ import annotations
from crewai import Agent, Task
def build_financial_analysis_task(
financial_analyst: Agent,
pdf_path: str,
output_dir: str,
context_tasks: list | None = None,
) -> Task:
return Task(
description=f"""
You are performing financial analysis on a startup pitch deck for investment due diligence.
The pitch deck is at: `{pdf_path}`
Save all charts to: `{output_dir}`
## Analysis Required
### 1. Revenue Model Analysis
- Identify the revenue model (SaaS, marketplace, usage-based, etc.)
- Validate unit economics: LTV, CAC, LTV/CAC ratio, payback period
- Assess gross margin assumptions vs. industry benchmarks
### 2. Financial Projection Validation
- Extract 3-5 year revenue projections from the pitch deck
- Calculate implied CAGR and compare to industry norms
- Identify growth assumptions (are they realistic?)
- Flag hockey-stick projections without supporting evidence
### 3. Burn Rate & Runway Analysis
- Identify current/projected monthly burn rate
- Calculate runway from funding ask
- Assess capital efficiency
### 4. Market Sizing Validation
- Validate TAM/SAM/SOM calculations
- Cross-check methodology (top-down vs. bottom-up)
### 5. Chart Generation
Use the chart_generator tool to create:
a) Revenue projection chart (bar chart: years vs. projected revenue)
b) Unit economics comparison chart if data is available
Input format for chart_generator:
```json
{{
"chart_type": "bar",
"title": "Revenue Projections",
"labels": ["Y1", "Y2", "Y3", "Y4", "Y5"],
"values": [100000, 500000, 2000000, 8000000, 25000000],
"output_dir": "{output_dir}"
}}
```
## Output Format
Return a structured financial analysis report with:
- Revenue model assessment (score: 1-10, rationale)
- Projection realism score (1-10, with specific concerns)
- Unit economics assessment
- Burn rate & runway assessment
- Market sizing assessment
- Chart file paths generated
- Top 3 financial red flags
- Top 3 financial strengths
""",
expected_output=(
"A detailed financial analysis report covering revenue model, "
"projection validation, unit economics, burn rate, and market sizing, "
"with generated chart file paths."
),
agent=financial_analyst,
context=context_tasks or [],
)