Hi,
I’ve set up a crew in CrewAI with the following agents and tasks:
Agents:
- Company Research Agent - gathers company data from various sources.
- Reporting Analyst - creates detailed reports based on the data.
Tasks:
- Data Collection Task: Collects information about
{company_name}
. - Report Generation Task: Generates a detailed report with sections like Introduction, Financial Analysis, and Recommendations.
When I run the crew, the output file only saves a summary or conclusioninstead of the full report:
“The comprehensive report on Apple has been completed… It includes all necessary sections like Introduction, Financial Analysis, etc., and provides actionable recommendations.”
But I want the entire detailed report with all sections saved in the file.
I saw in the crew logs that it has a report generated, but it is not saved correctly.
How can I make sure the file contains the full report instead of just a summary?
Here is my crew file:
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
import agentops
import os
from crewai_tools import SerperDevTool, ScrapeWebsiteTool
load_dotenv()
# Retrieve the API key from the environment variables
agentops_api_key = os.getenv("AGENTOPS_API_KEY")
agentops.init(agentops_api_key)
# Uncomment the following line to use an example of a custom tool
# from company_radar.tools.custom_tool import MyCustomTool
# Check our tools documentations for more information on how to use them
@CrewBase
class CompanyRadar():
"""CompanyRadar crew"""
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def company_research_agent(self) -> Agent:
return Agent(
config=self.agents_config['company_research_agent'],
tools=[SerperDevTool(), ScrapeWebsiteTool()], # Include any tools if necessary
verbose=True
)
@agent
def reporting_analyst(self) -> Agent:
return Agent(
config=self.agents_config['reporting_analyst'],
verbose=True
)
@task
def data_collection_task(self) -> Task:
return Task(
config=self.tasks_config['data_collection_task'],
)
@task
def report_generation_task(self) -> Task:
return Task(
config=self.tasks_config['report_generation_task'],
output_file='company_analysis_report.md',
)
@crew
def crew(self) -> Crew:
"""Creates the CompanyRadar crew"""
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
verbose=True,
process=Process.hierarchical,
manager_llm=ChatOpenAI(temperature=0, model="gpt-4o"),
respect_context_window=True, # Enable respect of the context window for tasks
memory=True, # Enable memory usage for enhanced task execution
manager_agent=None, # Optional: explicitly set a specific agent as manager instead of the manager_llm
planning=True, # Enable planning feature for pre-execution strategy
)