Can CrewAI write and execute ML code?

Hi,

I am trying to model the Iris dataset using CrewAI. I have an agent to read the input file data, then pass the table to a data science agent who is to create and execute a classification neural network model to model the data, and then output the results. Is this possible without having to write the NN as a function for the agent to call? Instead I am interested to see if the agent can do this all by itself.

I have been trying, however it really struggles to write and execute the code by itself. It would be nice if there was a cookbook somewhere for how to leverage the allow_code_execution ability of the agents properly.

Thx

I haven’t had much luck with allow_code_execution but I think you would need an LLM that is strong at generating good code eg Claude Sonnet 3.5 or later.

You could try to be a bit more explicit in your prompts to guide the agent on what you need it to do. If you manage to get it working properly share your secret :sweat_smile:

I am currently using GPT-4o. I think that should be strong enough,