Evolutionary Local LLM Agent - Self-improving AI assistant
Project description
๐งฌ ELLMa - Evolutionary Local LLM Agent
Evolutionary Local LLM Agent - Self-improving AI assistant that evolves with your needs
๐ Table of Contents
- ๐ Features
- โก Quick Start
- ๐ Development
- ๐ Usage Examples
- ๐งฉ Extending ELLMa
- โ๏ธ Generated Utilities
- ๐ค Contributing
- ๐ License
- ๐ Documentation
๐ Features
ELLMa is a revolutionary self-evolving AI agent that runs locally on your machine. Unlike traditional AI tools, ELLMa learns and improves itself with these key features:
๐ Security & Dependency Management
- Automatic Environment Setup: Ensures all dependencies are installed and configured correctly
- Dependency Auto-Repair: Automatically detects and fixes missing or broken dependencies
- Virtual Environment Management: Handles Python virtual environments automatically
- Security Checks: Performs security validations before executing commands
- Graceful Degradation: Works even when optional dependencies are missing
๐ Commands
# Check environment status
ellma security check
# Install dependencies
ellma security install [--group GROUP]
# Repair environment issues
ellma security repair
๐ What is ELLMa?
ELLMa is a revolutionary self-evolving AI agent that runs locally on your machine. Unlike traditional AI tools, ELLMa learns and improves itself by:
Core Capabilities
- Performance Monitoring: Built-in metrics and monitoring
- Cross-Platform: Works on Linux, macOS, and Windows (WSL2 recommended for Windows)
- System Introspection: Built-in commands for system exploration and debugging
System Introspection
ELLMa includes powerful introspection capabilities to help you understand and debug the system:
# View configuration
sys config # Show all configuration
sys config model # Show model configuration
# Explore source code
sys source ellma.core.agent.ELLMa # View class source
sys code ellma.commands.system # View module source
# System information
sys info # Show detailed system info
sys status # Show system status
sys health # Run system health check
# Module exploration
sys modules # List all available modules
sys module ellma.core # Show info about a module
# Command help
sys commands # List all available commands
sys help # Show help for system commands
These commands support natural language queries, so you can type things like:
- "show me the config" โ
sys config - "what modules are available" โ
sys modules - "display system information" โ
sys info
๐ก๏ธ Security First
ELLMa includes a robust security layer that runs before any code execution to ensure a safe and consistent environment:
- Environment Validation: Verifies Python version, virtual environment, and dependencies
- Auto-Repair: Automatically installs missing dependencies when possible
- Secure Execution: Runs in an isolated environment with proper permissions
- Dependency Management: Uses Poetry for reliable dependency resolution
Security Features
- Dependency Isolation: Each component runs with minimal required permissions
- Environment Sandboxing: Critical operations run in isolated environments
- Secure Defaults: Secure by default with sensible restrictions
- Audit Logging: All security-relevant actions are logged
โก Quick Start
Prerequisites
- Python 3.8+
- pip (Python package manager)
- Git (for development)
- 8GB+ RAM recommended for local models
- For GPU acceleration: CUDA-compatible GPU (optional)
Installation
Option 1: Install from source (recommended for development)
# Clone the repository
git clone https://github.com/wronai/ellma.git
cd ellma
# Install in development mode with all dependencies
pip install -e ".[dev]"
Option 2: Install via pip
pip install ellma
First Steps
-
Initialize ELLMa (creates config in ~/.ellma)
# Basic initialization ellma init # Force re-initialization # ellma init --force
-
Download a model (or let it auto-download when needed)
# Download default model ellma download-model # Specify a different model # ellma download-model --model mistral-7b-instruct
-
Start the interactive shell
# Start interactive shell ellma shell # Start shell with verbose output # ellma -v shell
-
Or execute commands directly
# System information ellma exec system scan # Web interaction (extract text and links) ellma exec web read https://example.com --extract-text --extract-links # File operations (search for Python files) ellma exec files search /path/to/directory --pattern "*.py" # Get agent status ellma status
๐ Development
๐ Development
Setting Up Development Environment
-
Clone the repository
git clone https://github.com/wronai/ellma.git cd ellma
-
Install with development dependencies
pip install -e ".[dev]"
-
Set up pre-commit hooks (recommended)
pre-commit install
Development Workflow
Running Tests
# Run all tests
make test
# Run specific test file
pytest tests/test_web_commands.py -v
# Run with coverage report
make test-coverage
Code Quality
# Run linters
make lint
# Auto-format code
make format
# Type checking
make typecheck
# Security checks
make security
Documentation
# Build documentation
make docs
# Serve docs locally
cd docs && python -m http.server 8000
Project Structure
ellma/
โโโ ellma/ # Main package
โ โโโ core/ # Core functionality
โ โโโ commands/ # Built-in commands
โ โโโ generators/ # Code generation
โ โโโ models/ # Model management
โ โโโ utils/ # Utilities
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ scripts/ # Development scripts
Project Structure
ellma/
โโโ ellma/ # Main package
โ โโโ core/ # Core functionality
โ โโโ commands/ # Built-in commands
โ โโโ generators/ # Code generation
โ โโโ models/ # Model management
โ โโโ utils/ # Utilities
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ scripts/ # Development scripts
๐ Evolution & Self-Improvement
ELLMa's evolution engine allows it to analyze its performance and automatically improve its capabilities.
Running Evolution
# Run a single evolution cycle
ellma evolve
# Run multiple evolution cycles (up to 3 recommended)
ellma evolve --cycles 3
# Force evolution even if not enough commands have been executed
ellma evolve --force
Evolution Requirements
- At least 10 commands should be executed before evolution is recommended
- Use
--forceto bypass this requirement - Evolution status is shown in the main status output
Monitoring Evolution
# View evolution history (if available)
cat ~/.ellma/evolution/evolution_history.json | jq .
# Monitor evolution logs
tail -f ~/.ellma/logs/evolution.log
# Check evolution status in the main status output
ellma status
๐งฌ Evolution Configuration
Customize the self-improvement process in ~/.ellma/config.yaml:
evolution:
enabled: true # Enable/disable evolution
auto_improve: true # Allow automatic improvements
learning_rate: 0.1 # Learning rate for evolution (0.0-1.0)
Status Information
The main status command shows key evolution metrics:
ellma status
Example output:
๐ค ELLMa Status
โโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Property โ Value โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Version โ 0.1.6 โ
โ Model Loaded โ โ
Yes โ
โ Model Path โ /path/to/model.gguf โ
โ Modules โ 0 โ
โ Commands โ 3 โ
โ Commands Executed โ 15 โ
โ Success Rate โ 100.0% โ
โ Evolution Cycles โ 0 โ
โ Modules Created โ 0 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
### Monitoring Evolution
Track evolution progress and results:
```bash
# View evolution history with detailed metrics
ellma evolution history --limit 10
# Monitor evolution in real-time
ellma evolution monitor
# Get evolution statistics
ellma evolution stats
# Compare evolution cycles
ellma evolution compare cycle1 cycle2
Evolution Best Practices
- Start Conservative: Begin with lower learning rates and enable auto-improve
- Monitor Progress: Regularly check evolution logs and metrics
- Set Resource Limits: Prevent excessive resource usage
- Use Benchmarks: Enable benchmarking to measure improvements
- Review Changes: Periodically review and test evolved modules
Troubleshooting Evolution
Common issues and solutions:
# If evolution gets stuck
ellma evolution cancel
# Reset to last known good state
ellma evolution rollback
# Clear evolution cache
ellma evolution clean
# Force reset evolution state (use with caution)
ellma evolution reset --confirm
๐งฉ Extending ELLMa
Creating Custom Commands
- Create a new Python module in
ellma/commands/:
from ellma.commands.base import BaseCommand
class MyCustomCommand(BaseCommand):
"""My custom command"""
- Register your command in
ellma/commands/__init__.py - Restart ELLMa to load your new command
โ๏ธ Generated Utilities
ELLMa includes a powerful set of self-generated utilities for common programming tasks. These include:
- ๐ก๏ธ Enhanced Error Handling: Automatic retries with exponential backoff
- โก Performance Caching: In-memory cache with TTL support
- ๐ Parallel Processing: Easy parallel execution of tasks
See the Generated Utilities Documentation for detailed usage and examples.
def __init__(self, agent):
super().__init__(agent)
self.name = "custom"
self.description = "My custom command"
def my_action(self, param1: str, param2: int = 42):
"""Example action"""
return {"result": f"Got {param1} and {param2}"}
2. Register your command in `ellma/commands/__init__.py`
### Creating Custom Modules
1. Create a new module class:
```python
from ellma.core.module import BaseModule
class MyCustomModule(BaseModule):
def __init__(self, agent):
super().__init__(agent)
self.name = "my_module"
self.version = "1.0.0"
def setup(self):
# Initialization code
pass
def execute(self, command: str, *args, **kwargs):
# Handle commands
if command == "greet":
return f"Hello, {kwargs.get('name', 'World')}!"
raise ValueError(f"Unknown command: {command}")
- Register your module in the agent's configuration
๐ค Contributing
We welcome contributions! Here's how you can help:
- Report Bugs: Open an issue with detailed steps to reproduce
- Suggest Features: Share your ideas for new features
- Submit Pull Requests: Follow these steps:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Update documentation
- Submit a PR
Development Guidelines
- Follow PEP 8 style guide
- Write docstrings for all public functions and classes
- Add type hints for better code clarity
- Write tests for new features
- Update documentation when making changes
๐ License
MIT License - see LICENSE for details.
๐ Documentation
For complete documentation, visit ellma.readthedocs.io
๐ Acknowledgments
- Thanks to all contributors who have helped improve ELLMa
- Built with โค๏ธ by the ELLMa team
๐ฏ Core Features
๐งฌ Self-Evolution Engine
ELLMa continuously improves by analyzing its performance and automatically generating new modules:
$ ellma evolve
๐งฌ Starting evolution process...
๐ Analyzing current capabilities...
๐ฏ Identified 3 improvement opportunities:
โ
Added: advanced_file_analyzer
โ
Added: network_monitoring
โ
Added: code_optimizer
๐ Evolution complete! 3 new capabilities added.
๐ Performance Monitoring
Track your agent's performance:
# Show agent status
ellma status
# View system health metrics
ellma exec system.health
๐ Advanced Command Usage
# Run system scan
ellma exec system.scan
# Read web page content
ellma exec web.read https://example.com
# Read web page with link extraction
ellma exec web.read https://example.com extract_links true extract_text true
# Quick system health check
ellma exec system.health
# Save command output to file
ellma exec system.scan > scan_results.json
๐ Interactive Shell Interface
Start the interactive shell and use system commands:
# Start the interactive shell
ellma shell
# In the shell, you can run commands like:
ellma> system.health
ellma> system.scan
ellma> web.read https://example.com
ellma> web.read https://example.com extract_links true extract_text true
Example shell session:
๐ค ELLMa Interactive Shell (v0.1.6)
Type 'help' for available commands, 'exit' to quit
# Available commands:
# - system.health: Check system health
# - system.scan: Perform system scan
# - web.read [url]: Read web page content
# - web.read [url] extract_links true extract_text true: Read web page with link extraction
# - help: Show available commands
ellma> system.health
{'status': 'HEALTHY', 'cpu_usage': 12.5, 'memory_usage': 45.2, ...}
ellma> web.read example.com
{'status': 200, 'title': 'Example Domain', 'content_length': 1256, ...}
# For commands with parameters, use space-separated values
ellma> web.read example.com extract_links true extract_text true
๐ ๏ธ Multi-Language Code Generation
Generate production-ready code in multiple languages:
# Generate Bash scripts
ellma generate bash --task="Monitor system resources and alert on high usage"
# Generate Python code
ellma generate python --task="Web scraper with rate limiting"
# Generate Docker configurations
ellma generate docker --task="Multi-service web application"
# Generate Groovy for Jenkins
ellma generate groovy --task="CI/CD pipeline with testing stages"
๐ Intelligent System Integration
ELLMa understands your system and can:
- Scan and analyze system configurations
- Monitor processes and resources
- Automate repetitive tasks
- Generate custom tools for your workflow
๐๏ธ Architecture
ellma/
โโโ core/ # Core agent and evolution engine
โ โโโ agent.py # Main LLM Agent class
โ โโโ evolution.py # Self-improvement system
โ โโโ shell.py # Interactive shell interface
โโโ commands/ # Modular command system
โ โโโ system.py # System operations
โ โโโ web.py # Web interactions
โ โโโ files.py # File operations
โโโ generators/ # Code generation engines
โ โโโ bash.py # Bash script generator
โ โโโ python.py # Python code generator
โ โโโ docker.py # Docker configuration generator
โโโ modules/ # Dynamic module system
โ โโโ registry.py # Module registry and loader
โ โโโ [auto-generated]/ # Self-created modules
โโโ cli/ # Command-line interface
โโโ main.py # Main CLI entry point
โโโ shell.py # Interactive shell
๐ Usage Examples
System Administration
# Run comprehensive system scan
ellma exec system.scan
# Monitor system resources (60 seconds with 5-second intervals)
ellma exec system.monitor --duration 60 --interval 5
# Check system health status
ellma exec system.health
# List top processes by CPU usage
ellma exec system.processes --sort-by cpu --limit 10
# Check open network ports
ellma exec system.ports
Development Workflow
# Generate a new Python project
ellma generate python --task "FastAPI project with SQLAlchemy and JWT auth"
# Create a Docker Compose setup
ellma generate docker --task "Python app with PostgreSQL and Redis"
# Generate test cases
```bash
ellma generate test --file app/main.py --framework pytest
# Document a Python function
ellma exec code document_function utils.py --function process_data
Generated Utilities Examples
Explore practical examples of using the generated utilities in the examples/generated_utils/ directory:
- Error Handling - Automatic retries with exponential backoff
- Performance Caching - Efficient data caching with TTL
- Parallel Processing - Concurrent task execution
- Combined Example - Using all utilities together
Run any example with:
# From the project root
python -m examples.generated_utils.example_name
# Or directly
cd examples/generated_utils/
python example_name.py
For more details, see the generated utilities documentation.
Web & API Interaction
# Read and extract content from a webpage
ellma exec web.read https://example.com --extract-text --extract-links
# Make HTTP GET request to an API endpoint
ellma exec web.get https://api.example.com/data
# Make HTTP POST request with JSON data
ellma exec web.post https://api.example.com/data --data '{"key": "value"}'
# Generate API client code
ellma generate python --task "API client for REST service with error handling"
## ๐ง Configuration
ELLMa stores its configuration in `~/.ellma/`:
```yaml
# ~/.ellma/config.yaml
model:
path: ~/.ellma/models/mistral-7b.gguf
context_length: 4096
temperature: 0.7
evolution:
enabled: true
auto_improve: true
learning_rate: 0.1
modules:
auto_load: true
custom_path: ~/.ellma/modules
๐งฌ How Evolution Works
- Performance Analysis: ELLMa monitors execution times, success rates, and user feedback
- Gap Identification: Identifies missing functionality or optimization opportunities
- Code Generation: Uses its LLM to generate new modules and improvements
- Testing & Integration: Automatically tests and integrates new capabilities
- Continuous Learning: Learns from each interaction to become more useful
๐ Advanced Features
Custom Module Development
# Create custom modules that ELLMa can use and improve
from ellma.core.module import BaseModule
class MyCustomModule(BaseModule):
def execute(self, *args, **kwargs):
# Your custom functionality
return result
API Integration
from ellma import ELLMa
# Use ELLMa programmatically
agent = ELLMa()
result = agent.execute("system.scan")
code = agent.generate("python", task="Data analysis script")
Web Interface (Optional)
# Install web dependencies
pip install ellma[web]
# Start web interface
ellma web --port 8000
๐ฃ๏ธ Roadmap
Version 0.1.6 - MVP โ
- Core agent with Mistral 7B
- Basic command system
- Shell interface
- Evolution foundation
Version 0.2.0 - Enhanced Shell
- Advanced command completion
- Command history and favorites
- Real-time performance monitoring
- Module hot-reloading
Version 0.3.0 - Code Generation
- Multi-language code generators
- Template system
- Code quality analysis
- Integration testing
Version 0.4.0 - Advanced Evolution
- Performance-based learning
- User feedback integration
- Predictive capability development
- Module marketplace
Version 1.0.0 - Autonomous Agent
- Full self-management
- Advanced reasoning capabilities
- Multi-agent coordination
- Enterprise features
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone repository
git clone https://github.com/wronai/ellma.git
cd ellma
# Install in development mode
pip install -e .[dev]
# Run tests
pytest
# Run linting
black ellma/
flake8 ellma/
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built on top of llama-cpp-python
- Inspired by the vision of autonomous AI agents
- Powered by the amazing Mistral 7B model
๐ Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
- ๐ง Email Support
ELLMa: The AI agent that grows with you ๐ฑโ๐ณ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ellma-0.1.15.tar.gz.
File metadata
- Download URL: ellma-0.1.15.tar.gz
- Upload date:
- Size: 139.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.4 Linux/6.14.9-300.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
381a9001059a815d1d25f784e97a148f21ac38a54a7ed9108d794f2bce27ec4d
|
|
| MD5 |
845f5e8d1ad610fc113672283aaa60ca
|
|
| BLAKE2b-256 |
31657bb940796cd9dcc7885cc3557d2ecee0dbceabb4c8010327b605875e36a1
|
File details
Details for the file ellma-0.1.15-py3-none-any.whl.
File metadata
- Download URL: ellma-0.1.15-py3-none-any.whl
- Upload date:
- Size: 159.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.4 Linux/6.14.9-300.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
470080510841c948e70adf0f6dc467598a4f1b9a5dab140faca09c070679430a
|
|
| MD5 |
c71b9dc926a55ffcd0012b3b1a12e3fd
|
|
| BLAKE2b-256 |
1a619321be472797cda9163398845485f6443f93a7d4e68f76710580096ba8e3
|