12. Create agents with LangGraph
This app demonstrates how to implement agents with LangGraph.
Prerequisites
- Python 3.10 or later
- Azure OpenAI Service
Overview
What is LangGraph?
LangGraph is a library for building stateful, multi-actor applications with LLMs, used to create agent and multi-agent workflows.
This chapter provides a practical example of how to use LangGraph to create an agent that can interact with users and external tools.
Usage
- Get Azure OpenAI Service API key
- Copy .env.template to
.env
in the same directory - Set credentials in
.env
- Run main.py
# Create a virtual environment
$ python -m venv .venv
# Activate the virtual environment
$ source .venv/bin/activate
# Install dependencies
$ pip install -r requirements.txt
Examples
reflection_agent
react_agent
advanced_rag_flows
# create vector store
python apps/12_langgraph_agent/advanced_rag_flows/ingestion.py
# run main.py
python apps/12_langgraph_agent/advanced_rag_flows/main.py