Skip to main content

Riley: A witty, Agentic AI orchestrator with RAG, web search, and symbolic math tools.

Project description

๐Ÿค– Riley AI

The Witty, Agentic Orchestrator

Riley AI is a high-performance, open-source orchestration framework designed to bridge the gap between static LLM chats and dynamic, autonomous problem-solving. Instead of just talking, Riley researches, calculates, and self-corrects using a deterministic logic router.

Equipped with a "cool older sibling" personality, Riley delivers casually brilliant answers while transparently handling complex tool chains and RAG pipelines in the background.


โœจ Core Features & Capabilities

  • Concurrent Web RAG (โšก New): A highly optimized, multi-threaded scraping pipeline. Benchmarks show a ~1.77x speedup (averaging 3.0s vs 5.3s) over sequential fetching when digesting heavy documentation.
  • Transparent Token Tracking (๐Ÿ“Š New): Real-time visibility into context window usage. Riley reports input, output, and total tokens per interaction directly in the terminal.
  • Rich Terminal UI: A gorgeous, highly readable interface powered by the rich Python library, featuring syntax highlighting, live streaming updates, and dynamic progress spinners.
  • Multi-Provider Brain: Native optimization for the Gemini API (Google Provider) with a seamless, fully-offline fallback to local LLMs (Ollama Provider).
  • Deterministic Math Engine: Uses SymPy to offload arithmetic, algebra, and calculus, guaranteeing 100% mathematical accuracy without LLM hallucinations.
  • Secure Credential Management: Integrated Python keyring support to securely store API keys outside of plain-text config files.
  • Advanced Router: Regex-powered command routing and a dedicated /multi mode for handling large data pastes.

๐Ÿง  Core Architecture

1. The Provider Abstraction

Riley dynamically shifts between cloud and local processing:

  • Cloud Tier (Primary): Leverages Google Gemini (gemini-2.5-flash) for high-reasoning tasks, massive context windows, and native tool orchestration via google-genai.
  • Local Tier (Fallback): Seamlessly drops back to local providers like Ollama (defaults to llama3.2:1b) for offline use or maximum privacy.
  • Agentic Loop: Uses a Self-Correction Loopโ€”if a tool fails, Riley analyzes the error and automatically tries again for up to 5 execution iterations.

2. Privacy-Centric Web RAG

Riley breaks the knowledge cutoff by crawling the live web:

  • SearXNG & DuckDuckGo: Attempts to route through a local SearXNG instance first, with a seamless fallback to tracker-free DuckDuckGo search.
  • Concurrent Extraction: Uses trafilatura combined with concurrent.futures.ThreadPoolExecutor to scrape multiple targets simultaneously.
  • Semantic Ranking: Uses the BAAI/bge-small-en-v1.5 transformer to chunk and rank scraped text via cosine similarity, ensuring Riley only reads the most relevant data.

๐Ÿš€ Installation & Setup

Global Install (via uv) - โœจ Recommended

Since Riley is a unified CLI tool, the absolute best way to install it is by using uv tool. This isolates Riley's dependencies and exposes the riley command globally without breaking your system Python:

uv tool install riley-ai

*To upgrade later: uv tool upgrade riley-ai*

For Users (via standard PyPI)

If you prefer the traditional pip route:

pip install riley-ai

For Developers (via Source)

This project is optimized for the uv package manager. To work on the codebase directly:

git clone https://codeberg.org/ChocolatePastry/riley-ai.git
cd riley-ai
uv venv
uv pip install -e .

๐Ÿ“ฆ Recommended Dependencies

To unlock Riley's full potential (local fallback logic and private web RAG), it is highly recommended to install the following ecosystem tools:

  • Ollama (Local AI Fallback): Essential for running models offline if you don't supply a Gemini key.

  • Install: Download from Ollama's Website.

  • Setup: Run ollama run llama3.2:1b in your terminal to pull Riley's default local model.

  • SearXNG (Private Web RAG): For a completely air-gapped, tracker-free search experience.

  • Setup: Follow the SearXNG Docker Documentation to spin up your local instance on 127.0.0.1:8888.


๐Ÿ›  Usage & Examples

Start the orchestrator by simply typing:

riley

1. The "Agentic" Research Loop

Riley uses the WebRAGPipeline to find real-time data. The internal thought process is surfaced via the Agent Scratchpad.

โžœ You > Who won Best Picture at the 2026 Oscars? ๐Ÿง  [Logic Engine] Scraping 98th Academy Awards databases... โœง Riley: I sifted through endless gigabytes of Hollywood vanity pages just to save you a basic web search. Paul Thomas Anderson finally got his trophy. Please give me a real challenge next time. Final Result: One Battle After Another ๐Ÿ“Š Tokens Used -> Context Input: 1240 | Output: 45 | Total: 1285

2. Precise Symbolic Math

Riley bypasses LLM math and offloads to SymPy for guaranteed results.

โžœ You > Solve x + y = 10, x - y = 2 ๐Ÿง  [Logic Engine] Mapping variables x and y. Parsing equations... โœง Riley: Iโ€™ve crunched the numbers. x = 6, y = 4. Honestly, I could do this in my sleep. Final Result: {x: 6, y: 4}


โšก Power Commands

Riley includes a local regex router that intercepts commands before they reach the LLM, saving tokens and execution time:

Command Description
/multi Activates multi-line input mode. Paste large blocks of text/code, and type /send on a new line to submit.
/set_api_key <key> Securely updates your Gemini API key in the OS keyring and dynamically swaps the provider to Google. If run without a key, it prompts for secure hidden input.
/calculate <expr> Bypasses the LLM router and forces the SymPy calculator tool to run directly on the expression.
/web_search <query> Bypasses the LLM router and forces the Web RAG pipeline to search and rank chunks for the query.
exit / quit Triggers a sarcastic parting shot and cleanly exits the application.

๐Ÿ“‚ Project Structure

riley-ai/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ riley/
โ”‚       โ”œโ”€โ”€ __init__.py              # Enables package imports.
โ”‚       โ”œโ”€โ”€ smart_chatbot.py         # CLI entry point and UI loop.
โ”‚       โ”œโ”€โ”€ chatsession.py           # Logic for history and tool loops.
โ”‚       โ”œโ”€โ”€ style.py                 # UI themes and console styling.
โ”‚       โ”œโ”€โ”€ config/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py          # Enables config sub-package.
โ”‚       โ”‚   โ””โ”€โ”€ model_config.py      # Settings and API key management.
โ”‚       โ”œโ”€โ”€ provider/
โ”‚       โ”‚   โ”œโ”€โ”€ __init__.py          # Enables provider sub-package.
โ”‚       โ”‚   โ”œโ”€โ”€ base_provider.py     # Base LLM interface and telemetry.
โ”‚       โ”‚   โ”œโ”€โ”€ google_provider.py   # Google Gemini integration.
โ”‚       โ”‚   โ””โ”€โ”€ ollama_provider.py   # Local Ollama fallback.
โ”‚       โ””โ”€โ”€ tools/
โ”‚           โ”œโ”€โ”€ __init__.py          # Enables tools sub-package.
โ”‚           โ”œโ”€โ”€ calculator.py        # Symbolic math engine.
โ”‚           โ””โ”€โ”€ web_scraper.py       # Concurrent web RAG pipeline.
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ __init__.py                  # Enables test discovery.
โ”‚   โ”œโ”€โ”€ test_core.py                 # Core functional unit tests.
โ”‚   โ””โ”€โ”€ benchmark_scraper.py         # Scraper performance benchmarks.
โ””โ”€โ”€ pyproject.toml                   # Project metadata and dependencies.

๐Ÿงช Testing & Benchmarking

To ensure system stability and verify concurrency performance on your hardware, run the included test suite:

Run Core Unit Tests:

uv run python -m unittest tests.test_core

Run Web RAG Concurrency Benchmark:

uv run python -m unittest tests.benchmark_scraper

๐Ÿ“œ License & Philosophy

Licensed under GPLv3. Riley is designed to be a "lazy framework"โ€”modify the code, add new tools, and help the orchestrator grow.

"Iโ€™m not saying Iโ€™m better than a standard chatbot... Iโ€™m just saying I actually check my facts before I speak." โ€” Riley

Project details


Download files

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

Source Distribution

riley_ai-0.5.1.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

riley_ai-0.5.1-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

Details for the file riley_ai-0.5.1.tar.gz.

File metadata

  • Download URL: riley_ai-0.5.1.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for riley_ai-0.5.1.tar.gz
Algorithm Hash digest
SHA256 140795b1f2e28b9f36df3315869de98c9307efef1fd57dd3efc8cbb3ed662307
MD5 b7a0336cdd101f7167765bea0b78ffad
BLAKE2b-256 35eb5ebbaf0ab81c04e01b8401ec2fca4cf9ac7f4a1512b19c9eb97c8bac0698

See more details on using hashes here.

File details

Details for the file riley_ai-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: riley_ai-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for riley_ai-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a7e5f40e024f494315c7f5f354f3ec9a222b3b356e22c4d8e178af7d51360d2
MD5 5d59ce8c261f894d0f0416812e76151e
BLAKE2b-256 7e10925beac1eadb6320f38babb24cafe3216f951de33e74a86cbc44ad7b7ecf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page