Skip to content

docker_shell_exec

diapason.tools.docker_shell_exec

Container-scoped shell executor.

Runs commands inside the currently-active TB v2.1 task container (set via :func:diapason.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 diapason.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.

DockerShellExecTool

Bases: BaseTool

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

set_active_container(name)

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