'Write a book' flow hallucinates part of the references when asked for providing those

Hi CrewAI community,

CrewAI is a great framework and the examples provided on Github offer a good starting point.

When using the ‘Write a book flow’ example from Github (crewAI-examples/write_a_book_with_flows at main · crewAIInc/crewAI-examples · GitHub) and adds to the goal of the writer agent in the write-book-chapter crew that it should include citations and a reference list at the end of chapter, I noticed that in some cases parts of the references are hallucinated/wrong. This is absolutely unnecessary since the SerperDevTool provides accurate sources via the web search, but somehow while the title of the reference article is correct, sometimes the outlet or the authors or the year could be wrong.

In addition, I would like to mention that if I want to add another crew (e.g. with the aim to review the information for accuracy), it is not straightforward to achieve that. The CrewAI framework got more elaborate recently but while the framework structure can be created rather easily using ‘crewai create crew name_project’, expanding it is less easy. A new crew can be added to the flow using ‘crewai flow add-crew crew_name’ but modifying the logic in the main.py file is much more involved. More tutorials and guidance on that aspect would be helpful.

@Ben You can force tool output as a result by setting the result_as_answer parameter to True. Try the following:

from crewai.agent import Agent
from crewai_tools import SerperDevTool

my_agent = Agent(
    ...,
    tools=[SerperDevTool(result_as_answer=True)],
)

Thank you very much @rokbenko for the reply, I had not seen this on the CrewAI page!

Do you have, by any chance, suggestions on how to approach modifying the main.py file after adding another crew to flows - beyond what is described here?

Simply use a decorator (e.g., @listen) and kickoff as many crews as you want in the main.py file. I built the Podcast Prepper project in the past. Take a look at how I handled two crews (i.e., GuestResearchCrew and QuestionsResearchCrew) in the main.py file. You can check out my YouTube tutorial for a detailed walkthrough of the Podcast Prepper.