Skip to main content

localist

Local agentic framework on Ollama — give your local LLM sandboxed access to filesystem, web, shell, and OS tools via a ReAct reasoning loop.

PyPI version Python 3.11+ License: MIT


What is this?

localist is a Python library that wraps any Ollama-served model and gives it the ability to autonomously:

  • 📂 Read / write / delete files inside a sandboxed workspace
  • 🌐 Search the web (DuckDuckGo, or Brave Search API)
  • 🖥️ Run shell commands (behind a denylist + confirmation gate)
  • 📋 Use OS features — clipboard, notifications, process management

It implements a ReAct-style loop (Reason → Act → Observe → repeat) and supports both models with native tool-calling (Qwen2.5, Llama 3.1+) and text-based tool-calling for any other model.


Quick Start

# Install
pip install localist

# Make sure Ollama is running
ollama serve
ollama pull qwen2.5:7b

# Run a task
localist --task "Create a file called hello.txt with today's date, then list the workspace"

Installation

# Core library + CLI
pip install localist

# With web UI (FastAPI + Uvicorn)
pip install "localist[ui]"

# Development
pip install "localist[dev]"

Usage

Python API

from localist import Agent

agent = Agent(model="qwen2.5:7b", workspace_root="./workspace")
result = agent.run("Search for the latest Python release and save a summary to workspace/python_news.txt")
print(result)

Streaming events

from localist import Agent
from localist.agent import ToolCallEvent, FinalAnswerEvent

agent = Agent(model="qwen2.5:7b")

for event in agent.stream("Summarise all .txt files in workspace"):
    if isinstance(event, ToolCallEvent):
        print(f"  🔧 Calling: {event.tool}({event.args})")
    elif isinstance(event, FinalAnswerEvent):
        print(f"\n✅ Answer:\n{event.content}")

Custom tools

from localist import Agent, register_tool

@register_tool
def count_words(text: str) -> int:
    """Count the number of words in a text string.

    Args:
        text: The input text to count words in.
    """
    return len(text.split())

agent = Agent(model="qwen2.5:7b")
result = agent.run("Count the words in 'The quick brown fox jumps over the lazy dog'")

CLI

# Single task
localist --task "Create a Python script that generates the Fibonacci sequence"

# Custom model and workspace
localist --task "..." --model llama3.1:8b --workspace ~/myproject

# Interactive REPL
localist --interactive

# Web UI (requires pip install localist[ui])
localist --ui

# List available Ollama models
localist --list-models

# Disable confirmation prompts (for scripts/automation)
localist --task "..." --no-confirm

Tools

Tool Description Confirmation required?
file_read Read file contents No
file_write Create/overwrite a file No (overwrite)
file_append Append to a file No
file_delete Delete a file Yes
list_dir List directory contents No
web_search Search web (DuckDuckGo / Brave) No
web_fetch Fetch and extract text from URL No
shell_exec Run a shell command Yes
clipboard_get Read clipboard No
clipboard_set Write clipboard No
notify OS desktop notification No
process_list List running processes No
process_kill Terminate a process by PID Yes

Configuration

Copy .env.example to .env and edit:

LOCALIST_MODEL=qwen2.5:7b
LOCALIST_WORKSPACE_ROOT=./workspace
LOCALIST_MAX_ITERATIONS=20
LOCALIST_REQUIRE_CONFIRMATION=true
BRAVE_API_KEY=          # optional — enables Brave Search API

All settings can also be passed programmatically:

from localist.config import LocalistConfig
from localist import Agent

cfg = LocalistConfig(model="llama3.1:8b", max_iterations=10, require_confirmation=False)
agent = Agent(config=cfg)

Safety

  • Filesystem jail: every path is resolved against workspace_root; .. traversal, symlink escapes, and absolute paths outside the workspace are rejected with SandboxViolationError.
  • Shell denylist: shell_exec blocks rm, sudo, curl, python, shell interpreters, and other high-risk binaries. No shell=True anywhere.
  • Confirmation gate: file_delete, shell_exec, and process_kill require explicit human approval (configurable).
  • Hard iteration cap: the loop stops after max_iterations (default: 20) to prevent infinite loops.
  • Audit logging: every tool call, result, and confirmation is written to logs/audit_<date>.jsonl.

Model Recommendations

Model Tool-calling Notes
qwen2.5:7b / qwen2.5:32b Native Best balance of speed and reliability
llama3.1:8b / llama3.3:70b Native Strong general reasoning
hermes3 Native Optimised for agentic tasks
mistral-nemo Native Fast, solid tool support
Any other model Text protocol Automatic fallback with JSON repair

Build and Publish

# Install build tools
pip install build twine

# Build
python -m build

# Validate
twine check dist/*

# Upload to TestPyPI
twine upload --repository testpypi dist/*

# Upload to PyPI
twine upload dist/*

Development

git clone https://github.com/placeholder/localist
cd localist
pip install -e ".[dev]"
pytest tests/ -v

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localist-0.1.0.tar.gz (41.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localist-0.1.0-py3-none-any.whl (45.7 kB view details)

Uploaded Python 3

File details

Details for the file localist-0.1.0.tar.gz.

File metadata

  • Download URL: localist-0.1.0.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for localist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a712e56cda9724faa5b33b923ce3ebca5f4736d1188040f62d6b7137e9664131
MD5 fae70d47791082f3318316c4b036935e
BLAKE2b-256 ecda1499fd0612763f4ec900706e46fbf96fae1ca97d5e792f2faa0e329afbf7

See more details on using hashes here.

File details

Details for the file localist-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: localist-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.0

File hashes

Hashes for localist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8861528a589120bcf2a8e53222b58073b7da42d0a995856ccebb9b8e90c7823e
MD5 8a2ff1ea84ecd1b1587273e8fb096d9a
BLAKE2b-256 763ed03087bdbe9871b8e68672a212062e488c759ece1eaffee93614a8749bdb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page