LoCAL2 — Loosely Coupled Agent Language model, second generation
Project description
LoCAL2
Loosely Coupled Agent Language model — Second Generation.
LLM-native tool calling with Gemma 4 as the orchestrator. Web search, memory recall, and feedback loops augment Gemma's native reasoning — the model decides when to use them.
Reference hardware: Mac Mini M4 Pro, 64GB unified memory. Tool calling and thinking tokens work best with sufficient VRAM/unified memory; performance on lower-spec hardware will vary.
Quick start
brew install ollama # one-time prerequisite
pip install local2
local2 setup # pulls required models, writes initial config
local2 # opens the web UI at http://localhost:8000
Prerequisites
- Python 3.11+
- Ollama — download the macOS app or
brew install ollama
Install
pip install local2
local2 setup
local2 setup does three things:
- Writes default config files to
~/.local2/config/ - Pulls
gemma4:e4b(generator + memory classifier) - Pulls
nomic-embed-text(embeddings for memory and RAG library)
Run
local2 # web UI, opens browser at http://localhost:8000
local2 --headless # web server only, no browser pop
local2 --panels # web UI + read-only Qt observer windows
local2 --desktop # legacy PySide6 full desktop UI
local2 --model gemma4:27b # override the generator model at startup
local2 --web-port 9000 # use a different port
Web search
Web search is optional. Two ways to enable it:
Option A — Brave or Tavily (no Docker required)
Get an API key from brave.com/search/api or tavily.com, then edit ~/.local2/config/web_search.yaml:
provider: brave # or: tavily
brave_api_key: sk-... # or tavily_api_key: tvly-...
Option B — SearXNG (self-hosted, no API key)
Requires Docker Desktop.
docker compose up -d
SearXNG runs at http://localhost:8080. This is the default provider if you don't change web_search.yaml.
You need a secret key in .env for SearXNG to start:
echo "MY_SEARX_SECRET=$(openssl rand -hex 32)" > .env
Academic search (optional)
search_papers uses the Semantic Scholar API. It works without a key at the free rate limit (1 req/sec). For higher limits:
echo 'export SEMANTIC_SCHOLAR_API_KEY=<your-key>' >> ~/.zshrc
source ~/.zshrc
Get a free key at semanticscholar.org/product/api.
Configuration
User config lives in ~/.local2/config/. Defaults are written there by local2 setup and can be edited freely — upgrades never overwrite them.
| File | Controls |
|---|---|
generator.yaml |
Model, context size, temperature, tool timeout, system prompt |
web_search.yaml |
Search provider, API keys, max results |
web_fetch.yaml |
Max chars extracted, fetch timeout |
critic.yaml |
Critic model, grading rubric, grade timeout |
memory.yaml |
ChromaDB path, episodic memory collection |
search_memory.yaml |
Max results from memory search |
semantic_scholar.yaml |
Max results, request timeout |
documents.yaml |
Chunk size/overlap, RAG library collections |
location.yaml |
Optional static location override (skips live IP lookup) |
bus.yaml |
ZMQ proxy ports |
system.yaml |
Instance ID, debug flags |
Document library (RAG)
LoCAL2 maintains a persistent local knowledge base you can query with search_library. Use the library window in the Qt UI, or the CLI:
# Ingest one or more files
PYTHONPATH=src python scripts/ingest.py path/to/file.pdf
# List all ingested sources
PYTHONPATH=src python scripts/ingest.py --list
# Delete a source by filename
PYTHONPATH=src python scripts/ingest.py --delete "file.pdf"
Supported formats: PDF, TXT, MD, PY, YAML, JSON, CSV. Files are chunked into 1500-character segments and embedded with nomic-embed-text. Re-ingesting the same file is safe — chunks are upserted by deterministic ID.
After a reboot
Ollama: On macOS, a stale ollama serve process can persist after reboot alongside the freshly launched Ollama.app, splitting IPv4 and IPv6 across two processes. If ollama.chat() hangs silently, check:
pgrep -fl ollama # should show exactly one process
Kill the older PID if two appear.
SearXNG (if using Docker): Docker Desktop needs to be running before docker compose up -d.
Development
Clone the repo and install in editable mode:
git clone https://github.com/rkoike88/LoCAL2
cd LoCAL2
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
Run the app:
python run_local.py # equivalent to 'local2'
Run tests:
make test # or: PYTHONPATH=src python -m pytest tests/ -q
Build a distributable wheel (builds frontend first):
make dist
python -m build
Architecture
See docs/architecture/ for design documents covering the bus topology, agent state machines, tool protocol, and configuration reference.
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 local2-0.1.2.tar.gz.
File metadata
- Download URL: local2-0.1.2.tar.gz
- Upload date:
- Size: 15.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b712534813051f818d6ed151fa546cb0a7a488049a63e452cb7eac3f9c407c88
|
|
| MD5 |
f9834a0285885d36bb04f7a3145e35a2
|
|
| BLAKE2b-256 |
eb63943f6dcef5397f051cc85c7993720e24d3c8cfa36d34a70d11263b5a4682
|
File details
Details for the file local2-0.1.2-py3-none-any.whl.
File metadata
- Download URL: local2-0.1.2-py3-none-any.whl
- Upload date:
- Size: 237.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d97c139cb37101b8851697c5fa6126970fa1a12eb1ad0d4e58424f45613d80e0
|
|
| MD5 |
f8a9dbe04f664974ed379c3902c862be
|
|
| BLAKE2b-256 |
d17040bae94f4659dbab65fc7e8377d5a2476bc35283fb9913bfdf623c21a352
|