Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 48 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,62 @@
name: CI
name: CI/CD Pipeline

on:
push:
branches: [main, master]
branches: [ main ]
pull_request:
branches: [main, master]
branches: [ main ]
release:
types: [ created ]

jobs:
lint:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff
- name: Lint
run: ruff check src/ tests/
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run tests
run: pytest --cov=src/agentlow --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3

test:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
needs: test
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package with dev deps
run: pip install -e ".[dev]"
- name: Run tests with coverage
run: pytest --cov=peanut_agent --cov-report=xml --cov-report=term
- name: Upload coverage
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build package
run: |
pip install twine wheel
python setup.py sdist bdist_wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*

security-check:
docker:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Verify no shell=True in source
run: |
if grep -rn "shell=True" src/; then
echo "FAIL: shell=True found in source code"
exit 1
fi
echo "PASS: No shell=True in source"
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: agentlow/agentlow-pro:latest, agentlow/agentlow-pro:${{ github.ref_name }}
14 changes: 0 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,3 @@ models/

# Workspace
workspace/

# Peanut Agent cache
.peanut_cache/

# IDE
.idea/
.vscode/
*.code-workspace

# mypy
.mypy_cache/

# ruff
.ruff_cache/
58 changes: 20 additions & 38 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,20 @@
# Changelog

## v2.0.0 - 2026-02-12

Complete rewrite of the agent system.

### Security
- Eliminated all `shell=True` usage — all subprocess calls use argument lists
- Fixed command injection vulnerabilities in git and docker tools
- Added forbidden pattern detection (rm -rf, sudo, eval, | bash, etc.)
- CI pipeline includes automated `shell=True` detection

### Architecture
- New `src/peanut_agent/` package structure with proper Python packaging
- Modern `pyproject.toml` replacing `setup.py`
- Immutable dataclass configuration with environment variable support
- Modular tools system (executor + schemas separated)

### Features
- SQLite-based response cache with TTL expiry and hit/miss statistics
- Rich CLI with interactive mode, single-command mode, and preflight checks
- System prompt for better tool-calling behavior
- Preflight check to verify Ollama connectivity before running

### Testing
- 69 tests covering agent, executor, cache, and config
- All tests run without Ollama (mocked HTTP)
- Path traversal, command injection, and forbidden pattern tests

### Removed
- Old flat file structure (agent.py, tools.py, config.py in root)
- Broken `src/agentlow/` package that never worked
- References to non-existent features (plugins, streaming, web scraping, SSH, database)

## v1.0.0

- Initial version with basic tool calling via Ollama
- Core tools: shell, files, http, git, docker
# CHANGELOG - AgentLow Pro

## v2.0.0 - 2026-02-11
- **Mejoras principales**:
- Caché inteligente (hasta 50x más rápido).
- Streaming de respuestas.
- Selección automática de modelo por tarea.
- Sistema de plugins extensible.
- Logging profesional con niveles.
- Interfaces: CLI (Rich), Web UI (FastAPI), REST API.
- **Herramientas nuevas**: database (SQLite), ssh, web_scrape, scheduler.
- **Seguridad**: Allowlist, path protection, timeouts.
- **Deployment**: Docker con GPU, CI/CD con GitHub Actions.
- **Testing**: Suite con pytest y coverage.
- **Estructura**: Paquete Python con src/, listo para PyPI.

## v1.0.0 - Fecha inicial
- Versión base con tool calling básico.
- Herramientas core: shell, files, http, git, docker.
- Integración con Ollama.
35 changes: 5 additions & 30 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
# Contributing to Peanut Agent
# Guía de Contribución a AgentLow Pro

## Setup
¡Gracias por interesarte en contribuir! AgentLow Pro es un proyecto open source y valoramos todas las contribuciones.

```bash
git clone https://github.com/smouj/PEANUT-AGENT
cd PEANUT-AGENT
pip install -e ".[dev]"
```
## Cómo Contribuir

## Development workflow

1. Create a branch: `git checkout -b feature/your-feature`
2. Make changes
3. Run tests: `pytest`
4. Run lint: `ruff check src/ tests/`
5. Verify no `shell=True`: `grep -rn "shell=True" src/`
6. Commit and push
7. Open a pull request

## Security rules

- **Never use `shell=True`** in subprocess calls. All commands must use argument lists.
- New tools must validate inputs and enforce path traversal protection.
- New shell commands must be added to the allowlist in `config.py`.

## Testing

All tests must pass without Ollama running. Use `unittest.mock.patch` to mock HTTP calls to the Ollama API.

```bash
pytest --cov=peanut_agent --cov-report=term
```
1. **Fork el repositorio**: Haz click en "Fork" en GitHub.
2. **Clona tu fork**:
51 changes: 34 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
FROM python:3.11-slim AS base
FROM python:3.11-slim

LABEL maintainer="smouj"
LABEL description="Peanut Agent - Local AI agent with secure tool calling"
# Metadatos
LABEL maintainer="AgentLow Pro"
LABEL description="Sistema de agente local con IA avanzado"

# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
# Instalar dependencias del sistema
RUN apt-get update && apt-get install -y \
curl \
git \
sqlite3 \
openssh-client \
&& rm -rf /var/lib/apt/lists/*

# Non-root user
RUN useradd -m -u 1000 peanut
# Instalar Ollama (opcional - puede correr en host)
# RUN curl -fsSL https://ollama.com/install.sh | sh

# Crear usuario no-root
RUN useradd -m -u 1000 agentlow

# Directorio de trabajo
WORKDIR /app

# Install Python deps first (better layer caching)
COPY pyproject.toml README.md ./
# Copiar requirements
COPY requirements.txt .

# Instalar dependencias Python
RUN pip install --no-cache-dir -r requirements.txt

# Copiar código
COPY src/ ./src/
RUN pip install --no-cache-dir .
COPY setup.py .

# Instalar el paquete
RUN pip install -e .

# Cambiar a usuario no-root
USER agentlow

# Switch to non-root
USER peanut
RUN mkdir -p /home/peanut/workspace
# Crear directorio de trabajo
RUN mkdir -p /home/agentlow/workspace

ENV PEANUT_WORK_DIR=/home/peanut/workspace
ENV PEANUT_OLLAMA_URL=http://ollama:11434
# Puerto para web UI
EXPOSE 8000

ENTRYPOINT ["peanut"]
CMD ["--check"]
# Comando por defecto
CMD ["python", "-m", "agentlow.cli"]
Loading
Loading