Skip to main content

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.
Parameters:

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.
Parameters: Returns:

restart

(Experimental) Restart the code executor.

stop

(Experimental) Stop the code executor.