Skip to content

code_interpreter_docker

code_interpreter_docker

Docker-sandboxed code interpreter tool.

Classes

DockerCodeInterpreterTool

DockerCodeInterpreterTool(*, image: str = 'python:3.12-slim', timeout: int = 30, max_output: int = 10000, memory_limit: str = '512m', cpu_count: int = 1, network_disabled: bool = True, pids_limit: int = 100)

Bases: BaseTool

Execute Python code in a disposable Docker container.

Source code in src/openjarvis/tools/code_interpreter_docker.py
def __init__(
    self,
    *,
    image: str = "python:3.12-slim",
    timeout: int = 30,
    max_output: int = 10000,
    memory_limit: str = "512m",
    cpu_count: int = 1,
    network_disabled: bool = True,
    pids_limit: int = 100,
) -> None:
    self._image = image
    self._timeout = timeout
    self._max_output = max_output
    self._memory_limit = memory_limit
    self._cpu_count = cpu_count
    self._network_disabled = network_disabled
    self._pids_limit = pids_limit