autogen_ext.code_executors#

Code executor utilities for AutoGen-Ext.

create_default_code_executor(work_dir: str | None = None) CodeExecutor[source]#

Create a default code executor, preferring Docker if available.

This function creates a code executor using the following priority: 1. DockerCommandLineCodeExecutor if Docker is available 2. LocalCommandLineCodeExecutor with a warning if Docker is not available

Parameters:

work_dir – Optional working directory for the code executor

Returns:

CodeExecutor – A code executor instance

Warning

For security, it is recommended to use DockerCommandLineCodeExecutor when available to isolate code execution.