What is lfnovo/open-notebook? A Self-Hosted AI Research Assistant
lfnovo/open-notebook is an open-source, privacy-first alternative to Google NotebookLM that enables users to upload, organize, and interact with multi-modal content using any of 18+ LLM providers while keeping all data on their own infrastructure.
The lfnovo/open-notebook repository provides a complete, end-to-end notebook-style AI assistant designed for researchers who demand full control over their data. Unlike cloud-based alternatives, this self-hosted platform ensures that notebooks, sources, and generated notes remain on your local machine or server unless explicitly configured to use external AI providers. Built with a modern three-tier architecture, it combines a React frontend, FastAPI backend, and SurrealDB database to deliver a seamless research experience.
Core Architecture and Design Philosophy
Privacy-First Data Control
All content stays local by default. The system stores notebooks, sources, and embeddings in SurrealDB, ensuring no third-party access to your research materials. This design eliminates the privacy risks associated with cloud-based note-taking and AI research tools, as implemented in the repository's data layer.
Multi-Model AI Integration via Esperanto
The platform leverages the Esperanto library to support 18+ LLM and embedding providers including OpenAI, Anthropic, Ollama, and Google GenAI. Users can switch between providers or combine them within the same workflow without vendor lock-in. Configuration happens through the REST API endpoint defined in api/routers/models.py, which creates provider-specific clients via the factory in open_notebook/ai/models.py.
Three-Tier Technical Stack
The architecture separates concerns across three distinct layers:
- Frontend: React/Next.js application handling notebooks, sources, chat interfaces, and search
- API Backend: FastAPI service providing REST endpoints, LangGraph workflows, and async job processing
- Database: SurrealDB with graph-based storage and built-in vector embeddings for semantic search
LangGraph Workflows and Content Processing
Content Ingestion Pipeline
The open_notebook/graphs/source.py file implements a LangGraph workflow that extracts content from PDFs, videos, audio, and web pages through the content-core library. This pipeline automatically generates embeddings and stores records in SurrealDB via the async CRUD helpers in open_notebook/database/repository.py.
Search-and-Answer Capabilities
Located in open_notebook/graphs/ask.py, the search workflow retrieves relevant sources based on user queries, runs them through configured LLMs, and returns synthesized answers. The handler in api/routers/ask.py exposes this functionality via HTTP POST requests to the /ask endpoint, supporting the full context of your personal notebooks.
Async Job Queue for Podcast Generation
The system includes professional podcast generation capabilities defined in open_notebook/podcasts/models.py. Multi-speaker podcasts are built from notebook content via an async job queue, supporting episode profiles and text-to-speech synthesis without blocking the main application threads.
Implementation Examples
Docker Compose Deployment
Deploy the entire stack locally using the official configuration:
curl -o docker-compose.yml https://raw.githubusercontent.com/lfnovo/open-notebook/main/docker-compose.yml
docker compose up -d
After startup, access the UI at http://localhost:8502.
Configuring AI Providers
Add model configurations through the REST API as implemented in api/routers/models.py:
curl -X POST http://localhost:5055/models \
-H "Content-Type: application/json" \
-d '{
"provider": "openai",
"api_key": "sk-REPLACE_WITH_YOUR_KEY",
"name": "gpt-4o-mini"
}'
Programmatic Workflow Invocation
Interact with the search workflow from Python using the FastAPI endpoint:
import httpx
payload = {
"notebook_id": "my-notebook",
"query": "What are the key challenges in multimodal AI research?"
}
resp = httpx.post("http://localhost:5055/ask", json=payload)
print(resp.json()["answer"])
This sends requests to the LangGraph ask workflow defined in open_notebook/graphs/ask.py.
Key Source Files
Understanding the repository structure requires familiarity with these critical components:
api/main.py: FastAPI application entry point that registers all routers and handles global exceptionsopen_notebook/ai/models.py: Factory class creating provider-specific LLM and embedding clientsopen_notebook/database/repository.py: Async CRUD helpers for SurrealDB entitiesopen_notebook/graphs/chat.py: LangGraph implementation for conversational interfaces
Summary
- lfnovo/open-notebook provides a self-hosted alternative to proprietary AI research tools, ensuring complete data privacy
- The three-tier architecture combines React, FastAPI, and SurrealDB for scalability and performance
- Esperanto integration enables support for 18+ LLM providers without vendor lock-in
- LangGraph workflows in
open_notebook/graphs/handle content ingestion, search, and chat asynchronously - The platform supports advanced features like automatic podcast generation and multi-modal content processing
Frequently Asked Questions
How does lfnovo/open-notebook protect my research data?
All notebooks, sources, and generated notes remain on your local machine or self-hosted server by default. The system only sends data to external AI providers when you explicitly configure API keys in api/routers/models.py, and even then, you retain control over which content gets processed remotely.
Which LLM providers does lfnovo/open-notebook support?
Through the Esperanto library, the platform supports 18+ providers including OpenAI, Anthropic, Ollama, Google GenAI, and various embedding models. You can configure multiple providers simultaneously and switch between them for different tasks without changing the underlying workflow code.
What is the purpose of the LangGraph workflows in open_notebook/graphs/?
The LangGraph workflows model content processing as reusable state-machine graphs. The source.py workflow handles ingestion and embedding generation, ask.py manages search-and-answer operations, and chat.py powers conversational interfaces, all supporting async execution and state management across the FastAPI backend.
Can I deploy lfnovo/open-notebook without Docker?
While Docker Compose provides the simplest deployment path, the repository uses standard FastAPI and Next.js applications that can run independently. You would need to configure SurrealDB separately and ensure all environment variables point to your database and AI provider endpoints according to the configuration in api/main.py.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →