Self-Healing Knowledge Graph for RAG Pipelines - pip-installable library
Project description
๐ก๏ธ Sentinel: Self-Healing Temporal Knowledge Graph
Sentinel is an autonomous knowledge graph that automatically scrapes, extracts, stores, and maintains structured knowledge from the web. It uses AI to understand content, tracks changes over time, and heals itself when information becomes stale.
๐ Key Features
- ๐ค Autonomous: Automatically scrapes, extracts, and updates knowledge
- โฐ Temporal: Track how knowledge evolves over time
- ๐ง Self-Healing: Detects and updates stale information automatically
- ๐ง AI-Powered: Uses LLMs to extract entities and relationships
- ๐ Graph-Based: Stores knowledge in a Neo4j temporal graph
- ๐ Web Scraping: Intelligent scraping with Firecrawl or local fallback
- ๐ป Developer-Friendly: Simple Python API and CLI tool
- ๐จ Beautiful UI: 3D graph visualization with Next.js
๐ Quick Start
Installation
pip install sentinel-core[all]
Setup
# Interactive setup wizard
python sentinel_cli.py init
# Or manually create .env file
cat > .env << EOF
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=your-password
OLLAMA_MODEL=llama3
EOF
Start Services
# Start Neo4j
docker run -d -p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/password \
neo4j:latest
# Start Ollama (for local LLM)
ollama serve
ollama pull llama3
Your First Knowledge Graph
# Process a URL
python sentinel_cli.py watch https://stripe.com/pricing
# Check status
python sentinel_cli.py status
# View in UI
cd sentinel_platform/ui
npm install && npm run dev
# Visit http://localhost:3000
๐ Usage
Python API
import asyncio
from sentinel_core import Sentinel, GraphManager, GraphExtractor
from sentinel_core.scraper import get_scraper
async def main():
# Initialize
graph = GraphManager()
scraper = get_scraper()
extractor = GraphExtractor(model_name="ollama/llama3")
sentinel = Sentinel(graph, scraper, extractor)
# Process URL
result = await sentinel.process_url("https://example.com")
print(f"Extracted {result['extracted_nodes']} nodes!")
# Query graph
snapshot = graph.get_graph_snapshot()
print(f"Total: {snapshot['metadata']['node_count']} nodes")
graph.close()
asyncio.run(main())
CLI Tool
# Show version
python sentinel_cli.py version
# Check system status
python sentinel_cli.py status
# Process a URL
python sentinel_cli.py watch https://example.com
# Run healing cycle
python sentinel_cli.py heal --days 7
# Interactive setup
python sentinel_cli.py init
๐ฏ Use Cases
1. Product Pricing Monitoring
Track pricing changes across competitors automatically.
urls = [
"https://stripe.com/pricing",
"https://paypal.com/pricing",
"https://square.com/pricing"
]
for url in urls:
await sentinel.process_url(url)
2. Documentation Tracking
Monitor documentation changes for your favorite libraries.
docs = {
"React": "https://react.dev/learn",
"Next.js": "https://nextjs.org/docs",
}
for name, url in docs.items():
await sentinel.process_url(url)
# Auto-heal to detect changes
await sentinel.run_healing_cycle(days_threshold=7)
3. News Aggregation
Build a knowledge graph from multiple news sources.
news_sources = [
"https://techcrunch.com/",
"https://theverge.com/",
]
for url in news_sources:
await sentinel.process_url(url)
4. Research Paper Tracking
Track research papers and their citations.
papers = [
"https://arxiv.org/abs/2303.08774", # GPT-4
"https://arxiv.org/abs/2005.14165", # GPT-3
]
for paper in papers:
await sentinel.process_url(paper)
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Sentinel System โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Scraper โโโโโถโ Extractor โโโโโถโ Graph Store โ โ
โ โ(Firecrawlโ โ (LLM + โ โ (Neo4j) โ โ
โ โor Local) โ โInstructor)โ โ Temporal โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโถโ Sentinel โโโโโโโโโโโโโโ โ
โ โOrchestratorโ โ
โ โโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ Healing Loop โ โ
โ โ (Auto-Updates) โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Documentation
๐ ๏ธ Development
Setup Development Environment
# Clone repository
git clone https://github.com/Om7035/Sentinel-The-Self-Healing-Knowledge-Graph
cd Sentinel-The-Self-Healing-Knowledge-Graph
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[all]"
# Run tests
pytest tests/
Project Structure
sentinel/
โโโ sentinel_core/ # Core library (pip-installable)
โ โโโ scraper/ # Web scraping (Firecrawl + Local)
โ โโโ graph_store.py # Neo4j temporal graph
โ โโโ graph_extractor.py # LLM-based extraction
โ โโโ orchestrator.py # Main Sentinel class
โโโ sentinel_platform/ # Demo platform
โ โโโ api/ # FastAPI backend
โ โโโ ui/ # Next.js frontend
โโโ tests/ # Test suite
โโโ docs/ # Documentation
โโโ sentinel_cli.py # CLI tool
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with LangChain, Neo4j, and FastAPI
- Inspired by the need for self-maintaining knowledge systems
- Special thanks to the open-source community
๐ง Contact
- Author: Om Kawale
- Email: speedtech602@gmail.com
- GitHub: @Om7035
- Project: Sentinel
โญ Star History
If you find Sentinel useful, please consider giving it a star! โญ
Made with โค๏ธ by Om Kawale
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
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 sentinel_core-0.1.0.tar.gz.
File metadata
- Download URL: sentinel_core-0.1.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dd07bf38fb9096017c0802ce117712ae6568dcf74eff3734306072b418881c9
|
|
| MD5 |
7c9412c381a0a95a2bd072d12e860f59
|
|
| BLAKE2b-256 |
b8811e6caa8d2bfe17080d2c3f5551e0cd8e46f17a9eaa64b47b20d41af2d291
|
File details
Details for the file sentinel_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sentinel_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4b07d4d641d5f06042761c495ba91eaac6bd10a2b07c2a9e5ab163eb6df369c
|
|
| MD5 |
65fcebd358e4193bb719225db8b044dd
|
|
| BLAKE2b-256 |
092e9c13ca218e6ec732c2408543095eab4698827e0d77a577e7402b309ce9b5
|