Email Agents From Scratch

Build an email assistant with triage, approval checkpoints, evaluation, and persistent memory.

Stars
★ 2.5k
Last updated
3mo ago
FARS reviewed
Nov 08, 2026
License
MIT
Primary language
Jupyter Notebook

At a glance

How it runs
Library / SDKFramework
Works with
Platform-specificOpenAI API
Cost
Free software; you pay for model usage
Setup effort
Medium · a few setup steps
You'll need
Python 3.11 or laterOpenAI API keyLangSmith API keyLangGraphGmail API credentials for Gmail integrationShell / CLINetwork accessLocal filesystem
Typical use
A Python developer learning LangGraph can follow the notebooks to study chat models, tool calling, nodes, edges, memory, and the distinction between agents and workflows.
Not a fit if
  • Users who want a ready-made email assistant rather than building and deploying the code themselves
  • Teams expecting turnkey Gmail authorization and deployment steps, which live in separate docs
Website
academy.langchain.com ↗ set on GitHub
Maintenance
Commits in the last 6 monthslast commit 2026-08-11+0.6 ★/day over 7 days

What does this agent do, and when should you use it?

This repository is a staged developer guide and reference implementation that culminates in an ambient email assistant connected to the Gmail API. It pairs four notebooks with Python implementations under src/email_assistant, progressing through basic agent construction, evaluation, human-in-the-loop control, and memory. The assistant combines an email-triage step with an agent that handles responses, while selected actions such as sending email or scheduling meetings can be submitted for user review. Its memory-enabled implementation persists feedback and preferences with LangGraph Store, and the complete Gmail variant lives in email_assistant_hitl_memory_gmail.py. The repository also demonstrates evaluation with Pytest, the LangSmith evaluate API, and LLM-as-a-judge; it mentions deployment to LangGraph Platform, although the supplied material does not include the deployment commands.

The base implementation in src/email_assistant/email_assistant.py combines email triage with an agent responsible for handling the response. notebooks/evaluation.ipynb evaluates the assistant against eval/email_dataset.py using Pytest and the LangSmith evaluate API, covering response quality, tool calls, and triage decisions; response evaluation includes LLM-as-a-judge. src/email_assistant/email_assistant_hitl.py adds review checkpoints through Agent Inbox for selected calls such as sending an email or scheduling a meeting. src/email_assistant/email_assistant_hitl_memory.py uses LangGraph Store to persist memories so the assistant can learn from feedback and adapt to preferences. The notebooks operate with mock email and calendar tools, while src/email_assistant/email_assistant_hitl_memory_gmail.py contains the Gmail API implementation. Test traces and metrics are logged to the LangSmith project selected by LANGSMITH_PROJECT.

  1. A Python developer learning LangGraph can follow the notebooks to study chat models, tool calling, nodes, edges, memory, and the distinction between agents and workflows.
  2. An engineering team prototyping email automation can use the triage, response-handling, and Gmail integration code as a reference implementation.
  3. A team that must supervise consequential actions can study the Agent Inbox flow for reviewing email-sending and meeting-scheduling calls.
  4. A developer building a preference-aware assistant can examine how the project persists user feedback and preferences with LangGraph Store.
  5. An evaluation engineer can adapt the email dataset, Pytest suite, LangSmith evaluate calls, and checks for responses, tool use, and triage decisions.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install uv
  • pip install -e
Environment variables
LANGSMITH_API_KEY OPENAI_API_KEY
Config files
.env.example .env
Runtime
Python 3.11

How do you install or deploy this agent?

Python 3.11 or later is required. In the repository root, run cp .env.example .env, then configure LANGSMITH_API_KEY=your_langsmith_api_key, LANGSMITH_TRACING=true, LANGSMITH_PROJECT="interrupt-workshop", and OPENAI_API_KEY=your_openai_api_key. The recommended installation is pip install uv, followed by uv sync --extra dev and source .venv/bin/activate. The documented pip alternative is python3 -m venv .venv, source .venv/bin/activate, python3 -m pip install --upgrade pip, and pip install -e .. The editable installation is required for the notebooks; the distribution is named interrupt_workshop and its import name is email_assistant. Gmail use additionally requires Google API credentials configured according to src/email_assistant/tools/gmail/README.md, but those credential steps are not included in the supplied material.

How do you use this agent?

Work through notebooks/agent.ipynb, notebooks/evaluation.ipynb, notebooks/hitl.ipynb, and notebooks/memory.ipynb; use notebooks/langgraph_101.ipynb first if an introduction to the underlying concepts is needed. Installed code can be imported with from email_assistant import .... The base, human-review, memory, and complete Gmail implementations are in email_assistant.py, email_assistant_hitl.py, email_assistant_hitl_memory.py, and email_assistant_hitl_memory_gmail.py, respectively. Run the automated suite with python tests/run_all_tests.py. Validate all notebooks with python tests/test_notebooks.py or pytest tests/test_notebooks.py -v. The supplied material does not document one complete command for launching an interactive assistant or deploying it to LangGraph Platform, so a copyable first production invocation cannot be established from this source alone.

Safety boundaries, hardening & integrations

Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.

Declared capability surface (blast radius)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.

What are this agent's strengths and limitations?

Pros
  • The four-stage progression pairs notebooks with corresponding Python implementations, connecting conceptual instruction to inspectable code.
  • Human oversight is implemented through Agent Inbox for concrete high-impact calls such as sending email and scheduling meetings.
  • The memory variant persists feedback and preferences with LangGraph Store instead of limiting memory to one conversation.
  • Evaluation covers response quality, tool calls, and triage decisions through Pytest, LangSmith evaluate, and LLM-as-a-judge.
  • Mock email and calendar tools support early experimentation, while a separate implementation demonstrates real Gmail API integration.
Limitations
  • The documented setup depends on Python 3.11+, an OpenAI API key, and a LangSmith API key, tying execution and evaluation to named services.
  • Gmail support requires separate Google API credentials, while the supplied material omits the exact authorization, permission, and deployment steps.
  • The listed test implementations include only email_assistant; the source does not establish equivalent automated coverage for every HITL, memory, or Gmail variant.
  • No single interactive launch command, production runtime configuration, or failure-recovery behavior is documented in the supplied material.
  • LangMem-based background memory management and memory lookup tools are identified only as future extensions, not current capabilities.

How does this agent compare with similar options?

Compared with a fixed workflow, the repository combines a defined email-triage step with an agent that handles responses; langgraph_101.ipynb explicitly introduces agents versus workflows. It does not provide an evidence-based comparison with another named email assistant or agent framework.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Email Agents From Scratch This agent 46 · Major gaps Library / SDKFree + model costs ★ 2.5k 3mo ago Jupyter Notebook OpenAI API
OpenBot 59 · Major gaps Web appFree + model costs ★ 48 15d ago Python Claude Code · OpenAI API · Claude API
Enterprise AI Agent Platform 57 · Major gaps Self-hosted service ★ 170 1d ago Python —
Deuz SDK 76 · Good Library / SDKFree + model costs ★ 504 8d ago TypeScript OpenAI API · Claude API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
46/ 100 5-point scale 2.3 / 5
Trust 11/29
Reliability 5/14
Adaptability 9/18
Convention 10/18
Effectiveness 7/13
Verifiability 4/8
Why each dimension lost points
Trust11 / 29 · 1.9/5

The README connects the Gmail API, LangSmith/OpenAI credentials, email and calendar tools, Agent Inbox review, and persistent LangGraph Store memory, making key data flows visible. It says users can review consequential tool calls such as sending email and scheduling meetings. Deductions: credentials are only documented as environment variables or a .env file, with no evidence here of scoped permissions, secret protection, or memory deletion controls; dependencies have no visible security review or lock evidence; the sample omits the full Gmail implementation, rollback mechanisms, and attribution policy. Publisher identity remains unknown as specified.

Reliability5 / 14 · 1.8/5

The README, AGENTS.md, and test scripts describe setup and testing paths, and the implementations are presented in stages. However, the README describes tests for multiple implementations while run_all_tests.py lists only email_assistant and explicitly excludes the HITL and memory versions. The runner reports an unknown implementation, but the sample does not show user-facing recovery or error handling for model, API, or tool failures. No deduction is made because this static review did not execute tests.

Adaptability9 / 18 · 2.5/5

The materials are aimed at developers learning LangGraph and progress through fundamentals, evaluation, human review, memory, and Gmail deployment, with Python and setup guidance. Deductions: the product is focused on a Gmail email assistant; trigger conditions, scope boundaries, compatibility limits, and unsuitable scenarios receive limited treatment beyond the tool-review examples.

Convention10 / 18 · 2.8/5

The repository is organized around tutorial sections, notebooks, and accompanying source, includes concrete installation instructions and examples, and provides a complete MIT license. Deductions: the package, import, and documentation names differ (agents_from_scratch, email_assistant, and interrupt_workshop); only some test exclusions are explained, and no changelog or clear maintenance owner is shown. AGENTS.md and CLAUDE.md read as repository usage guidance rather than product instructions for the running agent.

Effectiveness7 / 13 · 2.7/5

The email assistant combines triage, drafting, tool calls, human feedback, and memory into a coherent end-to-end learning example; the evaluation notebook and dataset add practical developer value. Deductions: the materials do not estimate deployment cost, model/API usage, or human-review overhead, and the test runner covers only a limited subset of the described implementations.

Verifiability4 / 8 · 2.5/5

The README maps major capabilities to notebooks, source files, a dataset, and Gmail setup instructions; the test runner shows which module it selects and how it records results in LangSmith. Deductions: documentation and scripts do not fully agree on test coverage, and the supplied source sample does not independently corroborate details of Gmail implementation, tool execution, or persistent memory. Some utility and safety conclusions therefore rest on documentation claims.

Risks and how to mitigate them
  • Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
  • The real Gmail integration involves email, calendar actions, and credentials. The sample describes human review, but does not show the Gmail implementation's permission scopes, failure recovery, or rollback flow.
  • The test runner selects only the basic email_assistant and explicitly excludes HITL and memory implementations; read README statements about test coverage with that limitation in mind.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 603fc7a4ac61
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/agents-from-scratch.svg)](https://followagents.com/en/agents/agents-from-scratch)
<a href="https://followagents.com/en/agents/agents-from-scratch"><img src="https://followagents.com/badge/agents-from-scratch.svg" alt="FARS review"></a>

FAQ

Can I try it without connecting a real Gmail account?
Yes. The main notebooks use mock email and calendar tools. Google API credentials are needed only for the Gmail integration.
Which actions can require human approval?
The documented examples are selected tool calls such as sending an email and scheduling a meeting, reviewed through Agent Inbox. A complete permission list is not provided.
Which external credentials are required?
The base setup requires OpenAI and LangSmith API keys. The Gmail implementation additionally requires Google API credentials.
How is assistant quality tested?
The project uses an email dataset with Pytest and the LangSmith evaluate API to assess responses, tool calls, and triage decisions. Response evaluation includes LLM-as-a-judge.
What does the memory layer retain?
It persists memories derived from user feedback and preferences through LangGraph Store. The supplied material does not specify retention periods, encryption, or deletion controls.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts