It's time to build the functionality for our agent to run arbitrary Python code.
Now, it's worth pausing to point out the inherent security risks here. We have a few things going for us:
We'll only allow the LLM to run code in a specific directory (the working_directory).
We'll use a 30-second timeout to prevent it from running indefinitely.
But aside from that... yes, the LLM can run arbitrary code that we place (or it places) in the working directory... so be careful. As long as you use this AI agent only for the simple tasks we're doing in this course, you should be just fine.
Do not give this program to others for them to use! It doesn't have all the security and safety features that a production AI agent would have. This is for learning purposes only.