Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -167,86 +167,238 @@ def create_research_crew(topic: str):
|
|
| 167 |
search_tool = SerperDevTool()
|
| 168 |
log_agent_activity("System", "Initialized SerperDev search tool")
|
| 169 |
|
| 170 |
-
|
| 171 |
role='Research Analyst',
|
| 172 |
-
goal=f'Conduct
|
| 173 |
-
backstory="""You are
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
| 175 |
tools=[search_tool],
|
| 176 |
verbose=True
|
| 177 |
)
|
| 178 |
|
| 179 |
analyst = Agent(
|
| 180 |
role='Data Analyst',
|
| 181 |
-
goal='Transform research data into
|
| 182 |
-
backstory="""You are
|
| 183 |
-
data
|
|
|
|
|
|
|
|
|
|
| 184 |
tools=[search_tool],
|
| 185 |
verbose=True
|
| 186 |
)
|
| 187 |
|
| 188 |
writer = Agent(
|
| 189 |
role='Report Writer',
|
| 190 |
-
goal='Create professional market research reports with
|
| 191 |
-
backstory="You are
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
verbose=True
|
| 193 |
)
|
| 194 |
|
| 195 |
research_task = Task(
|
| 196 |
description=f"""
|
| 197 |
-
Conduct
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
""",
|
| 205 |
agent=researcher,
|
| 206 |
-
expected_output="
|
| 207 |
)
|
| 208 |
|
| 209 |
analysis_task = Task(
|
| 210 |
description=f"""
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
""",
|
| 219 |
agent=analyst,
|
| 220 |
-
expected_output="
|
| 221 |
context=[research_task]
|
| 222 |
)
|
| 223 |
|
| 224 |
report_task = Task(
|
| 225 |
description=f"""
|
| 226 |
-
Create
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
Format as JSON:
|
| 232 |
{{
|
| 233 |
"exec_summary": {{
|
| 234 |
-
"summary": "
|
| 235 |
-
"market_size": "
|
| 236 |
-
"growth_rate": "
|
| 237 |
-
"key_players": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
}},
|
| 239 |
-
"detailed_report": "text",
|
| 240 |
"sources": ["source1", "source2"],
|
| 241 |
"metrics": {{
|
| 242 |
"market_size_data": [],
|
| 243 |
"growth_rates": [],
|
| 244 |
-
"market_shares":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
}}
|
| 246 |
}}
|
| 247 |
""",
|
| 248 |
agent=writer,
|
| 249 |
-
expected_output="JSON containing executive summary and
|
| 250 |
context=[research_task, analysis_task]
|
| 251 |
)
|
| 252 |
|
|
|
|
| 167 |
search_tool = SerperDevTool()
|
| 168 |
log_agent_activity("System", "Initialized SerperDev search tool")
|
| 169 |
|
| 170 |
+
researcher = Agent(
|
| 171 |
role='Research Analyst',
|
| 172 |
+
goal=f'Conduct exhaustive market research about {topic} with comprehensive analysis and multiple data sources',
|
| 173 |
+
backstory="""You are a senior market research analyst with 15+ years of experience in conducting
|
| 174 |
+
detailed industry analysis. You excel at gathering in-depth market data, analyzing industry trends,
|
| 175 |
+
and identifying market patterns through multiple verified sources. You always ensure data accuracy
|
| 176 |
+
and provide contextual analysis alongside raw data. You're known for producing comprehensive
|
| 177 |
+
research reports that combine quantitative data with qualitative insights.""",
|
| 178 |
tools=[search_tool],
|
| 179 |
verbose=True
|
| 180 |
)
|
| 181 |
|
| 182 |
analyst = Agent(
|
| 183 |
role='Data Analyst',
|
| 184 |
+
goal='Transform research data into profound market insights with detailed analysis and visualizations',
|
| 185 |
+
backstory="""You are an expert data analyst and market intelligence specialist with deep expertise
|
| 186 |
+
in converting complex market data into actionable insights. You specialize in predictive analytics,
|
| 187 |
+
trend analysis, and creating data visualizations that tell compelling stories. You have a
|
| 188 |
+
track record of identifying hidden market opportunities and providing nuanced analysis of market dynamics.
|
| 189 |
+
You excel at breaking down complex market phenomena into understandable insights.""",
|
| 190 |
tools=[search_tool],
|
| 191 |
verbose=True
|
| 192 |
)
|
| 193 |
|
| 194 |
writer = Agent(
|
| 195 |
role='Report Writer',
|
| 196 |
+
goal='Create extensive, professional market research reports with compelling narratives and insights',
|
| 197 |
+
backstory="""You are a seasoned business writer and market research expert who specializes in creating
|
| 198 |
+
comprehensive, engaging market research reports. You excel at weaving data and insights into compelling
|
| 199 |
+
narratives that provide deep understanding of market dynamics. You're skilled at creating well-structured,
|
| 200 |
+
detailed reports that maintain reader engagement while delivering thorough analysis. You're known for your
|
| 201 |
+
ability to explain complex market dynamics in clear, professional language while maintaining attention to detail.""",
|
| 202 |
verbose=True
|
| 203 |
)
|
| 204 |
|
| 205 |
research_task = Task(
|
| 206 |
description=f"""
|
| 207 |
+
Conduct exhaustive market research on {topic} with:
|
| 208 |
+
|
| 209 |
+
1. Comprehensive Market Overview:
|
| 210 |
+
- Detailed market size analysis (historical, current, and projected)
|
| 211 |
+
- Growth rates and CAGR with supporting rationale
|
| 212 |
+
- Market segmentation analysis (by type, application, region, etc.)
|
| 213 |
+
- Value chain analysis
|
| 214 |
+
- Pricing analysis and trends
|
| 215 |
+
- Regional market breakdowns with specific data points
|
| 216 |
+
- Key market metrics and KPIs
|
| 217 |
+
|
| 218 |
+
2. In-depth Competitive Analysis:
|
| 219 |
+
- Detailed profiles of key players
|
| 220 |
+
- Market share analysis with historical trends
|
| 221 |
+
- Competitive strategies and positioning
|
| 222 |
+
- Recent developments and their impact
|
| 223 |
+
- SWOT analysis of major players
|
| 224 |
+
- Competitive advantages and differentiators
|
| 225 |
+
- Market concentration and fragmentation analysis
|
| 226 |
+
|
| 227 |
+
3. Extensive Market Dynamics:
|
| 228 |
+
- Detailed analysis of growth drivers with specific examples
|
| 229 |
+
- Comprehensive examination of market challenges
|
| 230 |
+
- Emerging trends with supporting data
|
| 231 |
+
- Regulatory landscape and its impact
|
| 232 |
+
- Technology impact assessment
|
| 233 |
+
- Patent analysis and innovation trends
|
| 234 |
+
- Consumer behavior analysis
|
| 235 |
+
- Supply-demand gap analysis
|
| 236 |
+
|
| 237 |
+
4. Economic and External Factors:
|
| 238 |
+
- Macroeconomic influences
|
| 239 |
+
- Industry-specific economic indicators
|
| 240 |
+
- Global and regional economic impacts
|
| 241 |
+
- Trade dynamics and supply chain analysis
|
| 242 |
+
- Investment patterns and M&A activity
|
| 243 |
+
|
| 244 |
+
Use multiple sources for verification and cross-reference all data points.
|
| 245 |
+
Include case studies and specific examples where relevant.
|
| 246 |
+
Provide rich context for all numerical data.
|
| 247 |
+
Format all data to be visualization-ready.
|
| 248 |
""",
|
| 249 |
agent=researcher,
|
| 250 |
+
expected_output="Exhaustive research data with comprehensive analysis and verified sources"
|
| 251 |
)
|
| 252 |
|
| 253 |
analysis_task = Task(
|
| 254 |
description=f"""
|
| 255 |
+
Perform comprehensive analysis of the research findings:
|
| 256 |
+
|
| 257 |
+
1. Strategic Market Analysis:
|
| 258 |
+
- Detailed 5-year growth projections with scenario analysis
|
| 259 |
+
- Market maturity assessment
|
| 260 |
+
- Porter's Five Forces analysis
|
| 261 |
+
- Market attractiveness analysis
|
| 262 |
+
- Investment opportunity assessment
|
| 263 |
+
- Risk analysis and mitigation strategies
|
| 264 |
+
|
| 265 |
+
2. Advanced Data Analysis:
|
| 266 |
+
- Time series analysis of key metrics
|
| 267 |
+
- Correlation analysis between market factors
|
| 268 |
+
- Market share evolution analysis
|
| 269 |
+
- Price sensitivity analysis
|
| 270 |
+
- Demand forecasting models
|
| 271 |
+
- Regional market potential assessment
|
| 272 |
+
- Market penetration analysis
|
| 273 |
+
|
| 274 |
+
3. Competitive Intelligence:
|
| 275 |
+
- Detailed competitor benchmarking
|
| 276 |
+
- Market positioning matrix
|
| 277 |
+
- Strategic group mapping
|
| 278 |
+
- Competitive strategy analysis
|
| 279 |
+
- Market entry barriers assessment
|
| 280 |
+
- Future competitive scenarios
|
| 281 |
+
|
| 282 |
+
4. Trend Analysis:
|
| 283 |
+
- Technology adoption curves
|
| 284 |
+
- Consumer trend analysis
|
| 285 |
+
- Innovation impact assessment
|
| 286 |
+
- Market disruption analysis
|
| 287 |
+
- Future market scenarios
|
| 288 |
+
- Emerging opportunities assessment
|
| 289 |
+
|
| 290 |
+
Create visualization-ready data for:
|
| 291 |
+
- Market size and growth trends
|
| 292 |
+
- Competitive landscape maps
|
| 293 |
+
- Regional distribution charts
|
| 294 |
+
- Market share evolution
|
| 295 |
+
- Value chain analysis
|
| 296 |
+
- Technology adoption curves
|
| 297 |
+
- Price trend analysis
|
| 298 |
+
- Market segmentation
|
| 299 |
+
- Key player comparison matrices
|
| 300 |
+
|
| 301 |
+
Include specific metrics, percentages, and growth rates.
|
| 302 |
+
Provide context and implications for all analyses.
|
| 303 |
+
Format data for multiple visualization types.
|
| 304 |
""",
|
| 305 |
agent=analyst,
|
| 306 |
+
expected_output="Comprehensive analysis with visualization-ready metrics and detailed insights",
|
| 307 |
context=[research_task]
|
| 308 |
)
|
| 309 |
|
| 310 |
report_task = Task(
|
| 311 |
description=f"""
|
| 312 |
+
Create an extensive professional report including:
|
| 313 |
+
|
| 314 |
+
1. Executive Summary (3-4 pages):
|
| 315 |
+
- Key findings and insights
|
| 316 |
+
- Critical market metrics
|
| 317 |
+
- Major trends and developments
|
| 318 |
+
- Strategic implications
|
| 319 |
+
- Investment opportunities
|
| 320 |
+
- Future outlook
|
| 321 |
+
- Key recommendations
|
| 322 |
+
|
| 323 |
+
2. Comprehensive Market Analysis (15-20 pages):
|
| 324 |
+
a) Market Overview
|
| 325 |
+
- Market definition and segmentation
|
| 326 |
+
- Market size and growth analysis
|
| 327 |
+
- Value chain analysis
|
| 328 |
+
- Market structure and dynamics
|
| 329 |
+
- Regional market analysis
|
| 330 |
+
- Pricing analysis
|
| 331 |
+
|
| 332 |
+
b) Competitive Landscape
|
| 333 |
+
- Market share analysis
|
| 334 |
+
- Key player profiles
|
| 335 |
+
- Competitive strategies
|
| 336 |
+
- Market positioning
|
| 337 |
+
- SWOT analysis
|
| 338 |
+
- Recent developments
|
| 339 |
+
|
| 340 |
+
c) Market Dynamics
|
| 341 |
+
- Growth drivers analysis
|
| 342 |
+
- Market challenges
|
| 343 |
+
- Opportunity assessment
|
| 344 |
+
- Trend analysis
|
| 345 |
+
- Technology impact
|
| 346 |
+
- Regulatory framework
|
| 347 |
+
|
| 348 |
+
d) Future Outlook
|
| 349 |
+
- Market forecasts
|
| 350 |
+
- Trend projections
|
| 351 |
+
- Scenario analysis
|
| 352 |
+
- Strategic recommendations
|
| 353 |
+
- Risk analysis
|
| 354 |
+
- Success factors
|
| 355 |
+
|
| 356 |
+
3. Appendices
|
| 357 |
+
- Detailed methodology
|
| 358 |
+
- Data tables
|
| 359 |
+
- Additional charts and graphs
|
| 360 |
+
- Case studies
|
| 361 |
+
- Glossary
|
| 362 |
+
- Sources and citations
|
| 363 |
+
|
| 364 |
Format as JSON:
|
| 365 |
{{
|
| 366 |
"exec_summary": {{
|
| 367 |
+
"summary": "comprehensive executive overview",
|
| 368 |
+
"market_size": "detailed market size analysis",
|
| 369 |
+
"growth_rate": "detailed growth projections",
|
| 370 |
+
"key_players": "detailed competitive analysis",
|
| 371 |
+
"critical_insights": "key strategic insights",
|
| 372 |
+
"recommendations": "strategic recommendations"
|
| 373 |
+
}},
|
| 374 |
+
"detailed_report": {{
|
| 375 |
+
"market_overview": "comprehensive market analysis",
|
| 376 |
+
"competitive_landscape": "detailed competitive analysis",
|
| 377 |
+
"market_dynamics": "in-depth market dynamics",
|
| 378 |
+
"future_outlook": "detailed projections and scenarios",
|
| 379 |
+
"strategic_implications": "strategic analysis and recommendations"
|
| 380 |
}},
|
|
|
|
| 381 |
"sources": ["source1", "source2"],
|
| 382 |
"metrics": {{
|
| 383 |
"market_size_data": [],
|
| 384 |
"growth_rates": [],
|
| 385 |
+
"market_shares": {{}},
|
| 386 |
+
"regional_distribution": [],
|
| 387 |
+
"segment_analysis": [],
|
| 388 |
+
"competitor_metrics": {},
|
| 389 |
+
"trend_indicators": []
|
| 390 |
+
}},
|
| 391 |
+
"visualizations": {{
|
| 392 |
+
"market_growth": "time series data",
|
| 393 |
+
"competitive_landscape": "positioning data",
|
| 394 |
+
"regional_analysis": "geographical data",
|
| 395 |
+
"segment_breakdown": "segmentation data",
|
| 396 |
+
"trend_analysis": "trend indicators"
|
| 397 |
}}
|
| 398 |
}}
|
| 399 |
""",
|
| 400 |
agent=writer,
|
| 401 |
+
expected_output="Comprehensive JSON containing detailed executive summary and full report",
|
| 402 |
context=[research_task, analysis_task]
|
| 403 |
)
|
| 404 |
|