autogen.coding.DockerCommandLineCodeExecutor
DockerCommandLineCodeExecutor
(Experimental) A code executor class that executes code blocks and returns the result.
(Experimental) A code executor class that executes code through
a command line environment in a Docker container.
The executor first saves each code block in a file in the working
directory, and then executes the code file in the container.
The executor executes the code blocks in the order they are received.
Currently, the executor only supports Python and shell scripts.
For Python code, use the language “python” for the code block.
For shell scripts, use the language “bash”, “shell”, or “sh” for the code
block.
Name | Description |
---|---|
image | Type: str Default: ‘python |
container_name | Type: Optional[str] Default: None |
timeout | Type: int Default: 60 |
work_dir | Type: Optional[Union[Path, str]] Default: None |
bind_dir | Type: Optional[Union[Path, str]] Default: None |
auto_remove | Type: bool Default: True |
stop_container | Type: bool Default: True |
execution_policies | Type: Optional[dict[str, bool]] Default: None |
Class Attributes
DEFAULT_EXECUTION_POLICY
LANGUAGE_ALIASES
Instance Attributes
bind_dir
(Experimental) The binding directory for the code execution container.
code_extractor
(Experimental) Export a code extractor that can be used by an agent.
timeout
(Experimental) The timeout for code execution.
work_dir
(Experimental) The working directory for the code execution.
Instance Methods
execute_code_blocks
(Experimental) Execute the code blocks and return the result.
Name | Description |
---|---|
code_blocks | The code blocks to execute. Type: list[CodeBlock] |
Type | Description |
---|---|
autogen.coding.base.CommandLineCodeResult | CommandlineCodeResult: The result of the code execution. |
restart
(Experimental) Restart the code executor.
stop
(Experimental) Stop the code executor.