Skip to content

docker_shell_exec

docker_shell_exec

Container-scoped shell executor.

Runs commands inside the currently-active TB v2.1 task container (set via :func:openjarvis.tools.docker_shell_exec.set_active_container). When no container is active the tool refuses to run — it is explicitly not a host-shell alternative.

The expected lifecycle is:

from openjarvis.tools.docker_shell_exec import set_active_container

set_active_container(container_name)
try:
    # run agent — every shell command goes through `docker exec`
finally:
    set_active_container(None)

The TB v2.1 task environment sets/clears this context automatically.

Classes

DockerShellExecTool

Bases: BaseTool

Execute a shell command inside the active TB v2.1 task container.

Functions

set_active_container

set_active_container(name: Optional[str]) -> None

Bind (or clear) the Docker container for this process.

Source code in src/openjarvis/tools/docker_shell_exec.py
def set_active_container(name: Optional[str]) -> None:
    """Bind (or clear) the Docker container for this process."""
    global _active_container
    with _lock:
        _active_container = name