Update environment configuration and enhance terminal tool integration

- Modified `.env.example` to set the default terminal environment to 'singularity' and updated Docker and Singularity image references for better compatibility.
- Enhanced `run_mixed_tasks.sh` and `run_terminal_tasks.sh` scripts to utilize the new Singularity setup, including improved logging and cache directory management.
- Introduced functionality in `terminal_tool.py` to automatically build and cache SIF images from Docker URLs, streamlining the execution environment setup.
- Updated logging messages for clarity on image usage and cache directory paths.
This commit is contained in:
teknium
2026-01-29 22:47:11 +00:00
parent 7ea17bb957
commit 771cf41fea
4 changed files with 173 additions and 62 deletions

View File

@@ -30,43 +30,59 @@ NOUS_API_KEY=
FAL_KEY=
# =============================================================================
# TERMINAL TOOL CONFIGURATION (mini-swe-agent backend)
# TERMINAL TOOL CONFIGURATION
# =============================================================================
# Backend type: "local", "singularity", "docker", or "modal"
# - local: Runs directly on your machine (fastest, no isolation)
# - singularity: Runs in Apptainer/Singularity containers (HPC clusters, no root needed)
# - docker: Runs in Docker containers (isolated, requires Docker + docker group)
# - modal: Runs in Modal cloud sandboxes (scalable, requires Modal account)
TERMINAL_ENV=local
# Uncomment ONE configuration block below based on your preferred backend.
# Container images (for singularity/docker/modal backends)
TERMINAL_DOCKER_IMAGE=python:3.11-slim
TERMINAL_SINGULARITY_IMAGE=docker://python:3.11-slim
TERMINAL_MODAL_IMAGE=python:3.11-slim
# Working directory inside the container
TERMINAL_CWD=/tmp
# Default command timeout in seconds
# -----------------------------------------------------------------------------
# OPTION 1: Singularity/Apptainer (RECOMMENDED for HPC clusters)
# - No root required, common on shared systems
# - Auto-builds and caches SIF images from docker:// URLs
# - Uses /scratch if available, otherwise /tmp
# -----------------------------------------------------------------------------
TERMINAL_ENV=singularity
TERMINAL_SINGULARITY_IMAGE=docker://nikolaik/python-nodejs:python3.11-nodejs20
TERMINAL_CWD=/workspace
TERMINAL_TIMEOUT=60
# Optional: Override scratch directory (auto-detects /scratch or /tmp)
# TERMINAL_SCRATCH_DIR=/scratch/myuser/hermes
# Cleanup inactive environments after this many seconds
# -----------------------------------------------------------------------------
# OPTION 2: Local execution (FASTEST, but no isolation)
# - Runs directly on your machine
# - No containers, no setup required
# - WARNING: Commands run with your user permissions
# -----------------------------------------------------------------------------
# TERMINAL_ENV=local
# TERMINAL_CWD=/tmp
# TERMINAL_TIMEOUT=60
# -----------------------------------------------------------------------------
# OPTION 3: Docker (good isolation, requires Docker)
# - Requires Docker installed and user in 'docker' group
# - Each task gets an isolated container
# -----------------------------------------------------------------------------
# TERMINAL_ENV=docker
# TERMINAL_DOCKER_IMAGE=nikolaik/python-nodejs:python3.11-nodejs20
# TERMINAL_CWD=/workspace
# TERMINAL_TIMEOUT=60
# -----------------------------------------------------------------------------
# OPTION 4: Modal (cloud execution, scalable)
# - Requires Modal account: pip install modal && modal setup
# - Runs in Modal's cloud sandboxes
# - Good for scaling to many parallel workers
# -----------------------------------------------------------------------------
# TERMINAL_ENV=modal
# TERMINAL_MODAL_IMAGE=nikolaik/python-nodejs:python3.11-nodejs20
# TERMINAL_CWD=/workspace
# TERMINAL_TIMEOUT=60
# Common settings for all backends
TERMINAL_LIFETIME_SECONDS=300
# Scratch directory for Singularity sandboxes (optional)
# If not set, uses /scratch (if available) or /tmp
# TERMINAL_SCRATCH_DIR=/scratch/myuser
# Disk usage warning threshold in GB (default: 500)
TERMINAL_DISK_WARNING_GB=500
# =============================================================================
# MODAL CLOUD BACKEND (Optional - for TERMINAL_ENV=modal)
# =============================================================================
# Modal uses CLI authentication, not environment variables.
# Run: pip install modal && modal setup
# This will authenticate via browser and store credentials locally.
# =============================================================================
# BROWSER TOOL CONFIGURATION (agent-browser + Browserbase)
# =============================================================================
@@ -99,11 +115,11 @@ BROWSER_SESSION_TIMEOUT=300
# Morph API Key - For legacy Hecate terminal backend
# Get at: https://morph.so/
MORPH_API_KEY=
# MORPH_API_KEY=
# Hecate VM Settings (only if using terminal-hecate tool)
HECATE_VM_LIFETIME_SECONDS=300
HECATE_DEFAULT_SNAPSHOT_ID=snapshot_p5294qxt
# HECATE_VM_LIFETIME_SECONDS=300
# HECATE_DEFAULT_SNAPSHOT_ID=snapshot_p5294qxt
# =============================================================================
# DEBUG OPTIONS