kodeagent.code_runner.CodeRunnerEnv#

class kodeagent.code_runner.CodeRunnerEnv(work_dir: str | None = None)[source]#

Abstract base class for code execution environments.

Initialize the code runner environment.

Parameters:

work_dir – Optional local workspace directory. Output files from code execution will be stored here. It will be used only if the path already exists. Otherwise, a temporary directory will be created.

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

Initialize the code runner environment.

Parameters:

work_dir – Optional local workspace directory. Output files from code execution will be stored here. It will be used only if the path already exists. Otherwise, a temporary directory will be created.

Methods

__init__([work_dir])

Initialize the code runner environment.

cleanup()

Clean up environment resources.

download_files_from_remote(remote_paths)

Download files from the environment to the local work_dir.

run(source_code, task_id, timeout)

Execute Python code in the environment.

Attributes

effective_work_dir

Return the effective working directory specified or creating a temporary one if needed.