-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrew_definition.py
More file actions
46 lines (40 loc) · 1.5 KB
/
Copy pathcrew_definition.py
File metadata and controls
46 lines (40 loc) · 1.5 KB
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
from crewai import Agent, Crew, Task
from logging_config import get_logger
class ResearchCrew:
def __init__(self, verbose=True, logger=None):
self.verbose = verbose
self.logger = logger or get_logger(__name__)
self.crew = self.create_crew()
self.logger.info("ResearchCrew initialized")
def create_crew(self):
self.logger.info("Creating research crew with agents")
researcher = Agent(
role='Research Analyst',
goal='Find and analyze key information',
backstory='Expert at extracting information',
verbose=self.verbose
)
writer = Agent(
role='Content Summarizer',
goal='Create clear summaries from research',
backstory='Skilled at transforming complex information',
verbose=self.verbose
)
self.logger.info("Created research and writer agents")
crew = Crew(
agents=[researcher, writer],
tasks=[
Task(
description='Research: {text}',
expected_output='Detailed research findings about the topic',
agent=researcher
),
Task(
description='Write summary',
expected_output='Clear and concise summary of the research findings',
agent=writer
)
]
)
self.logger.info("Crew setup completed")
return crew