saikanov's picture
Update src/tech_news/crew.py
e6815e5 verified
from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import SerperDevTool , ScrapeWebsiteTool
# Uncomment the following line to use an example of a custom tool
# from tech_news.tools.custom_tool import MyCustomTool
# Check our tools documentations for more information on how to use them
# from crewai_tools import SerperDevTool
@CrewBase
class TechNewsCrew():
"""TechNews crew"""
@agent
def tech_news_enthusiast(self) -> Agent:
return Agent(
config=self.agents_config['tech_news_enthusiast'],
verbose=True,
tools=[
SerperDevTool(n_results=10)
]
)
@agent
def tech_article_curator(self) -> Agent:
return Agent(
config=self.agents_config['tech_article_curator'],
tools=[ScrapeWebsiteTool()],
verbose=True
)
@agent
def tech_news_reporter(self) -> Agent:
return Agent(
config=self.agents_config['tech_news_reporter'],
verbose=True
)
@task
def tech_news_enthusiast_task(self) -> Task:
return Task(
config=self.tasks_config['tech_news_enthusiast_task'],
)
@task
def tech_curator_task(self) -> Task:
return Task(
config=self.tasks_config['tech_curator_task']
)
@task
def tech_reporter_task(self) -> Task:
return Task(
config=self.tasks_config['tech_reporter_task']
)
@crew
def crew(self) -> Crew:
"""Creates the TechNews crew"""
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
process=Process.sequential,
verbose=True,
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
)