Decorator-First RAG Visualizer
Project description
ragviz (RAG Wizard)
ragviz is a local-first RAG tracing dashboard for Python applications.
It helps you inspect pipeline runs, step latency, inputs/outputs, and execution flow without sending data to the cloud.
This README is the user manual for installing, running, and troubleshooting ragviz.
What You Get
- Decorator mode for explicit tracing (
@visualize_rag,trace_step) - Zero-code-change LangChain mode (
ragviz run -- python app.py) - Local SQLite event storage
- FastAPI API + WebSocket backend
- React dashboard for runs, flow graph, and event timeline
Requirements
- Python
>=3.9 - Node.js (only needed if you want to build the frontend locally)
Installation
Install From Source (Recommended for local development)
git clone <repo-url>
cd ragviz
pip install -e .
Build Frontend Assets (optional, for local UI build)
cd frontend
npm install
npm run build
cd ..
If frontend/dist exists, the backend serves it automatically.
Quickstart
You can use ragviz in two ways:
- Decorator-based tracing for custom Python pipelines
- Zero-code-change LangChain auto-instrumentation via CLI wrapper
Mode 1: Decorator-Based Tracing
Use this when you control the code and want explicit, stable step boundaries.
import time
from ragviz import visualize_rag, trace_step
@visualize_rag
def answer_question(query: str) -> str:
with trace_step("retrieve"):
chunks = retrieve(query)
with trace_step("generate"):
answer = generate(query, chunks)
return answer
def retrieve(query: str):
time.sleep(0.2)
return ["chunk1", "chunk2"]
def generate(query: str, chunks: list[str]):
time.sleep(0.4)
return f"Answer for {query} using {len(chunks)} chunks"
if __name__ == "__main__":
answer_question("What is ragviz?")
Run your script, then start the UI server:
ragviz serve --port 8787
Open http://localhost:8787.
Mode 2: Zero-Code-Change LangChain Tracing
Use this when you do not want to edit application code.
ragviz run -- python your_langchain_app.py
What this does:
- installs LangChain callback auto-instrumentation
- runs your script in-process so callbacks are active
- starts the ragviz UI server (unless
--no-serveris passed)
Smoke example:
ragviz run -- python examples/langchain_smoke.py
Dashboard Guide
Left Panel: Pipeline Runs
- Lists recent runs ordered by time
- Shows run status and total duration
- Click a run to open details
Top Right: Execution Flow
- DAG-like flow rendered from parent-child step relationships
- Shows step type (
step_started,step_completed,step_failed) - Dashed fallback edges connect orphan root nodes
Bottom Right: Event Timeline
- Full step log in chronological order
- Inputs and outputs shown as JSON blocks
- Errors shown inline with highlighting
CLI Reference
ragviz serve
Starts only the backend/dashboard server.
ragviz serve --port 8787
ragviz run
Runs a Python script with optional auto-instrumentation.
ragviz run -- python app.py
ragviz run --no-server -- python app.py
Arguments:
--port <int>: UI server port (default8787)--no-server: do not run the FastAPI UI server--: separator before Python command
API Endpoints
GET /api/health- health probeGET /api/runs- list recent runsGET /api/runs/{run_id}/steps- list steps for one runWS /api/ws- live event stream
Project Structure
ragviz/
├── ragviz/
│ ├── __init__.py
│ ├── cli.py
│ ├── decorator.py
│ ├── langchain_integration.py
│ ├── event_bus.py
│ ├── storage.py
│ ├── server.py
│ └── redaction.py
├── frontend/
│ ├── src/
│ └── dist/ # generated
├── examples/
│ └── langchain_smoke.py
├── pyproject.toml
└── README.md
Troubleshooting
No runs appear in UI
- Ensure your script actually executed traced code.
- For decorator mode, confirm
@visualize_ragis applied to the top-level pipeline function. - For LangChain mode, run with:
ragviz run -- python your_script.py
WebSocket updates not live
- Refresh page and check
ws://localhost:8787/api/ws. - If using HTTPS, ensure browser uses
wss://.
LangChain auto mode says not detected
- Install compatible packages:
pip install langchain langchain-core
Data file location
- SQLite DB defaults to
ragviz.dbin current working directory. - Override with:
RAGVIZ_DB_PATH=/path/to/db.sqlite
UI missing or blank
- Build frontend assets:
cd frontend && npm install && npm run build
FAQ
Is data sent to any cloud service?
No. Data stays local unless your own pipeline sends data externally.
Do I need decorators for LangChain?
No. ragviz run supports zero-code-change instrumentation for LangChain.
Can I use both decorator and LangChain auto mode?
Yes, but you may capture overlapping traces. Prefer one approach per run for cleaner timelines.
Is this production telemetry?
This is currently a developer observability tool focused on local debugging and UX.
Local Development
pip install -e .
cd frontend
npm install
npm run dev
In another terminal:
ragviz serve --port 8787
Release Notes for Maintainers
- Package metadata and wheel/sdist configuration live in
pyproject.toml. - Keep root clean (no duplicate top-level package modules).
- Validate before release:
python3 -m build
python3 -m twine check dist/*
Happy hacking with ragviz.
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 ragviz-0.1.1.tar.gz.
File metadata
- Download URL: ragviz-0.1.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55ed620d4c670a7a65b044e2430b47333d279f5b34096f95bea7ddbae6d97a97
|
|
| MD5 |
ae6351a3c847f0bcad5c16e9ac87c370
|
|
| BLAKE2b-256 |
c91705e9c866f2382f8abc84fdebc641b1ba1bda9431d90d0a2eff38fa654032
|
File details
Details for the file ragviz-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ragviz-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aedffabd9501130c79bf4402186f370c63092c1ee1f437968abed09da87fc207
|
|
| MD5 |
7a178de313479681ff041c3c42e4c98d
|
|
| BLAKE2b-256 |
7fee83001980654f96c3b1e5ae6396b0ee5058a3c1602d45a54992d9ee7a90ee
|