Query3AI: A multi-agent system combining document structure extraction, relevance filtering, and reasoning with Neo4j.
Project description
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
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 query3ai-0.2.1.tar.gz.
File metadata
- Download URL: query3ai-0.2.1.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b898b8e526bb6f5c45c1221aed7f0baf374afff6198d1fbccee3453fb237bb1f
|
|
| MD5 |
6844eed423a6c1c4b7c726f0e150a630
|
|
| BLAKE2b-256 |
73b7d7ce75543a43b3bb1e9c5598a8a85367e0b338ffb6662960dd6681fcf47c
|
File details
Details for the file query3ai-0.2.1-py3-none-any.whl.
File metadata
- Download URL: query3ai-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21ff3225db841bfa8ce79e12b40cd2a9ac0ce80950f33fd83aab84d089a8b9c8
|
|
| MD5 |
883aa7fde6599c5dac72749f9bafc3ba
|
|
| BLAKE2b-256 |
aaa90095a0e32aad05b7eef5a1c9bc0b5025e09ebf03ce23e2fa17793b3b064a
|