Personal Assistant

Human-in-the-Loop Gmail Email Assistant

An ambient email assistant that triages your Gmail, drafts replies, schedules meetings, pauses for your approval on risky actions, and remembers your preferences over time using LangGraph.

What It Does

This recipe builds an “AI executive assistant” for your inbox. It connects to the Gmail API, triages each incoming email into ignore / notify / respond, and for emails worth a reply it runs an agent that can draft responses, look up your calendar, and propose meeting times. Crucially it is human-in-the-loop: before sending an email or booking a meeting, the agent pauses and surfaces the proposed action to you for approval, edit, or rejection. Over time it persists what it learns about your preferences (tone, who to ignore, scheduling defaults) so the triage and drafts improve.

The Stack

  • LangGraph — the orchestration graph: a triage step feeding an agent loop, with interrupt for human-in-the-loop checkpoints and the LangGraph Store for long-term memory.
  • Gmail API — read, draft, and send tools (the repo ships mock email + calendar tools first, then a real Gmail integration).
  • An LLM — any tool-calling model works; you can point it at a free or BYOK provider such as GitHub Models or Mistral AI (La Plateforme) instead of a paid key.
  • LangSmith (optional) — tracing and LLM-as-a-judge evaluation of triage decisions and reply quality.

Step-by-Step Outline

  1. Agent core — build the triage + response graph in LangGraph with mock email/calendar tools (notebook agent.ipynb).
  2. Evaluation — run Pytest + the LangSmith evaluate API over an email dataset, judging tool calls and triage decisions with LLM-as-a-judge.
  3. Human-in-the-loop — add interrupt so send-email and schedule-meeting tool calls pause for review in an Agent Inbox interface.
  4. Memory — persist user feedback to the LangGraph Store so preferences carry across runs; optionally add LangMem to manage a collection of background memories.
  5. Go live — swap the mock tools for the real Gmail integration and deploy the graph (LangGraph Platform), running it as an ambient agent over your real inbox.

Source

langchain-ai/agents-from-scratch — Build an email assistant with human-in-the-loop and memory