Skip to content

paychex/payx-langgraph-101

 
 

Repository files navigation

LangGraph 101

Welcome to LangGraph 101! This is a modified version of the Langchain 101 and 201 courses for Paychex. The main changes are how Model classes are instantiated. The AI PLatform Engineering Team has a package called the AIPE SDK which provides useful, Paychex-specific Abstractions for building AI applications

AIPE SDK Docs

Introduction

This repository contains hands-on tutorials for learning LangChain and LangGraph, organized into two learning tracks:

  • LG101: Fundamentals of building agents with LangChain v1 and LangGraph v1
  • LG201: Advanced patterns including multi-agent systems and production workflows

This is a condensed version of LangChain Academy, intended to be run in a session with a LangChain engineer. If you're interested in going into more depth, or working through tutorials on your own, check out LangChain Academy! LangChain Academy has helpful pre-recorded videos from our LangChain engineers.

What's Inside

LG101 - Fundamentals

  • langgraph_101.ipynb: Build your first agent with models, tools, memory, and streaming
  • langgraph_102.ipynb: Advanced concepts including middleware and human-in-the-loop patterns

LG201 - Production Patterns

  • email_agent.ipynb: Build a stateful email triage and response agent
  • multi_agent.ipynb: Multi-agent systems with supervisors and specialized sub-agents

All notebooks use the latest LangChain v1 and LangGraph v1 primitives, including create_agent(), middleware, and the new interrupt patterns.

Context

At LangChain, we aim to make it easy to build LLM applications. One type of LLM application you can build is an agent. There's a lot of excitement around building agents because they can automate a wide range of tasks that were previously impossible.

In practice though, it is incredibly difficult to build systems that reliably execute on these tasks. As we've worked with our users to put agents into production, we've learned that more control is often necessary. You might need an agent to always call a specific tool first or use different prompts based on its state.

To tackle this problem, we've built LangGraph — a framework for building agent and multi-agent applications. Separate from the LangChain package, LangGraph's core design philosophy is to help developers add better precision and control into agent workflows, suitable for the complexity of real-world systems.

Pre-work

Install Python 3.13

  1. Install python from https://www.python.org/downloads/. When installing from the MSI select the "add to PATH" option
  2. Ensure python to your path

Windows User Path Example:

C:\Users\mrichar2\AppData\Local\Programs\Python\Python313\Scripts
C:\Users\mrichar2\AppData\Local\Programs\Python\Python313
C:\Users\mrichar2\AppData\Local\Programs\Python\Launcher\

  1. Verify the install

If in Windows you may need to disable the python.exe and python3.exe App execution aliases. It can be found under settings Apps > Advanced app settings > App execution aliases. You may also need to ensure the path to python is at the top of your PATH.

python --version
Python 3.13.8
pip --version
pip 25.2 from C:\Users\mrichar2\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip (python 3.13)
  1. Upgrade pip
python -m pip install --upgrade pip

Setup the certificate store

  1. Download paychex-trust-all.pem
  2. Set the following system environment variables to point to your file:
CURL_CA_BUNDLE = C:/home/keystore/paychex-trust-all.pem
REQUESTS_CA_BUNDLE = C:/home/keystore/paychex-trust-all.pem
SSL_CERT_FILE = C:/home/keystore/paychex-trust-all.pem
  1. Setup pip to use the Paychex Artifactory pip mirror
pip config set global.index-url https://repository.paychex.com/artifactory/api/pypi/python-pypi-remote/simple

Install a Python IDE

You may use VSCode with python extensions or PyCharm. Be sure that the Jupyter extension/plugin is installed.

If using VSCode be sure to install python and Jupyter extensions.

Clone the LangGraph 101 repo from either Github or Bitbucket

# Github
git clone https://github.com/paychex/payx-langgraph-101.git
# Bitbucket
git clone ssh://git@code.paychex.com/aipe/payx-langgraph-101.git

Create an environment

Ensure you have a recent version of uv Package manager installed:

# curl (linux)
curl -LsSf https://astral.sh/uv/install.sh | sh
# pip (windows)
pip install uv

cd into your cloned repository and copy the example environment file:

cd payx-langgraph-101

# Linux
cp .env.example .env
# Windows
copy .env.example .env

You will be supplied with necessary API keys during the session to populate the .env file.

Package Installation

The Package Index is pointed to Paychex Artifactory (set in pyproject.toml).

Run the following in your terminal:

# Install the packages
uv sync --native-tls

If necessary activate your virtual environment (If you use your IDE terminal your IDE may do this automatically for you)

# Activate the virtual environment (bash)
source .venv/bin/activate
# Activate the virtual environment (powershell)
./.venv/Scripts/activate.ps1
# Activate the virtual environment (cmd)
./.venv/Scripts/activate.bat

Running Agents Locally

You can run the agents in this repository locally using langgraph dev. This gives you:

  • A local API server for your agents
  • LangGraph Studio UI for testing and debugging
  • Hot-reloading during development
# From the root directory, start the LangGraph development server
langgraph dev

# This will start a local server and provide:
# - API endpoint for your agents (typically http://localhost:8123)
# - LangGraph Studio UI (if installed)

The langgraph.json configuration file defines which agents are available. You can interact with agents via the API or through LangGraph Studio's visual interface.

For more details, see the LangGraph CLI documentation.

Model Configuration

This repository uses a centralized utils module (utils/) to avoid code duplication. Shared utilities are defined here:

  • utils/utils.py - Shared utility functions (show_graph, get_engine_for_chinook_db)

Note: Notebooks automatically add the project root to Python's path, so they can import from utils regardless of which subdirectory they're in.

Getting Started

Recommended Learning Path

  1. Start with LG101 - notebooks/LG101/

    • Begin with langgraph_101.ipynb to learn the fundamentals
    • Continue with langgraph_102.ipynb for middleware and human-in-the-loop patterns
  2. Progress to LG201 - notebooks/LG201/

    • Explore email_agent.ipynb for a complete stateful agent example
    • Build multi-agent systems with multi_agent.ipynb
  3. Run Agents Locally

    • Check out the agents/ directory for standalone agent implementations
    • Use langgraph dev to run agents as a service

Resources

About

Learn about the fundamentals of LangGraph through a series of notebooks (Paychex-ified)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 85.9%
  • Python 14.1%