Query3AI
An intelligent, local-first document query system powered by a 3-Agent AI pipeline and Neo4j graph storage.
What Is Query3AI?
Query3AI lets you ingest documents (PDF, DOCX, TXT, MD) and query them in natural language. It does not flatten your documents into a pile of text chunks like standard AI tools. It reads the structure, builds a knowledge graph, and reasons with three specialised AI agents — one to organise, one to filter, one to answer.
# Install once
pip install query3ai
# Initialize workspace (creates ~/.query3ai with config)
query3ai init
# Start Neo4j
query3ai start-db
# Ingest documents
query3ai ingest report.pdf
# Query with interactive chat
query3ai chat
No cloud required. No API keys needed for local models. Runs on a standard laptop.
Installation
From PyPI (Recommended)
pip install query3ai
From Source
git clone https://github.com/vivekvpai/Query3AI.git
cd Query3AI
pip install -e .
Quick Start
1. Initialize Query3AI
# Global workspace (default - stores config in ~/.query3ai)
query3ai init
# Or local workspace (creates config in current directory)
query3ai init --local
This creates:
~/.query3ai/docker-compose.yml- Neo4j configuration~/.query3ai/.env- Environment variables~/.query3ai/config.json- Model configuration
2. Start Neo4j
query3ai start-db
Or manually with Docker:
docker run -p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/query3ai \
neo4j:latest
Default connection:
- URI:
bolt://localhost:7687 - User:
neo4j - Password:
query3ai
3. Start Ollama (Optional - for local models)
# Make sure Ollama is running
ollama serve
# Pull the three agent models
ollama pull phi3.5 # Tree Agent
ollama pull gemma2:2b # Decision Agent
ollama pull deepseek-r1:7b # Reasoning Agent
4. Ingest and Query
# Ingest a document
query3ai ingest path/to/document.pdf
# Start interactive chat
query3ai chat
CLI Commands
| Command | Description |
|---|---|
query3ai init |
Initialize workspace in ~/.query3ai |
query3ai init --local |
Initialize workspace in current directory |
query3ai start-db |
Start Neo4j via docker-compose |
query3ai stop-db |
Stop Neo4j |
query3ai ingest <file> |
Ingest a PDF, DOCX, TXT, or MD file |
query3ai ask "<question>" |
Query all ingested documents |
query3ai ask "<question>" --cloud |
Query using cloud models |
query3ai list |
List all ingested documents |
query3ai inspect <doc_id> |
Inspect a document's tree structure |
query3ai delete <doc_id> |
Delete a document and all its nodes |
query3ai chat |
Start interactive TUI chat |
The 3-Agent Pipeline
Document
│
▼
[Agent 1 — Tree AI] phi3.5 / qwen3.5:cloud
Builds hierarchical tree: Document → Sections → Chunks
│
▼
Neo4j Graph Database
│
▼
[Agent 2 — Decision AI] gemma2:2b / kimi-k2.5:cloud
Filters sections by relevance to the query (YES/NO)
│
▼
[Agent 3 — Reasoning AI] deepseek-r1:7b / glm-5:cloud
Generates final answer from filtered context only
│
▼
Answer + Source Sections
Model Configuration
Query3AI uses a "Mix and Match" architecture, meaning you can configure different providers (Local, OpenAI, Groq, etc.) for each of the three agents simultaneously.
Edit ~/.query3ai/config.json to customize models, keys, and base URLs:
{
"TREE_API_KEY": "sk-proj-...",
"DECISION_API_KEY": "gsk-...",
"REASONING_API_KEY": "",
"TREE_MODEL": "openai/gpt-4o",
"DECISION_MODEL": "groq/llama-3.3-70b-versatile",
"REASONING_MODEL": "ollama/qwen3-32b",
"TREE_API_BASE": "",
"DECISION_API_BASE": "",
"REASONING_API_BASE": "http://localhost:11434"
}
This allows you to leverage the best model for each specific task (e.g. OpenAI for high-context tree structuring, Groq for lightning-fast decision processing, and local Ollama for reasoning security).
Interactive Chat
Start the TUI chat interface:
query3ai chat
Slash Commands
| Command | Action |
|---|---|
/about |
Learn about Query3AI |
/help |
Display all available commands |
/ingest <path> |
Ingest a new document |
/listdocs |
List all indexed documents |
/list |
Show total sections and chunks |
/deletedoc |
Remove a document from database |
/cleanupdocs |
Delete all documents |
/cleanupresorce |
Clean up temporary files |
/clear |
Clear terminal |
/exit |
Exit chat |
Requirements
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 8 GB | 16 GB |
| CPU | 4 cores | 8 cores |
| GPU | Not required | Optional |
| Python | 3.8+ | 3.10+ |
| Storage | 10 GB free | 20 GB free |
Tech Stack
| Layer | Technology |
|---|---|
| CLI | Typer + Rich |
| AI Inference | Ollama, Groq |
| Local Models | phi3.5, gemma2:2b, deepseek-r1:7b |
| Cloud Models | qwen3.5:cloud, kimi-k2.5:cloud, glm-5:cloud |
| Graph Database | Neo4j |
| Document Parsing | PyMuPDF, python-docx |
License
MIT
Metadata
Release files for query3ai 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| query3ai-0.2.1.tar.gz | 30.1 kB | Without provenance | Details for query3ai-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| query3ai-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for query3ai-0.2.1-py3-none-any.whl |
Total release size: 63.2 kB
Release files / query3ai-0.2.1.tar.gz
| Download URL | query3ai-0.2.1.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b898b8e526bb6f5c45c1221aed7f0baf374afff6198d1fbccee3453fb237bb1f
|
|
BLAKE2b-256 checksum How to use checksums |
73b7d7ce75543a43b3bb1e9c5598a8a85367e0b338ffb6662960dd6681fcf47c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / query3ai-0.2.1-py3-none-any.whl
| Download URL | query3ai-0.2.1-py3-none-any.whl |
|---|---|
| Size | 33.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21ff3225db841bfa8ce79e12b40cd2a9ac0ce80950f33fd83aab84d089a8b9c8
|
|
BLAKE2b-256 checksum How to use checksums |
aaa90095a0e32aad05b7eef5a1c9bc0b5025e09ebf03ce23e2fa17793b3b064a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for query3ai 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.