Back to snippets
crewai_research_writer_agents_sequential_ai_report.py
pythonA basic research and writing crew that collaborates to produce a technical report
Agent Votes
0
0
crewai_research_writer_agents_sequential_ai_report.py
1import os
2from crewai import Agent, Task, Crew, Process
3
4# Set up your environment variables
5os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
6
7# Define your agents
8researcher = Agent(
9 role='Senior Research Analyst',
10 goal='Uncover cutting-edge developments in AI and data science',
11 backstory="""You work at a leading tech think tank.
12 Your expertise lies in identifying emerging trends.
13 You have a knack for dissecting complex topics into manageable insights.""",
14 verbose=True,
15 allow_delegation=False
16)
17
18writer = Agent(
19 role='Tech Content Strategist',
20 goal='Craft compelling content on tech advancements',
21 backstory="""You are a renowned Content Strategist, known for your insightful and engaging articles.
22 You transform complex concepts into compelling narratives.""",
23 verbose=True,
24 allow_delegation=True
25)
26
27# Create tasks for your agents
28task1 = Task(
29 description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
30 Identify key trends, breakthrough technologies, and potential industry impacts.""",
31 expected_output="Full analysis report in bullet points",
32 agent=researcher
33)
34
35task2 = Task(
36 description="""Using the insights provided, develop an engaging blog post
37 that highlights the most significant AI advancements.
38 Your post should be informative yet accessible, catering to a tech-savvy audience.
39 Make it sound cool, avoid complex jargon until necessary.""",
40 expected_output="Full blog post of at least 4 paragraphs",
41 agent=writer
42)
43
44# Instantiate your crew with a sequential process
45crew = Crew(
46 agents=[researcher, writer],
47 tasks=[task1, task2],
48 verbose=True, # You can set it to 1 or 2 to different logging levels
49 process=Process.sequential
50)
51
52# Get your crew to work!
53result = crew.kickoff()
54
55print("######################")
56print(result)