Local-first multi-agent scientific assistant for rigorous research in mathematics, numerical methods, and data science.
Scientific Assistant is a local-first multi-agent system designed for rigorous scientific research. It combines 8 specialized agents with RAG (Retrieval-Augmented Generation) to deliver precise, reproducible, and citation-backed analyses.
- 🔒 100% Local - Your data stays private (Ollama + ChromaDB)
- 🎯 Specialized - Built for rigorous scientific workflows
- 🤖 Multi-agent - 8 expert agents collaborate in synergy
- 📚 Advanced RAG - Hybrid vector + keyword retrieval
- 🔬 Reproducible - Generates executable Python code
- 📝 Documentation-ready - Automatic LaTeX and APA/BibTeX citations
| Agent | Role | Expertise |
|---|---|---|
| Planner | Orchestration | Research task decomposition |
| Mathematician | Symbolic analysis | Mathematical proofs, theorems |
| Numerical | Simulation | Numerical methods, convergence |
| Data Scientist | Statistics | ML, data analysis, uncertainty |
| Literature | Retrieval | RAG + web search, citations |
| Reviewer | Quality | Verification, error detection |
| Writer | Writing | Academic writing, LaTeX |
| Memory | Knowledge | Knowledge base management |
- ✅ Symbolic mathematical analysis (SymPy)
- ✅ Numerical simulations (NumPy, SciPy, scikit-learn)
- ✅ Document ingestion (PDF, TXT, Markdown)
- ✅ Semantic retrieval with embeddings
- ✅ Executable Python code generation
- ✅ Automatic citations (APA, BibTeX)
- ✅ LaTeX export for publications
- LLM: Ollama (mistral, llama2, neural-chat...)
- Orchestration: LangChain + LangGraph
- Vector DB: ChromaDB + FAISS (hybrid)
- Embeddings: sentence-transformers
- API: FastAPI
- UI: Streamlit
- Logging: Loguru
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone repository
git clone https://github.com/Geobatpo07/scientific-assistant.git
cd scientific-assistant# Sync environment (very fast with uv)
uv sync
# Download an Ollama model
ollama pull mistral# Method 1: All-in-one script (recommended)
uv run python scripts/run_local.py
# Method 2: PowerShell
.\Makefile.ps1 run
# Method 3: Docker
docker compose up -d --buildAccess:
- 🌐 Web UI: http://localhost:8501
- 📡 API: http://localhost:8000
- 📚 API Docs: http://localhost:8000/docs
# Copy sample environment file
cp .env.example .env
# Customize if needed (defaults are usable)
# - LLM model
# - Chunk size
# - Log level
# etc.- Open http://localhost:8501
- Enter your research question
- Select the agents you want to use
- Click Run Research
- Explore outputs in the result tabs
# Run a research workflow
curl -X POST "http://localhost:8000/api/research" \
-H "Content-Type: application/json" \
-d '{
"query": "Analyze stability of explicit Euler method",
"agents": ["planner", "mathematician", "numerical", "reviewer"]
}'
# Search the knowledge base
curl -X POST "http://localhost:8000/api/search" \
-H "Content-Type: application/json" \
-d '{
"query": "finite difference methods",
"search_type": "scientific",
"max_results": 5
}'
# Check system health
curl http://localhost:8000/api/healthfrom app.agents.graph import create_orchestrator
orchestrator = create_orchestrator()
context = orchestrator.run_research(
"What are the stability conditions for the Euler method?"
)
print(context.final_summary)
print(context.mathematical_insights)
print(context.numerical_results)# Ingest a PDF
uv run python scripts/ingest_docs.py data/papers/my_article.pdf
# Ingest a full folder
uv run python scripts/ingest_docs.py data/papers/
# Reset the database (warning!)
uv run python scripts/reset_db.py --confirmSupported formats: PDF, TXT, Markdown
Pipeline:
- Document loading
- Chunking (with overlap)
- Embedding generation
- ChromaDB storage
- FAISS indexing for fast retrieval
# Build and start
docker compose up -d --build
# View logs
docker compose logs -f
# Stop services
docker compose downscientific-assistant/
├── 📁 app/ # Main source code
│ ├── agents/ # 🤖 Multi-agent system
│ ├── vectorstore/ # 🗄️ ChromaDB + FAISS + LangChain-Chroma
│ ├── llm/ # 🧠 Ollama + Embeddings integration
│ ├── rag/ # 📚 RAG chains + citations
│ ├── tools/ # 🔧 Scientific tools
│ ├── ingestion/ # 📥 Document processing
│ ├── api/ # 🌐 FastAPI REST
│ ├── ui/ # 🎨 Streamlit interface
│ └── utils/ # 📝 Logging (Loguru), helpers
├── 📁 docs/ # 📖 Full documentation
├── 📁 examples/ # 💡 Code examples
├── 📁 scripts/ # 🛠️ Utility scripts
├── 📁 tests/ # 🧪 Unit tests
├── 📁 data/ # 💾 Ingested documents
├── 📁 chroma/ # 🗃️ ChromaDB persistence
├── 📄 pyproject.toml # 📦 Dependencies (uv)
├── 🐳 docker-compose.yml # Docker orchestration
└── 📄 README.md
Question → PlannerAgent → Specialized routing
↓
┌───────────┼───────────┐
↓ ↓ ↓
MathAgent NumericalAgent DataScientist
↓ ↓ ↓
└───────────┼───────────┘
↓
ReviewerAgent
↓
WriterAgent
↓
MemoryAgent
↓
Final result
- ChromaDB: Persistent storage + rich metadata
- FAISS: Fast top-K retrieval (ID-level)
- LangChain-Chroma: Integration with LangChain ecosystem
- Reranking: Cosine similarity + keyword boost
- Fallback: If FAISS is empty, use ChromaDB only
📖 Full documentation is available in docs/
- 🚀 Getting Started - Installation and first steps
- 🔗 LangChain-Chroma - Vector store integration
- 📝 Loguru Logging - Logging system
- 🎨 Design Guide - UI and design references
- 📑 Documentation Index - Full navigation
examples/example_5_langchain_chroma.py- ChromaDB usageexamples/example_6_scientific_rag.py- Scientific RAG workflowexamples/example_7_loguru_features.py- Advanced logging
# Run all tests
uv run pytest tests/
# Run with coverage
uv run pytest --cov=app tests/
# Run a specific test file
uv run pytest tests/test_agents.py -v# Formatter (Black)
black app/ tests/
# Sort imports
isort app/ tests/
# Type checking
mypy app/
# Linter
ruff check app/- Fork the project
- Create a branch (
git checkout -b feature/amazing) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing) - Open a Pull Request
Ollama not found
# Install from https://ollama.ai
ollama serve # Run in a separate terminalChromaDB errors
# Reset the database
uv run python scripts/reset_db.py --confirmMemory issues
- Reduce
CHUNK_SIZEin.env - Use a smaller model (
phi,mistralinstead ofllama2-70b) - Lower
TOP_K_RETRIEVAL
Debug logs
# Logs are stored in logs/
tail -f logs/scientific_assistant_*.log- Models: Prefer
mistralorphifor fast iteration - Temperature: Keep low (
0.3) for reproducibility - Retrieval: Tune
TOP_K_RETRIEVAL(quality vs speed) - Chunking: Optimize
CHUNK_SIZEandCHUNK_OVERLAP - Docker: One worker by default; scale carefully
MIT License - see LICENSE
Built with:
- LangChain - Multi-agent orchestration
- Ollama - Local LLM inference
- ChromaDB - Vector database
- Loguru - Modern logging
- Streamlit - Rapid UI
- FastAPI - High-performance API
Inspired by LangChain and LlamaIndex.
Made with ⚡ for rigorous scientific research