Kickoff Crew for Each Item in a List
kickoff_for_each()
from crewai import Crew, Agent, Task # 코드 실행이 가능한 에이전트 생성 coding_agent = Agent( role="Python 데이터 분석가", goal="Python을 사용해 데이터를 분석하고 인사이트 제공", backstory="강력한 Python 스킬을 가진 경험 많은 데이터 분석가다.", allow_code_execution=True ) # 코드 실행이 필요한 태스크 생성 data_analysis_task = Task( description="주어진 데이터셋을 분석하고 참가자의 평균 나이를 계산한다. 나이: {ages}", agent=coding_agent, expected_output="데이터셋에서 계산된 평균 나이" ) # 크루 생성 및 태스크 추가 analysis_crew = Crew( agents=[coding_agent], tasks=[data_analysis_task], verbose=True, memory=False, respect_context_window=True # 기본적으로 활성화 ) datasets = [ { "ages": [25, 30, 35, 40, 45] }, { "ages": [20, 25, 30, 35, 40] }, { "ages": [30, 35, 40, 45, 50] } ] # 크루 실행 result = analysis_crew.kickoff_for_each(inputs=datasets)