Skip to content

Agents deserve freedom! Freedom is a driving force for creativity! #1259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
10 changes: 10 additions & 0 deletions src/smolagents/local_python_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ def nodunder_getattr(obj, name, default=None):
"posix.system",
]

def local_python_executor_allow_all():
""" This function allows all imports and functions to be executed locally.
BE CAREFUL - Only allow all in an isolated and crontolled environment.
USE IT AT YOUR OWN RISK."""
global DANGEROUS_MODULES
global DANGEROUS_FUNCTIONS
global BASE_PYTHON_TOOLS
DANGEROUS_MODULES = []
DANGEROUS_FUNCTIONS = []
BASE_PYTHON_TOOLS["open"]=open

class PrintContainer:
def __init__(self):
Expand Down