Agent not calling tool before giving the final answer

Sometimes agent does not call the tool and give the answer on its own in crew ai.
It just gives out the answer on its own, rather being explicitly told that it has to use the tool.

Also, I added this line as the first line in the task, also i tried changing prompts a lot
NOTE: VERY IMPORTANT: Before giving the final answer always call the tool GOOGLECALENDAR_FIND_FREE_SLOTS.
also i have only 5000 tokens in my task, still it is halucinating a lot. Also, i tried using different models like 4o, o1-mini, o1-preview.

1 Like

Hi mate, see docs page, there is a param you config for the tool result:

You may need an extra agent/task to handle the raw output, but this is how you get it work every time. Also temp=0 is best for this kind of agent; you want 0 randomness and just tool execution

Please share your code implementation so we can better troubleshoot.