Skip to content

ximbi1/WizrAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WizrAI β€” Local AI Agent & LLM Backend

WizrAI is a modular local AI environment created by Eugeni Soto (Ximbi). It combines a local LLM inference backend (based on llama.cpp) with a semi-autonomous terminal agent that can analyze, execute, and generate code directly on your system β€” with no cloud dependency.

β€œWhere code meets magic.”

General Architecture

WizrAI is composed of two separate but connected layers:

πŸ§™β€β™‚οΈ wizrai.py (Local Agent)

  • Runs on your host machine
  • Executes commands and creates files
  • Analyzes and validates generated code
  • Communicates with the model via HTTP

🐳 wizrai (Docker Container)

  • Runs llama-server (llama.cpp)
  • Loads a local .gguf model
  • Processes prompts and streams responses
  • Has no access to the host system

This modular design makes the container the brain (LLM) and the local agent the mind that reasons, validates, and executes actions in your real environment.

Online Mode (OpenRouter Integration)

WizrAI also includes a second online inference mode using OpenRouter

This allows you to use cloud-hosted models when you need internet access, extended reasoning, or creative writing.

How it works

Inside wizrai.py, you’ll find two versions of the call_llm_stream() function:

Both are already written in the script.

To switch between them, simply comment or uncomment the desired block.

To use the online mode

  • Go to OpenRouter.ai and get your API key.

  • Export it in your terminal:

    • export OPENROUTER_API_KEY="sk-xxxxxxxx"
  • In wizrai.py, comment the local version and uncomment the OpenRouter version.

Run WizrAI as usual:

./wizrai.py "summarize this article and generate a research plan"

Pre-configured free models

A few free and public models are already listed in the code β€” you can just uncomment any of them:

Project Structure

wizrai/

β”œβ”€β”€ Dockerfile

β”œβ”€β”€ docker-compose.yml

β”œβ”€β”€ wizrai.py

β”œβ”€β”€ models/

β”‚ └── .gitkeep

└── cache/

Backend: Local LLM Server

The WizrAI backend runs any compatible .gguf model using llama.cpp.

You can now pick between llama.cpp and Ollama:

  • ./wizrai.py "…" β†’ usa el servidor de llama.cpp iniciado mediante Docker.
  • ./wizrai.py --backend ollama "…" β†’ envΓ­a las peticiones al daemon de Ollama que corre en http://127.0.0.1:11434 (arrΓ‘ncalo con ollama serve).
  • Exporta WIZRAI_BACKEND=ollama si quieres que Ollama sea el default.
  • Cambia el modelo utilizado por Ollama con export OLLAMA_MODEL=phi3:mini y, si es necesario, export OLLAMA_HOST=http://127.0.0.1:11434.

Requirements

  • Docker and Docker Compose installed

  • A compatible .gguf model (e.g. Gemma, Mistral, Llama

Steps

This will compile llama.cpp, load your model, and expose port 8080.

Backend Configuration

The Dockerfile is tuned for long-running, stable inference:

4K context window

10 CPU threads

batch size 256

tuned repetition penalty

persistent cache at /cache/wizrai.cache

--mlock enabled for stable performance

You can easily tweak parameters in docker-compose.yml.

Local Agent (wizrai.py)

wizrai.py is a smart terminal agent capable of interpreting natural objectives, creating a plan, executing commands, reviewing results, and adapting autonomously.

Requirements:

Python 3.11+

Packages: requests, rich

Install dependencies:

pip install requests rich

Example Usage

  • chmod +x wizrai.py
  • ./wizrai.py "create a bash script that analyzes the top CPU-consuming processes, saves the output to a file, and displays it"

The agent will:

  1. Formulate an incremental plan

  2. Generate safe POSIX commands as JSON

  3. Execute steps sequentially with logs and validation

  4. Detect and correct errors automatically

  5. Display diffs, validations, and results in real time

Communication Flow

  1. The agent sends prompts to the local server at http://127.0.0.1:8080/completion

  2. The backend streams token responses

  3. The agent interprets the JSON and executes the plan

Everything runs fully offline β€” no data is sent to external servers.

models and cache folders

  • models Stores your .gguf model Required (mounted into the container)
  • cache Stores prompt cache Optional (auto-created)
  • .gitkeep Keeps empty folders under version control Safe to ignore

⚠️ The Docker container does not download the model automatically.

Each user must place their own .gguf file inside the models/ folder.

Design Philosophy

WizrAI follows a local-first, modular philosophy:

  • The container is the LLM brain

  • The agent is the active thinker and executor

  • The user retains full control over the system

  • No external API calls required

  • Secure, auditable, and extensible

Customization

You can modify models, parameters, or behaviors easily:

  • Edit OPENROUTER_MODEL inside wizrai.py

  • Adjust THREADS, CONTEXT, TOKENS, etc. in docker-compose.yml

Handy aliases:

alias wzr-up='cd ~/wizrai && docker compose up -d'

alias wzr-stop='cd ~/wizrai && docker compose down'

πŸ§™β€β™‚οΈ Author

Eugeni Soto (Ximbi)

IT ops Engineer / AI Engineer

Contributing

Pull requests, ideas, and improvements are welcome. If you use WizrAI in your lab or workflow, share your experience!

License

MIT License Β© 2025 β€” Ximbi Based on llama.cpp

About

Local AI agent + LLM backend built on llama.cpp. Fully offline workflow, modular design, and smart terminal reasoning.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors