MCPcopy Create free account
hub / github.com/bhancockio/nextjs-crewai-basic-tutorial / CompanyResearchTasks

Class CompanyResearchTasks

crewai_be/tasks.py:10–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class CompanyResearchTasks():
11
12 def __init__(self, job_id):
13 self.job_id = job_id
14
15 def append_event_callback(self, task_output):
16 logger.info("Callback called: %s", task_output)
17 append_event(self.job_id, task_output.exported_output)
18
19 def manage_research(self, agent: Agent, companies: list[str], positions: list[str], tasks: list[Task]):
20 return Task(
21 description=dedent(f"""Based on the list of companies {companies} and the positions {positions},
22 use the results from the Company Research Agent to research each position in each company.
23 to put together a json object containing the URLs for 3 blog articles, the URLs and title
24 for 3 YouTube interviews for each position in each company.
25
26 """),
27 agent=agent,
28 expected_output=dedent(
29 """A json object containing the URLs for 3 blog articles and the URLs and
30 titles for 3 YouTube interviews for each position in each company."""),
31 callback=self.append_event_callback,
32 context=tasks,
33 output_json=PositionInfoList
34 )
35
36 def company_research(self, agent: Agent, company: str, positions: list[str]):
37 return Task(
38 description=dedent(f"""Research the position {positions} for the {company} company.
39 For each position,
40
41 nd the URLs for 3 recent blog articles and the URLs and titles for
42 3 recent YouTube interviews for the person in each position.
43 Return this collected information in a JSON object.
44
45 Helpful Tips:
46 - To find the blog articles names and URLs, perform searches on Google such like the following:
47 - "{company} [POSITION HERE] blog articles"
48 - To find the youtube interviews, perform searches on YouTube such as the following:
49 - "{company} [POSITION HERE] interview"
50
51 Important:
52 - Once you've found the information, immediately stop searching for additional information.
53 - Only return the requested information. NOTHING ELSE!
54 - Do not generate fake information. Only return the information you find. Nothing else!
55 - Do not stop researching until you find the requested information for each position in the company.
56 """),
57 agent=agent,
58 expected_output="""A JSON object containing the researched information for each position in the company.""",
59 callback=self.append_event_callback,
60 output_json=PositionInfo,
61 async_execution=True
62 )

Callers 1

setup_crewMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected