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
richPython 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
keyringsupport to securely store API keys outside of plain-text config files. - Advanced Router: Regex-powered command routing and a dedicated
/multimode 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 viagoogle-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
trafilaturacombined withconcurrent.futures.ThreadPoolExecutorto scrape multiple targets simultaneously. - Semantic Ranking: Uses the
BAAI/bge-small-en-v1.5transformer 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:1bin 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
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 riley_ai-0.5.0.tar.gz.
File metadata
- Download URL: riley_ai-0.5.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26062cacf423b5288ba569fb6998bce02b6ccd37b24571d6ce8c3ef3fa29cdfb
|
|
| MD5 |
8fa8c4e0d63b7732addf664ca2f35336
|
|
| BLAKE2b-256 |
e21ed7f01eef29dd622622ce1431eb3928e6c841af868a44f9a91b48a81fc8a4
|
File details
Details for the file riley_ai-0.5.0-py3-none-any.whl.
File metadata
- Download URL: riley_ai-0.5.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50d8f8f62f6d69e7caa1ffedb5a35d55e96c5c406a61358f7bc2517f552c9768
|
|
| MD5 |
0d258bee688d4696559d5d22db837bf0
|
|
| BLAKE2b-256 |
9c33a602f84dfd1daebf5ec3023e9f489f873b2a17e954d47e510591f9f4cb05
|