Back to Smolagents

Python code executors

docs/source/en/reference/python_executors.md

1.24.01.2 KB
Original Source

Python code executors

Python executors are responsible for running the code generated by code agents in a controlled environment. Since agents dynamically generate and execute Python code to accomplish tasks, choosing the right executor is critical for both functionality and security.

To learn more about code execution and its risks, make sure to read the Secure code execution tutorial. This reference contains the API docs for the underlying classes: the base PythonExecutor interface and all available executor implementations.

Python executor

[[autodoc]] smolagents.local_python_executor.PythonExecutor

Local Python executor

[[autodoc]] smolagents.local_python_executor.LocalPythonExecutor

Remote Python executors

[[autodoc]] smolagents.remote_executors.RemotePythonExecutor

BlaxelExecutor

[[autodoc]] smolagents.remote_executors.BlaxelExecutor

E2BExecutor

[[autodoc]] smolagents.remote_executors.E2BExecutor

ModalExecutor

[[autodoc]] smolagents.remote_executors.ModalExecutor

DockerExecutor

[[autodoc]] smolagents.remote_executors.DockerExecutor

WasmExecutor

[[autodoc]] smolagents.remote_executors.WasmExecutor