Startup Due Diligence System
This example demonstrates how to get multiple expert perspectives on the same topic using MixtureOfAgents - perfect for comprehensive analysis requiring diverse viewpoints.Step 1: Setup
import requests
import os
API_BASE_URL = "https://api.swarms.world"
API_KEY = os.environ.get("SWARMS_API_KEY", "your_api_key_here")
headers = {
"x-api-key": API_KEY,
"Content-Type": "application/json"
}
Step 2: Define Expert Panel
Create multiple experts who will all analyze the same startup from different perspectives.The API always reuses the last agent in
agents as MixtureOfAgents’ aggregator (in addition to running it as a normal worker on layer 1): it re-invokes that agent with every other agent’s output appended to the task and records the synthesis under that same agent’s name. max_loops sets the number of worker layers (layers), so with the default max_loops: 1 each worker (including the last one) runs once, then the last agent runs a second time to aggregate. Put a dedicated synthesis agent last if you don’t want a domain-specialist prompt reused for aggregation.def run_due_diligence(startup_info: str) -> dict:
"""Run multi-expert due diligence on a startup."""
swarm_config = {
"name": "Startup Due Diligence",
"description": "Multi-expert investment analysis",
"swarm_type": "MixtureOfAgents",
"task": f"""Conduct due diligence analysis for investment consideration:
{startup_info}
Provide your specialized analysis and a score from 1-10.""",
"agents": [
{
"agent_name": "Technical Expert",
"description": "Evaluates technology and engineering",
"system_prompt": """You are a Technical Due Diligence Expert. Analyze:
1. Tech stack (scalability, modernity)
2. Engineering team strength
3. IP and technical moat
4. Technical risks
Provide a TECHNICAL SCORE (1-10) with justification.""",
"model_name": "gpt-4.1",
"max_loops": 1,
"temperature": 0.3
},
{
"agent_name": "Financial Analyst",
"description": "Assesses financials and valuation",
"system_prompt": """You are a Financial Due Diligence Expert. Analyze:
1. Revenue and growth trajectory
2. Unit economics (CAC, LTV, margins)
3. Burn rate and runway
4. Valuation reasonableness
Provide a FINANCIAL SCORE (1-10) with justification.""",
"model_name": "gpt-4.1",
"max_loops": 1,
"temperature": 0.3
},
{
"agent_name": "Market Strategist",
"description": "Evaluates market opportunity",
"system_prompt": """You are a Market Strategy Expert. Analyze:
1. TAM/SAM and market growth
2. Competitive landscape
3. Competitive moat
4. Go-to-market strategy
Provide a MARKET SCORE (1-10) with justification.""",
"model_name": "gpt-4.1",
"max_loops": 1,
"temperature": 0.3
},
{
"agent_name": "Legal Advisor",
"description": "Reviews legal and compliance",
"system_prompt": """You are a Legal Due Diligence Expert. Analyze:
1. Corporate structure
2. Regulatory compliance
3. IP ownership
4. Legal risks
Provide a LEGAL SCORE (1-10) with justification.""",
"model_name": "gpt-4.1",
"max_loops": 1,
"temperature": 0.3
},
{
"agent_name": "Investment Committee Chair",
"description": "Synthesizes all expert analyses into a final verdict",
"system_prompt": """You are the investment committee chair. You will be given the task plus every other expert's analysis. Synthesize them into:
1. A consolidated OVERALL SCORE (1-10)
2. The top 3 cross-cutting risks
3. A final recommendation: Proceed / Negotiate / Pass
Do not repeat each expert's analysis verbatim - synthesize.""",
"model_name": "gpt-4.1",
"max_loops": 1,
"temperature": 0.2
}
],
"max_loops": 1
}
response = requests.post(
f"{API_BASE_URL}/v1/swarm/completions",
headers=headers,
json=swarm_config,
timeout=180
)
return response.json()
Step 3: Run Due Diligence Analysis
import re
# Startup to analyze
startup = """
COMPANY: DataFlow AI
INDUSTRY: Enterprise SaaS / AI
DESCRIPTION: AI-powered data integration platform that automates ETL pipelines using natural language.
DETAILS:
- Founded: 2023
- Stage: Seed
- Funding Sought: $4M
- Team Size: 12
- Revenue: $180K ARR, growing 25% MoM
- Tech Stack: Python, Kubernetes, PostgreSQL, GPT-4 API
- Metrics: 45 paying customers, 92% retention, $4K ACV
- Competitors: Fivetran, Airbyte, dbt, Matillion
"""
# Run analysis
result = run_due_diligence(startup)
# Extract per-expert scores and display
def extract_score(content):
match = re.search(r'score[:\s]+(\d+)/10', content.lower())
return int(match.group(1)) if match else None
# "Investment Committee Chair" is the last agent, so the API reuses it as the
# MixtureOfAgents aggregator: its entry is the synthesized final verdict, not
# an independent expert opinion. Report it separately from the four experts.
CHAIR_NAME = "Investment Committee Chair"
expert_scores = {}
chair_synthesis = None
for output in result.get("output", []):
role = output["role"]
content = output["content"]
if role == CHAIR_NAME:
# Two entries can carry this name (an uninformed layer-1 pass, then
# the real aggregation) - the later one in the list is the synthesis.
chair_synthesis = content
continue
score = extract_score(content)
expert_scores[role] = score
print(f"\n{'='*50}")
print(f"{role.upper()}" + (f" - Score: {score}/10" if score else ""))
print(f"{'='*50}")
print(content[:600] + "...")
print(f"\n{'='*50}")
print("INVESTMENT COMMITTEE CHAIR (synthesis)")
print(f"{'='*50}")
print(chair_synthesis)
print(f"\nTotal cost: ${result['usage']['billing_info']['total_cost']:.4f}")
==================================================
TECHNICAL EXPERT - Score: 7/10
==================================================
TECHNICAL ANALYSIS
Tech Stack Assessment:
- Python + Kubernetes is a solid, scalable foundation
- PostgreSQL appropriate for structured data
- GPT-4 API dependency is a risk factor
Strengths:
- Modern cloud-native architecture
- AI-first approach differentiates from legacy ETL tools
Concerns:
- Heavy reliance on OpenAI API (vendor lock-in, cost)...
==================================================
FINANCIAL ANALYST - Score: 8/10
==================================================
FINANCIAL ANALYSIS
Revenue: $180K ARR with 25% MoM growth is strong for seed stage...
==================================================
INVESTMENT COMMITTEE CHAIR (synthesis)
==================================================
OVERALL SCORE: 7/10
Top risks:
1. Heavy reliance on the OpenAI API for the core product (vendor lock-in, margin risk)
2. Competing against well-funded incumbents (Fivetran, dbt)
3. Burn rate not disclosed relative to the $4M ask
RECOMMENDATION: Negotiate - strong growth and retention, but address API
dependency and provide burn/runway detail before closing.
Total cost: $0.1523
MixtureOfAgents gives you multiple expert perspectives on the same input, then synthesizes them via the last agent in
agents. Each worker sees identical information on layer 1 and analyzes through their specialized lens; on later layers (max_loops > 1) each worker also sees the previous layer’s combined output. agents[-1] runs both as a normal worker and, again, as the aggregator that reads every other agent’s answer.