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

Function kickoff_crew

crewai_be/api.py:24–46  ·  view source on GitHub ↗
(job_id, companies: list[str], positions: list[str])

Source from the content-addressed store, hash-verified

22
23
24def kickoff_crew(job_id, companies: list[str], positions: list[str]):
25 logger.info(f"Crew for job {job_id} is starting")
26
27 results = None
28 try:
29 company_research_crew = CompanyResearchCrew(job_id)
30 company_research_crew.setup_crew(
31 companies, positions)
32 results = company_research_crew.kickoff()
33 logger.info(f"Crew for job {job_id} is complete", results)
34
35 except Exception as e:
36 logger.error(f"Error in kickoff_crew for job {job_id}: {e}")
37 append_event(job_id, f"An error occurred: {e}")
38 with jobs_lock:
39 jobs[job_id].status = 'ERROR'
40 jobs[job_id].result = str(e)
41
42 with jobs_lock:
43 jobs[job_id].status = 'COMPLETE'
44 jobs[job_id].result = results
45 jobs[job_id].events.append(
46 Event(timestamp=datetime.now(), data="Crew complete"))
47
48
49@app.route('/api/crew', methods=['POST'])

Callers

nothing calls this directly

Calls 5

setup_crewMethod · 0.95
kickoffMethod · 0.95
CompanyResearchCrewClass · 0.90
append_eventFunction · 0.90
EventClass · 0.90

Tested by

no test coverage detected