Agents From Scratch banner
langchain-ai langchain-ai

Agents From Scratch

Communication community

Description

Build an email assistant with human-in-the-loop and memory

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Agents From Scratch

The repo is a guide to building agents from scratch. It builds up to an ["ambient"](https://blog.langchain.dev/introducing-ambient-agents/) agent that can manage your email with connection to the Gmail API. It's grouped into 4 sections, each with a notebook and accompanying code in the `src/email_assistant` directory. These section build from the basics of agents, to agent evaluation, to human-in-the-loop, and finally to memory. These all come together in an agent that you can deploy, and the principles can be applied to other agents across a wide range of tasks.

![overview](notebooks/img/overview.png)

Environment Setup

Python Version

  • Ensure you're using Python 3.11 or later.
  • This version is required for optimal compatibility with LangGraph.
python3 --version

API Keys

  • If you don't have an OpenAI API key, you can sign up here.
  • Sign up for LangSmith here.
  • Generate a LangSmith API key.

Set Environment Variables

  • Create a .env file in the root directory:
# Copy the .env.example file to .env
cp .env.example .env
  • Edit the .env file with the following:
LANGSMITH_API_KEY=your_langsmith_api_key
LANGSMITH_TRACING=true
LANGSMITH_PROJECT="interrupt-workshop"
OPENAI_API_KEY=your_openai_api_key
  • You can also set the environment variables in your terminal:
export LANGSMITH_API_KEY=your_langsmith_api_key
export LANGSMITH_TRACING=true
export OPENAI_API_KEY=your_openai_api_key

Package Installation

**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 dev

# Activate the virtual environment
source .venv/bin/activate

**Alternative: Using pip**

$ python3 -m venv .venv
$ source .venv/bin/activate
# Ensure you have a recent version of pip (required