This repository demonstrates building agents using LangGraph, focusing on an email assistant that can:
- Triage incoming emails
- Draft appropriate responses
- Execute actions (calendar scheduling, etc.)
- Incorporate human feedback
- Learn from past interactions
Recommended: Using uv (faster and more reliable)
# Install uv if you haven't already
pip install uv
# Install the package with development dependencies
uv sync --extra devAlternative: Using pip
# Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Ensure you have a recent version of pip (required for editable installs with pyproject.toml)
python3 -m pip install --upgrade pip
# Install the package in editable mode
pip install -e .The repository contains several implementations with increasing complexity in src/email_assistant:
-
LangGraph 101 (
langgraph_101.py)- Basics of LangGraph
-
Basic Email Assistant (
email_assistant.py)- Core email triage and response functionality
-
Human-in-the-Loop (
email_assistant_hitl.py)- Adds ability for humans to review and approve actions
-
Memory-Enabled HITL (
email_assistant_hitl_memory.py)- Adds persistent memory to learn from feedback
-
Gmail Integration (
email_assistant_hitl_memory_gmail.py)- Connects to Gmail API for real email processing
Each aspect of the agent is explained in dedicated notebooks:
notebooks/langgraph_101.ipynb- LangGraph basicsnotebooks/agent.ipynb- Basic agent implementationnotebooks/evaluation.ipynb- Agent evaluationnotebooks/hitl.ipynb- Human-in-the-loop functionalitynotebooks/memory.ipynb- Adding memory capabilities
Test to ensure all implementations work:
# Test all implementations
python tests/run_all_tests.py --all(Note: This will leave out the Gmail implementation email_assistant_hitl_memory_gmail from testing.)
Test all notebooks to ensure they run without errors:
# Run all notebook tests directly
python tests/test_notebooks.py