import os
from swarms_client import SwarmsClient
from dotenv import load_dotenv
load_dotenv()
client = SwarmsClient(api_key=os.getenv("SWARMS_API_KEY"))
# Define a complex business analysis task
business_analysis_task = """
A tech startup is considering expanding into the European market. They currently operate in North America
and have the following characteristics:
- SaaS product with $2M ARR
- 50-person team
- B2B focus on mid-market companies
- Strong growth (200% YoY)
- Limited international experience
Analyze the expansion opportunity and provide comprehensive recommendations including market analysis,
operational considerations, financial projections, and risk assessment.
"""
# Create a multi-agent system for comprehensive business analysis
expansion_analysis = client.swarms.run(
name="EU Market Expansion Analysis",
description="Multi-agent system for comprehensive market expansion analysis",
swarm_type="SequentialWorkflow",
task=business_analysis_task,
agents=[
{
"agent_name": "Market Research Specialist",
"description": "Analyzes target markets, competition, and opportunities",
"system_prompt": """You are a senior market research analyst with deep expertise in European markets
and SaaS business models. Analyze market size, competitive landscape, regulatory
considerations, and customer segments. Provide data-driven insights about market
entry strategies and potential challenges.""",
"model_name": "groq/openai/gpt-oss-120b",
"role": "researcher",
"max_loops": 1,
"max_tokens": 6144,
"temperature": 0.2,
},
{
"agent_name": "Operations Strategist",
"description": "Evaluates operational requirements and implementation strategies",
"system_prompt": """You are an operations strategy consultant specializing in international expansion
for tech companies. Focus on operational requirements, team structure, legal and
compliance needs, technology infrastructure, and implementation timeline. Consider
both challenges and solutions for scaling operations internationally.""",
"model_name": "groq/openai/gpt-oss-120b",
"role": "strategist",
"max_loops": 1,
"max_tokens": 6144,
"temperature": 0.3,
},
{
"agent_name": "Financial Analyst",
"description": "Provides financial modeling and investment analysis",
"system_prompt": """You are a senior financial analyst with expertise in SaaS metrics and international
expansion financial modeling. Develop financial projections, analyze investment
requirements, assess ROI potential, and identify key financial risks and opportunities.
Focus on realistic scenarios and key financial assumptions.""",
"model_name": "groq/openai/gpt-oss-120b",
"role": "financial_analyst",
"max_loops": 1,
"max_tokens": 6144,
"temperature": 0.2,
},
{
"agent_name": "Risk Assessment Specialist",
"description": "Evaluates potential risks and mitigation strategies",
"system_prompt": """You are a risk management consultant specializing in international business expansion.
Identify and analyze potential risks including market risks, operational risks,
financial risks, regulatory risks, and competitive risks. For each risk identified,
provide specific mitigation strategies and contingency planning recommendations.""",
"model_name": "groq/openai/gpt-oss-120b",
"role": "risk_analyst",
"max_loops": 1,
"max_tokens": 5120,
"temperature": 0.3,
},
{
"agent_name": "Strategic Synthesizer",
"description": "Combines insights from all agents into cohesive recommendations",
"system_prompt": """You are a senior strategy consultant who synthesizes complex analysis from multiple
sources into clear, actionable recommendations. Review all previous analyses and create
a comprehensive strategic recommendation that includes executive summary, key findings,
recommended approach, timeline, resource requirements, and success metrics.""",
"model_name": "groq/openai/gpt-oss-120b",
"role": "synthesizer",
"max_loops": 1,
"max_tokens": 8192,
"temperature": 0.4,
}
],
)
print("Comprehensive Business Analysis:")
print(expansion_analysis)