Update agents.py
Browse files
agents.py
CHANGED
|
@@ -11,88 +11,78 @@ def create_research_crew(topic: str, questions: list):
|
|
| 11 |
researcher = Agent(
|
| 12 |
role='Market Researcher',
|
| 13 |
goal=f"""Research the {topic} market comprehensively.
|
| 14 |
-
|
|
|
|
| 15 |
backstory="""Expert market researcher with extensive experience in industry analysis.
|
| 16 |
Skilled at finding and validating market data from multiple sources.""",
|
| 17 |
tools=tools,
|
| 18 |
llm=llm,
|
| 19 |
-
max_iterations=2,
|
| 20 |
verbose=True
|
| 21 |
)
|
| 22 |
|
| 23 |
analyst = Agent(
|
| 24 |
role='Data Analyst',
|
| 25 |
-
goal=f"""Analyze market data for {topic}
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
3. Regional distribution
|
| 29 |
-
4. Trend analysis
|
| 30 |
-
5. Future projections
|
| 31 |
-
|
| 32 |
-
Address these questions in your analysis: {', '.join(questions)}""",
|
| 33 |
backstory="Senior data analyst specializing in market trends and competitive analysis",
|
| 34 |
tools=tools,
|
| 35 |
llm=llm,
|
| 36 |
-
max_iterations=2,
|
| 37 |
verbose=True
|
| 38 |
)
|
| 39 |
|
| 40 |
writer = Agent(
|
| 41 |
role='Report Writer',
|
| 42 |
-
goal=f"""Create a comprehensive report on {topic}
|
| 43 |
-
|
| 44 |
-
2. Incorporates research findings and analysis
|
| 45 |
-
3. Provides actionable insights
|
| 46 |
-
4. Includes visual data representations
|
| 47 |
-
5. Maintains professional tone and structure""",
|
| 48 |
backstory="Professional report writer with expertise in market research",
|
| 49 |
llm=llm,
|
| 50 |
-
max_iterations=2,
|
| 51 |
verbose=True
|
| 52 |
)
|
| 53 |
|
| 54 |
tasks = [
|
| 55 |
Task(
|
| 56 |
-
description=f"""Research {topic}
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
Include specific numbers and statistics.""",
|
| 66 |
agent=researcher,
|
| 67 |
-
expected_output="Detailed market research data
|
| 68 |
),
|
| 69 |
Task(
|
| 70 |
-
description=f"""Analyze the research data
|
| 71 |
-
1.
|
| 72 |
-
2.
|
| 73 |
-
3.
|
| 74 |
-
4.
|
| 75 |
-
5.
|
| 76 |
|
| 77 |
-
|
| 78 |
-
Create visualizations for key metrics.""",
|
| 79 |
agent=analyst,
|
| 80 |
-
expected_output="
|
| 81 |
),
|
| 82 |
Task(
|
| 83 |
-
description=f"""Write comprehensive report
|
| 84 |
-
1.
|
| 85 |
-
2.
|
| 86 |
-
3.
|
| 87 |
-
4.
|
| 88 |
-
5.
|
| 89 |
-
6.
|
| 90 |
-
7.
|
|
|
|
| 91 |
|
| 92 |
-
|
| 93 |
-
Include data visualizations and key metrics.""",
|
| 94 |
agent=writer,
|
| 95 |
-
expected_output="
|
| 96 |
)
|
| 97 |
]
|
| 98 |
|
|
|
|
| 11 |
researcher = Agent(
|
| 12 |
role='Market Researcher',
|
| 13 |
goal=f"""Research the {topic} market comprehensively.
|
| 14 |
+
Search for and collect real market data including market size, growth rates, key players, and trends.
|
| 15 |
+
Specifically address these questions: {', '.join(questions)}""",
|
| 16 |
backstory="""Expert market researcher with extensive experience in industry analysis.
|
| 17 |
Skilled at finding and validating market data from multiple sources.""",
|
| 18 |
tools=tools,
|
| 19 |
llm=llm,
|
| 20 |
+
max_iterations=2,
|
| 21 |
verbose=True
|
| 22 |
)
|
| 23 |
|
| 24 |
analyst = Agent(
|
| 25 |
role='Data Analyst',
|
| 26 |
+
goal=f"""Analyze the collected market data for {topic}.
|
| 27 |
+
Create insights from the research data.
|
| 28 |
+
Ensure to answer: {', '.join(questions)}""",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
backstory="Senior data analyst specializing in market trends and competitive analysis",
|
| 30 |
tools=tools,
|
| 31 |
llm=llm,
|
| 32 |
+
max_iterations=2,
|
| 33 |
verbose=True
|
| 34 |
)
|
| 35 |
|
| 36 |
writer = Agent(
|
| 37 |
role='Report Writer',
|
| 38 |
+
goal=f"""Create a comprehensive report on {topic} using the research and analysis provided.
|
| 39 |
+
Focus on answering: {', '.join(questions)}""",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
backstory="Professional report writer with expertise in market research",
|
| 41 |
llm=llm,
|
| 42 |
+
max_iterations=2,
|
| 43 |
verbose=True
|
| 44 |
)
|
| 45 |
|
| 46 |
tasks = [
|
| 47 |
Task(
|
| 48 |
+
description=f"""Research the {topic} market:
|
| 49 |
+
1. Use web search to find current market data
|
| 50 |
+
2. Focus on recent market statistics and trends
|
| 51 |
+
3. Find information about key players and their market shares
|
| 52 |
+
4. Research regional market distribution
|
| 53 |
+
5. Look for recent industry developments
|
| 54 |
+
6. Address these specific questions: {', '.join(questions)}
|
| 55 |
|
| 56 |
+
Format the research with clear sections for market size, players, trends, and regional analysis.""",
|
|
|
|
| 57 |
agent=researcher,
|
| 58 |
+
expected_output="Detailed market research data"
|
| 59 |
),
|
| 60 |
Task(
|
| 61 |
+
description=f"""Analyze the research data:
|
| 62 |
+
1. Process the market size and growth figures
|
| 63 |
+
2. Analyze competitive landscape
|
| 64 |
+
3. Identify key trends and patterns
|
| 65 |
+
4. Create regional breakdown
|
| 66 |
+
5. Address these questions: {', '.join(questions)}
|
| 67 |
|
| 68 |
+
Format the analysis with clear sections and data points.""",
|
|
|
|
| 69 |
agent=analyst,
|
| 70 |
+
expected_output="Market analysis with insights"
|
| 71 |
),
|
| 72 |
Task(
|
| 73 |
+
description=f"""Write a comprehensive report using the research and analysis:
|
| 74 |
+
1. Create executive summary
|
| 75 |
+
2. Detail market overview
|
| 76 |
+
3. Describe competitive landscape
|
| 77 |
+
4. Explain market trends
|
| 78 |
+
5. Provide regional analysis
|
| 79 |
+
6. Make future projections
|
| 80 |
+
7. Add strategic recommendations
|
| 81 |
+
8. Answer these questions: {', '.join(questions)}
|
| 82 |
|
| 83 |
+
Format as a professional report with clear sections.""",
|
|
|
|
| 84 |
agent=writer,
|
| 85 |
+
expected_output="Final market research report"
|
| 86 |
)
|
| 87 |
]
|
| 88 |
|