Spaces:
Sleeping
Sleeping
File size: 10,231 Bytes
848d03e ac6a55a 4f3496f ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 6344f94 ac6a55a 7fb49fa 6344f94 7fb49fa 6344f94 7fb49fa 6344f94 7fb49fa 6344f94 ac6a55a 7fb49fa ac6a55a 3fa668b 6344f94 3fa668b 6344f94 3fa668b 7d395e8 6344f94 ac6a55a 3fa668b ac6a55a 848d03e ac6a55a 848d03e 1efc1d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# agents.py
from crewai import Agent, Crew, Process, Task
from crewai_tools import SerperDevTool, ScrapeWebsiteTool
def create_research_crew(topic: str):
"""Create an advanced research crew with specialized tools"""
try:
# Initialize tools directly - no wrapper needed
search_tool = SerperDevTool()
scrape_tool = ScrapeWebsiteTool()
# Advanced Research Analyst
researcher = Agent(
role='Senior Market Research Analyst',
goal=f'Conduct exhaustive market research about {topic} with detailed data and industry insights',
backstory="""You are a veteran market research analyst with 20+ years of experience.
You excel at uncovering hard-to-find data points, analyzing industry dynamics,
and identifying emerging trends. You have a strong network of industry contacts
and access to premium research databases. You always validate data through
multiple sources and provide confidence levels for your findings.""",
tools=[search_tool, scrape_tool], # Use tools directly
verbose=True
)
# Industry Expert Analyst
analyst = Agent(
role='Industry Expert & Strategy Analyst',
goal='Transform research into strategic insights and actionable recommendations',
backstory="""You are an industry expert with deep domain knowledge and strategic consulting
experience. You specialize in connecting market data to business implications,
forecasting industry changes, and developing strategic recommendations.
Your analysis is always backed by concrete examples and case studies.""",
tools=[search_tool], # Only needs search tool
verbose=True
)
# Professional Report Writer
writer = Agent(
role='Executive Report Writer',
goal='Create compelling, comprehensive market analysis reports',
backstory="""You are an experienced business writer who specializes in creating
executive-level market research reports. You excel at distilling complex
information into clear narratives while maintaining analytical rigor.
You always include relevant examples, case studies, and data visualizations.""",
verbose=True
)
# Create enhanced tasks
research_task = Task(
description=f"""
Conduct comprehensive market research on {topic} with the following focus areas:
1. Market Overview:
- Current market size with specific values
- Historical growth patterns (5-year minimum)
- Future projections with CAGR
- Market segmentation analysis
- Regional market distribution
- Value chain analysis
- Pricing trends and dynamics
2. Competitive Landscape:
- Detailed analysis of top 5-7 players
- Market share breakdown
- Competitive strategies
- Recent developments and initiatives
- SWOT analysis of major players
- Barriers to entry analysis
- Industry concentration metrics
3. Technology & Innovation:
- Current technology trends
- Innovation patterns
- Patent analysis
- R&D investments
- Emerging technologies
- Digital transformation trends
4. Regulatory & Environmental Factors:
- Current regulations
- Upcoming policy changes
- Environmental considerations
- Compliance requirements
- Industry standards
- Certification needs
Requirements:
- Use multiple sources for each data point
- Focus on recent data (last 12 months)
- Include source citations
- Note confidence levels for projections
- Identify any data gaps or inconsistencies
""",
agent=researcher,
expected_output="Comprehensive research data with verified sources and confidence levels"
)
analysis_task = Task(
description="""
=== STRATEGIC ANALYSIS ===
Analyze the research findings to provide comprehensive strategic insights:
1. Industry Analysis
## Porter's Five Forces
- Detailed analysis of each force
- Overall industry attractiveness
- Strategic implications
- Future evolution
## PESTLE Analysis
- Political factors and impacts
- Economic drivers and constraints
- Social and demographic influences
- Technological enablers and threats
- Legal and regulatory framework
- Environmental considerations
2. Growth Vector Analysis
## Market Expansion Opportunities
- Geographic expansion potential
- Segment growth opportunities
- New market opportunities
- Market penetration strategies
## Product/Service Development
- Innovation opportunities
- Feature expansion potential
- Service enhancement areas
- Technology integration possibilities
3. Risk Assessment
## Market Risks
- Competition risks
- Technology risks
- Regulatory risks
- Economic risks
## Mitigation Strategies
- Risk mitigation approaches
- Alternative strategies
- Contingency planning
- Success factors
4. Investment Analysis
## Market Attractiveness
- Investment potential
- ROI analysis
- Payback periods
- Capital requirements
## Success Requirements
- Critical success factors
- Core capabilities needed
- Resource requirements
- Timeline considerations
Requirements:
- Provide detailed analysis for each section
- Include specific examples and case studies
- Support conclusions with data
- Consider multiple scenarios
- Provide actionable insights
- Include expert opinions
""",
agent=analyst,
expected_output="Comprehensive strategic analysis with actionable insights",
context=[research_task]
)
report_task = Task(
description="""
Create a comprehensive market research report following this structure:
=== EXECUTIVE SUMMARY ===
Start with a 2-3 page executive summary that includes:
- Key market findings and insights
- Critical market metrics and highlights
- Major strategic implications
- Core recommendations
- Investment potential
=== MARKET ANALYSIS ===
Provide detailed market analysis covering:
1. Market Overview
- Define market scope and segmentation
- Current market size and valuation
- Historical growth analysis
- Future growth projections
- Key market segments
- Geographic distribution
- Value chain analysis
2. Industry Dynamics
- Growth drivers (with examples)
- Market challenges
- Emerging opportunities
- Current trends
- Technology impact
- Regulatory landscape
3. Competitive Landscape
- Market structure
- Key player profiles
- Market share analysis
- Competitive strategies
- Recent developments
- SWOT analysis
- Case studies
4. Strategic Analysis
- Porter's Five Forces
- Success factors
- Entry barriers
- Risk assessment
- Growth vectors
- Strategic recommendations
=== FUTURE OUTLOOK ===
Provide comprehensive future projections:
- Market forecasts
- Emerging trends
- Technology roadmap
- Future scenarios
- Strategic implications
=== SOURCES AND METHODOLOGY ===
List all sources used and methodology followed.
Requirements:
- Write in clear, professional language
- Use specific numbers and metrics
- Include recent case studies
- Cite 5-10 credible sources
- Provide confidence levels for projections
- Use contextual examples
Structure the content with clear headings (use === for main sections and ## for subsections)
Make it a narrative document that flows well and tells a story about the market. Important: Use the exact section markers (=== and ##) as shown above.
Write detailed content for each section, replacing the placeholders.
""",
agent=writer,
expected_output="A comprehensive narrative market research report with detailed analysis",
context=[research_task, analysis_task]
)
return Crew(
agents=[researcher, analyst, writer],
tasks=[research_task, analysis_task, report_task],
verbose=True,
process=Process.sequential
)
except Exception as e:
raise Exception(f"Error initializing research crew: {str(e)}") |