An agentic book assistant built with LangGraph and Streamlit.
Novella AI is a sophisticated AI agent that understands books, recommends reads, and engages in literary analysis through intelligent conversations. Powered by Google's Gemini 2.5 Flash and orchestrated with LangGraph's stateful workflow engine, it provides multi-turn conversations with memory and autonomous tool usage.
- LangGraph-Powered Agent - Autonomous AI agent with stateful workflows, memory persistence, and tool orchestration
- Interactive Web Interface - Beautiful Streamlit web application for seamless conversations
- CLI Support - Terminal-based interface for command-line users
- Tool-Integrated AI - Agent autonomously searches books and manages reading lists
- Multi-turn Conversations - Context-aware discussions with memory across sessions
- Google Gemini 2.5 Flash - Fast and intelligent AI responses
- Python: 3.11 or higher
- Google API Key: Required for Gemini AI access (free tier available)
- Internet Connection: For API calls and book database access
git clone https://github.com/MuhammedSenn/novella-ai.git
cd novella-ai# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activateOption A: For Development (Recommended)
pip install -e ".[dev]"Option B: Using requirements files
# Production dependencies only
pip install -r requirements.txt
# With development tools
pip install -r requirements-dev.txt- Create a
.envfile in the project root:
# Linux/macOS
cp .env.example .env
# Windows PowerShell
Copy-Item .env.example .env- Edit
.envand add your Google API Key:
GOOGLE_API_KEY=your_actual_api_key_here-
Template Available: Use
.env.exampleas a reference for required variables -
NEVER commit
.envto GitHub!- β
The
.gitignorefile already excludes.env(checked automatically) - β Your API key is safe from public exposure
- β
Each developer should have their own
.envfile locally
- β
The
How to get your API Key:
- Go to Google AI Studio
- Click "Create API Key"
- Copy and paste it into your
.envfile - Free tier includes generous usage limits
Verify Setup:
# Check .env exists and is ignored
git status # .env should NOT appear in outputstreamlit run app.pyVisit http://localhost:8501 in your browser and start chatting about books!
python main.pyType your book-related queries and press Enter. Type q, exit, or quit to stop.
User Input
β
Streamlit Web App / CLI
β
LangGraph Agent Workflow
βββ Agent Node β Gemini LLM
βββ Tool Node β OpenLibrary + JSON Storage
βββ Conditional Routing β Tool Use Decision
βββ Memory State β Multi-turn Context
β
Response to User
- Input Processing: User query comes through web or CLI
- Agent Decision: LangGraph's agent decides if tools are needed
- Tool Usage: If needed, agent autonomously:
- Searches Open Library for books
- Manages your reading list
- Generation: Gemini generates intelligent responses
- Memory: Conversation context persists across turns
- AgentState: TypedDict defining conversation state
- agent_node(): LLM call with tool binding
- should_continue(): Decides if tools should be executed
- create_graph(): Builds LangGraph workflow with:
- StateGraph for workflow definition
- ToolNode for tool execution
- Conditional edges for routing
- MemorySaver for state persistence
check_book_database(): Searches Open Library for booksmanage_reading_list(): CRUD operations on reading list- Both are LangChain @tool decorated functions
- System prompt defining agent behavior
- Instructions for book recommendations
- Tool usage guidelines
- Safety and content policies
novella-ai/
βββ src/ # Application code
β βββ graph.py # LangGraph workflow and agent orchestration
β βββ tools.py # Book search and reading list tools
β βββ prompt.py # System prompts and AI behavior
β
βββ tests/ # Test suite (39 unit tests)
β βββ conftest.py # Pytest fixtures and configuration
β βββ test_graph.py # Graph and agent tests
β βββ test_tools.py # Tools functionality tests
β βββ test_prompt.py # Prompt content validation tests
β
βββ app.py # Streamlit web application
βββ main.py # CLI application
βββ pyproject.toml # Project configuration and dependencies
βββ requirements.txt # Production dependencies
βββ requirements-dev.txt # Development tools
βββ .gitignore # Git ignore rules
βββ LICENSE # MIT License
βββ README.md # This file
βββ CONTRIBUTING.md # Contribution guidelines
βββ TESTING.md # Testing guide
pip install -e ".[dev]"Ensure code follows PEP 8 standards:
# Format code with Black
black .
# Sort imports with isort
isort .
# Lint with Ruff
ruff check . --fix
# Type checking with mypy
mypy src/# Run all tests
pytest
# Run with coverage report
pytest --cov=src --cov-report=html
# Run specific test file
pytest tests/test_tools.py -v
# Run specific test class
pytest tests/test_graph.py::TestCreateGraph -vView coverage report: htmlcov/index.html
- LangGraph 1.0.5 - Agentic framework for building stateful, multi-step workflows
- Streamlit 1.52.2 - Interactive web application framework
- Google Generative AI (Gemini 2.5 Flash) - Large language model
- LangChain 1.2.0 - Foundation for working with LLMs
- Python 3.11+ - Modern Python
- Python version requirement (β₯3.11)
- Dependency management
- Build system configuration
- Tool configurations (Black, isort, Ruff, mypy, pytest)
- Production dependencies only
- Pinned versions for reproducibility
- Use this for deployment
- Includes production dependencies via
-r requirements.txt - Development tools: Black, isort, Ruff, mypy
- Testing tools: pytest, pytest-asyncio, pytest-cov
Novella AI includes a comprehensive test suite:
- 39 Unit Tests across 3 modules
- Graph Tests: Workflow orchestration and agent behavior
- Tools Tests: Book database search and reading list management
- Prompt Tests: AI behavior validation
See TESTING.md for detailed testing guide.
β What's Protected:
.envfile is in.gitignore- never committed- API keys are loaded from environment variables only
- Example
.env.examplenot provided (use this README instead)
β What to Do:
- Create
.envlocally with your API key - Never share your API key
- Regenerate API key if accidentally exposed
- Use separate keys for different environments
- No hardcoded secrets anywhere
- All external APIs use HTTPS
- Dependencies are pinned to specific versions
- Regular updates recommended
We welcome contributions! See CONTRIBUTING.md for:
- Bug reporting guidelines
- Feature request process
- Development workflow
- Code style standards (PEP 8)
- Pull request process
langgraph- Agentic workflow orchestrationlangchain&langchain-core- LLM abstractionsgoogle-genai- Gemini API clientstreamlit- Web UI frameworkrequests- HTTP client for book databasepython-dotenv- Environment variable management
black- Code formatterisort- Import sorterruff- Fast lintermypy- Type checkerpytest- Testing framework
This project is licensed under the MIT License - see LICENSE file for details.
MIT License means:
- β Free to use for commercial and private purposes
- β You can modify and distribute the code
β οΈ You must include the original license- βΉοΈ No warranty or liability
- Streamlit - Interactive web applications
- LangChain - LLM application framework
- Google Generative AI - Gemini models
- LangGraph - Agentic workflows
- Open Library - Book database
- Issues: Open a GitHub issue for bugs or features
- Discussions: Use GitHub Discussions for questions
- Documentation: Check TESTING.md and CONTRIBUTING.md
Made with β€οΈ by Muhammed Εen
Last Updated: January 2026 | Status: Active Development