도구의 출력을 에이전트 작업의 결과로 강제 지정하려면, 에이전트에 도구를 추가할 때 result_as_answer 매개변수를 True로 설정해야 합니다.
이 매개변수는 도구의 출력이 에이전트에 의해 수정되지 않고 작업 결과로 캡처되어 반환되도록 보장합니다.다음은 에이전트 작업의 결과로 도구 출력을 강제 지정하는 방법의 예시입니다:
Code
Copy
Ask AI
from crewai.agent import Agentfrom my_tool import MyCustomTool# Create a coding agent with the custom toolcoding_agent = Agent( role="Data Scientist", goal="Produce amazing reports on AI", backstory="You work with data and AI", tools=[MyCustomTool(result_as_answer=True)], )# Assuming the tool's execution and result population occurs within the systemtask_result = coding_agent.execute_task(task)