Sign inSign up

wisrovi/agents

By wisrovi

•Updated 3 months ago

Image
0

1.0K

wisrovi/agents repository overview

⁠wAgents - Docker Container Guide

Docker Python CUDA License

Original repo⁠

A comprehensive Docker-based development environment specifically designed for AI agent development, equipped with GPU acceleration, security tools, code quality assurance, and a rich set of development utilities.

ā šŸŽÆ What's Inside This Container

Once you build and run this container, you get a complete AI development environment with:

  • šŸŽÆ GPU Acceleration: Full NVIDIA CUDA 12.0 support for ML/AI workloads
  • šŸ”’ Security-First: Integrated vulnerability scanning (Bandit, Safety) and security analysis tools
  • ✨ Code Quality: Automated linting, formatting, and pre-commit hooks with Ruff
  • šŸ“Š Data Management: DVC (Data Version Control) with S3 integration
  • šŸ› ļø Development Tools: Rich terminal experience with Zsh, Oh My Zsh, and 20+ productivity tools
  • 🐳 Container Ready: Optimized Docker setup with GPU passthrough and Docker-in-Docker
  • šŸ¤– AI Agent Support: Pre-configured for GitHub Copilot and Google Gemini CLI

ā šŸ“ Container File Structure

Container: wAgents/
ā”œā”€ā”€ šŸ“ /app/                              # Main application directory (mounted from host)
│   ā”œā”€ā”€ šŸ“ python/examples/               # Example code for testing tools
│   │   ā”œā”€ā”€ šŸ“ security/                  # Security vulnerability examples
│   │   │   ā”œā”€ā”€ šŸ“„ test_code_scan.py     # Code with security vulnerabilities
│   │   │   └── šŸ“„ test_library_scan.py  # Dependencies with known CVEs
│   │   ā”œā”€ā”€ šŸ“ quality/                   # Code quality issue examples
│   │   │   └── šŸ“„ test_quality_check.py # Code with quality issues
│   │   ā”œā”€ā”€ šŸ“ yolo/                      # YOLO AI/ML examples
│   │   │   ā”œā”€ā”€ šŸ“ person detection detection.v2i.yolov11/  # Person detection dataset
│   │   │   │   ā”œā”€ā”€ šŸ“ train/               # Training images & labels
│   │   │   │   ā”œā”€ā”€ šŸ“ valid/               # Validation images & labels
│   │   │   │   ā”œā”€ā”€ šŸ“ test/                # Test images & labels
│   │   │   │   └── šŸ“„ data.yaml            # Dataset configuration
│   │   │   ā”œā”€ā”€ šŸ“„ train_yolo.py         # YOLO training example
│   │   │   ā”œā”€ā”€ šŸ“„ validate_yolo.py      # YOLO validation example
│   │   │   ā”œā”€ā”€ šŸ“„ test_yolo.py          # YOLO testing example
│   │   │   └── šŸ“„ inference_yolo.py     # YOLO inference example
│   │   └── šŸ“ other/                     # General development examples
│   │       └── šŸ“„ test_other_tools.py    # Code with style issues
│   ā”œā”€ā”€ šŸ“ requirements/                  # Python dependencies
│   │   ā”œā”€ā”€ šŸ“„ base.txt                   # Core development tools
│   │   ā”œā”€ā”€ šŸ“„ dvc.txt                    # Data version control
│   │   ā”œā”€ā”€ šŸ“„ security.txt               # Security scanning tools
│   │   ā”œā”€ā”€ šŸ“„ yolo.txt                   # AI/ML object detection tools
│   │   └── šŸ“„ see_image_terminal.txt     # Terminal image viewing
│   ā”œā”€ā”€ šŸ“ scripts/                       # Automation scripts
│   │   ā”œā”€ā”€ šŸ“ executor/                  # Runtime execution scripts
│   │   │   ā”œā”€ā”€ šŸ“ security/             # Security scanning scripts
│   │   │   │   ā”œā”€ā”€ šŸ“„ scan_code_vulnerability.sh
│   │   │   │   └── šŸ“„ scan_libraries_vulnerability.sh
│   │   │   ā”œā”€ā”€ šŸ“ quality/              # Code quality scripts
│   │   │   │   └── šŸ“„ correct_quality_py.sh
│   │   │   ā”œā”€ā”€ šŸ“ images/               # Image viewing scripts
│   │   │   │   ā”œā”€ā”€ šŸ“„ see_image_with_clickimage.py
│   │   │   │   └── šŸ“„ see_imagen_with_sixel.py
│   │   │   ā”œā”€ā”€ šŸ“ other/                # Utility scripts
│   │   │   │   └── šŸ“„ new_curl.sh
│   │   │   └── šŸ“„ auto_reload_py.sh     # Auto-reload Python apps
│   │   └── šŸ“ install/                  # Installation and setup scripts
│   │       ā”œā”€ā”€ šŸ“„ dvc_controller.sh     # DVC setup
│   │       ā”œā”€ā”€ šŸ“„ images_control.sh     # Image management
│   │       └── šŸ“„ other_agents.sh       # AI agents installation
│   ā”œā”€ā”€ šŸ“„ Dockerfile                    # Container definition
│   ā”œā”€ā”€ šŸ“„ docker-compose.yml            # Service orchestration
│   ā”œā”€ā”€ šŸ“„ README.md                     # Host documentation
│   └── šŸ“„ William-1.jpg                 # Sample image
ā”œā”€ā”€ šŸ“ /requirements/                     # Container requirements (build-time copy)
ā”œā”€ā”€ šŸ“ /scripts/                          # Container scripts (build-time copy)
ā”œā”€ā”€ šŸ“ /python_test/                      # Test Python files (build-time copy)
└── šŸ“ /root/                             # Home directory with Zsh config

ā šŸ—ļø Container Environment

⁠1. Shell Environment

When you enter the container, you get:

# You are here: /root (home directory)
# Shell: Zsh with Oh My Zsh
# Prompt: Customized with git status
# Aliases: 20+ productivity shortcuts

Key Aliases Available:

# Navigation
ls          # Enhanced listing with icons (exa)
ll          # Detailed listing (exa -l --icons)
la          # All files with details (exa -la --icons)
cd myproject # Smart directory jumping (zoxide)
tree        # Interactive directory tree (broot)

# Search & Find
grep pattern . # Fast search with ripgrep
find filename   # Fast file finding (fd)

# System Monitoring
du          # Better disk usage (dust)
df          # Better disk free (duf)
ps          # Better process listing (procs)
top         # Better system monitor (btop)

# Development
cat file    # Cat with syntax highlighting (batcat)
nano file   # Microsoft Edit editor
help        # Shows welcome banner
⁠2. Python Environment

All Python tools are pre-installed and ready:

# Security tools
bandit --version          # Security linter
safety --version          # Dependency scanner
scapy                     # Packet manipulation

# Quality tools  
ruff --version            # Fast linter/formatter
pre-commit --version      # Git hooks

# Data tools
dvc --version             # Data version control
pandas --version          # Data manipulation
boto3 --version           # AWS SDK

# AI/ML tools
ultralytics --version     # YOLO object detection
python -c "import torch"  # PyTorch framework
python -c "import cv2"     # OpenCV computer vision

# Development tools
ipython                   # Enhanced Python REPL
nvitop                    # GPU process monitoring
watchdog                  # File system monitoring
⁠3. Container Paths (Based on Dockerfile COPY locations)
Container PathPurposeWhat You'll Find
/appMain application directoryYour project files (mounted from host)
/scriptsBuild-time scripts copyScripts copied during build
/scripts/executor/security/Security toolsVulnerability scanning scripts
/scripts/executor/quality/Quality toolsCode quality scripts
/python_testTest Python files copyPython examples copied during build
/python_test/examples/Test examplesCode with intentional issues
/python_test/examples/yolo/YOLO examplesAI/ML object detection examples
/requirementsRequirements copyRequirements files copied during build
/requirements/yolo.txtYOLO dependenciesAI/ML object detection tools
/root/.zshrcShell configurationAliases, plugins, settings
/root/.oh-my-zsh/Zsh frameworkPlugins and themes

ā šŸ“š Getting Started Inside Container

⁠First Steps
# 1. Enter the container
docker-compose exec agent zsh

# 2. You'll see the welcome banner automatically
# 3. Navigate to your project
cd /app

# 4. See what's available
help  # Shows all tools and scripts
ls    # See project structure
⁠Security Testing
# Navigate to security examples (using build-time copy)
cd /python_test/examples/security

# Run security scan on vulnerable code
/scripts/executor/security/scan_code_vulnerability.sh

# Expected output:
# >> Issue: [B608:hardcoded_sql_expressions] 
# >> Severity: Medium   Confidence: High
# >> Location: test_code_scan.py:6
# >> More Info: https://bandit.readthedocs.io/en/latest/

# Run dependency vulnerability scan
/scripts/executor/security/scan_libraries_vulnerability.sh

# Expected output:
# >> WARNING: requests==2.25.0 has known vulnerabilities
# >> WARNING: urllib3==1.26.0 has known vulnerabilities
⁠Code Quality Testing
# Navigate to quality examples (using build-time copy)
cd /python_test/examples/quality

# Run quality check and auto-fix
/scripts/executor/quality/correct_quality_py.sh

# Expected output:
# >> test_quality_check.py:6:1: E501 Line too long (85 > 88)
# >> test_quality_check.py:9:1: F841 Unused variable 'unused_var'
# >> Fixed 2 issues
⁠YOLO AI/ML Testing
# Install YOLO dependencies
pip install -r /requirements/yolo.txt

# Navigate to YOLO examples
cd /python_test/examples/yolo

# Test YOLO training on person detection dataset
python train_yolo.py

# Test YOLO validation on trained model
python validate_yolo.py

# Test YOLO testing and benchmarking
python test_yolo.py

# Test YOLO inference (single image from dataset)
python inference_yolo.py --image "/python_test/examples/yolo/person detection detection.v2i.yolov11/test/images/ektp30_jpeg.rf.d8df759f943f1b0edf4bf8829ff61533.jpg"

# Test YOLO inference (batch on dataset samples)
python inference_yolo.py --samples 10

# Test YOLO real-time inference
python inference_yolo.py --camera 0

# Dataset info:
# - Dataset: Person Detection v2 (YOLOv11 format)
# - Classes: ['Face'] (1 class)
# - Train/Val/Test split available
# - Real images with person annotations
⁠Development Workflow
# Navigate to your project
cd /app

# Start auto-reload development server
/scripts/executor/auto_reload_py.sh

# In another terminal, view images
/scripts/executor/images/see_imagen_with_sixel.py /app/scripts/William-1.jpg

# Use productivity tools
rg "import" /python_test/examples/  # Fast search
exa --tree /python_test/examples/  # Tree view
btop                               # System monitor

ā šŸ”§ Available Tools by Category

⁠Security Tools
ToolCommandPurposeExample Usage
Banditbandit -r .Python security linterbandit -r /python_test/examples/
Safetysafety checkDependency vulnerability scannersafety check -r requirements.txt
Scapypython -c "import scapy"Packet manipulationscapy.all.IP().show()
Py-spypy-spy top --pid <pid>Python profilerpy-spy top -- python app.py
⁠Quality Tools
ToolCommandPurposeExample Usage
Ruffruff check --fix .Fast linter/formatterruff check --fix /python_test/examples/
Pre-commitpre-commit run --all-filesGit hookspre-commit run --all-files
Blackruff format .Code formatterruff format /python_test/examples/
⁠Development Tools
ToolCommandPurposeExample Usage
DVCdvc initData version controldvc init --no-scm
IPythonipythonEnhanced REPLipython --matplotlib
NVitopnvitopGPU monitoringnvitop
WatchdogwatchmedoFile monitoringwatchmedo auto-restart .
⁠Productivity Tools
ToolAliasPurposeExample Usage
Exals, ll, laModern lsll --git
RipgrepgrepFast searchgrep "TODO" /python_test/
FdfindFast findfind "*.py" /python_test/
BroottreeInteractive treetree /python_test/
DustduDisk usagedu /python_test/
DufdfDisk freedf -h
ProcspsProcess listps python
BtoptopSystem monitorbtop

ā šŸ”„ Container Lifecycle

⁠Build Process
graph LR
    A[Host Files] --> B[COPY requirements]
    B --> C[requirements]
    A --> D[COPY scripts]
    D --> E[scripts]
    A --> F[COPY python]
    F --> G[python_test]
    C --> H[Install Python Packages]
    E --> I[Configure Scripts]
    G --> J[Setup Examples]
    H --> K[Install AI/ML Tools]
    I --> K
    J --> K
    K --> L[Final Container]
    
    subgraph "AI/ML Components"
        M[Ultralytics YOLO]
        N[PyTorch]
        O[OpenCV]
        P[Person Detection Dataset]
    end
    
    H --> M
    H --> N
    H --> O
    J --> P
⁠Runtime Process
graph TB
    A[Container Start] --> B[WORKDIR app]
    B --> C[Mount Host Volume]
    C --> D[Zsh Shell Ready]
    D --> E[Tools Available]
    E --> F[Scripts at scripts]
    E --> G[Examples at python_test]
    E --> H[Project at app]
    E --> I[AI/ML Environment]
    F --> J[Welcome Script]
    G --> J
    H --> J
    I --> J
    J --> K[Ready for Development]
    
    subgraph "AI/ML Runtime"
        L[Person Detection Dataset]
        M[GPU Acceleration]
        N[Model Training]
        O[Real-time Inference]
    end
    
    I --> L
    I --> M
    I --> N
    I --> O

ā šŸ› Container Troubleshooting

⁠Common Issues & Solutions
⁠GPU Not Available
# Check GPU inside container
nvidia-smi

# Expected output: GPU information table
# If error: Check NVIDIA runtime installation
docker run --rm --gpus all wisrovi/agents:gpu-slim nvidia-smi
⁠Scripts Not Executable
# Fix permissions inside container
chmod +x /scripts/executor/security/*.sh
chmod +x /scripts/executor/quality/*.sh
chmod +x /scripts/install/*.sh

# Or run with bash explicitly
bash /scripts/executor/security/scan_code_vulnerability.sh
⁠Python Packages Not Found
# Check installed packages
pip list | grep -E "(bandit|safety|ruff|dvc)"

# Reinstall if needed
pip install -r /requirements/security.txt
pip install -r /requirements/base.txt
⁠Aliases Not Working
# Reload shell configuration
source /root/.zshrc

# Or restart container
docker-compose restart agent
⁠Container Debugging
# Check container status
docker-compose ps

# Access container with full shell
docker-compose exec agent zsh

# Check environment variables
env | grep -E "(PATH|PYTHON|CUDA|HOME)"

# Check mounted volumes
mount | grep /app

# Check running processes
ps aux | grep -E "(python|zsh)"

# Check disk usage
df -h
du -sh /python_test
⁠Performance Monitoring
# Monitor GPU usage
nvitop

# Monitor system resources
btop

# Monitor Python processes
py-spy top --pid $(pgrep -f python)

# Check network connectivity
ping google.com
curl -I https://github.com

ā šŸš€ Advanced Usage

⁠Custom Development Environment
# Create custom workspace
mkdir -p /app/workspace/my_project
cd /app/workspace/my_project

# Initialize git
git init
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

# Set up pre-commit hooks
pre-commit install

# Initialize DVC for data management
dvc init
dvc remote add -d myremote s3://my-bucket/data
⁠Batch Processing
# Run security scans on all Python files
find /python_test -name "*.py" -exec bandit {} \;

# Run quality checks with output to file
ruff check /python_test/examples/ > quality_report.txt

# Run dependency checks on all requirements
find /requirements -name "*.txt" -exec safety check -r {} \;
⁠Container Customization
# Add custom aliases (temporary)
echo "alias mytool='python /scripts/mytool.py'" >> /root/.zshrc
source /root/.zshrc

# Install additional Python packages
pip install jupyterlab matplotlib seaborn

# Install system packages
apt-get update && apt-get install -y htop tree

ā šŸ“ž Support


Built with ā¤ļø for the AI Agent development community

This guide focuses on what you'll find inside the container once it's built and running.

⁠to use

⁠alias
alias wisrovi="docker run --rm --hostname wAgent --init -i -t --shm-size 16g --cpus 6.0 --memory 16g --gpus all --log-opt max-size=50m -e TZ=Europe/Madrid -v "$(pwd)":/app -v /var/run/docker.sock:/var/run/docker.sock -v ~/.ssh:/root/.ssh:ro wisrovi/agents:gpu-slim zsh"
⁠temporal container
docker run \
  --rm \
  --hostname wAgent \
  --init \
  -i -t \
  --shm-size 16g \
  --cpus 6.0 \
  --memory 16g \
  --gpus all \
  --log-opt max-size=50m \
  -e TZ=Europe/Madrid \
  -v "$(pwd)":/app \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/.ssh:/root/.ssh:ro \
  wisrovi/agents:gpu-slim \
  zsh
⁠perpetual coontainer
docker run -d \
  --name wisrovi-agent-gpu \
  --hostname wAgent \
  --restart unless-stopped \
  --init \
  -i -t \
  --shm-size 16g \
  --cpus 6.0 \
  --memory 16g \
  --gpus all \
  --log-opt max-size=50m \
  -e TZ=Europe/Madrid \
  -v "$(pwd)":/app \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/.ssh:/root/.ssh:ro \
  wisrovi/agents:gpu-slim
⁠docker-compose
services:
  agents:
    image: wisrovi/agents:gpu-slim
    volumes:
      - ./:/app
      - /var/run/docker.sock:/var/run/docker.sock
      - ~/.ssh:/root/.ssh:ro
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
        limits:
          cpus: '6.0'
          memory: 16g
    stdin_open: true
    tty: true
    shm_size: 16g
    hostname: wAgent
    restart: unless-stopped
    init: true
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
        max-file: "5"

Tag summary

Content type

Image

Digest

sha256:dae788bdd…

Size

868.1 MB

Last updated

3 months ago

docker pull wisrovi/agents:gpu