LangGraph Examples
December 4, 2025 ยท View on GitHub
Updated 2025: This directory contains examples and templates for building AI agents using LangGraph, a framework for orchestrating multi-agent workflows.
LangGraph v1.0 (October 22, 2025): LangGraph reached v1.0, marking the first stable major release in the durable agent framework space. It offers node-based architecture for building multi-agent systems with structured state management, durable state persistence, built-in persistence for saving/resuming workflows, and human-in-the-loop patterns. The LangGraph Platform enables teams to run agent workflows at scale with tools to track, debug, and manage them in production.
Overview
This folder provides starter code and examples to help you build AI agents with LangGraph. It includes basic and advanced examples covering various aspects of agent development, such as multi-agent orchestration, workflow management, and more.
2025 Features:
- Production-ready platform for running agent workflows at scale
- Advanced tracing and debugging tools
- Structured state management for complex multi-agent systems
- Visual workflow debugging and monitoring
Prerequisites
- Python 3.8 or higher
- OpenAI API key (set as an environment variable or in a .env file)
Usage
- Install dependencies:
pip install langgraph openai - Set your OpenAI API key:
export OPENAI_API_KEY="your_api_key_here" - Explore the docs and code examples to build your own agents.
Contents
Docs
- Basic Chatbot Tutorial: Key concepts and basic setup for LangGraph.
- Add Tools Tutorial: Fast start guide for using the LangGraph API.
- Add Memory Tutorial: Design principles and structure for LangGraph agents.
- Human-in-the-Loop Tutorial: Advanced tutorial for human-in-the-loop interactions.
Code
- Starter codes for building agents with LangGraph can be found in the code including:
0_hello_world_graph.py: Simple "Hello World" example for LangGraph.0_langgraph_hello_world.py: Another basic example for LangGraph.1_build_basic_chatbot.py: Basic chatbot implementation.2_add_tools_chatbot.py: Chatbot with tool integration.3_add_memory_chatbot.py: Chatbot with memory and context management.advanced_workflow.py: Advanced workflow example.basic_workflow.py: Basic workflow example.complete_chatbot.py: Full-featured chatbot implementation.customer_support_bot.py: Customer support bot example.
Key Concepts Demonstrated
State Management
- Using TypedDict for type-safe state
- Managing conversation history
- Handling multiple state fields
Graph Structure
- Node creation and connection
- Conditional routing
- Entry point definition
- Edge management
Tool Integration
- Custom tool definition with @tool decorator
- Function calling from agents
- Tool result handling
Memory and Context
- Conversation history management
- Context preservation between turns
- State persistence
Human Interaction
- Human-in-the-loop capabilities
- Input handling
- Interactive conversation flow
Output Files
Each example generates an output file:
basic_workflow_output.txtadvanced_workflow_output.txtcomplete_chatbot_output.txt
These files contain the conversation history and results of each run.
Best Practices
-
State Management
- Use TypedDict for type-safe state
- Keep state minimal and focused
- Handle state updates carefully
-
Tool Design
- Make tools focused and specific
- Include clear documentation
- Handle errors gracefully
-
Graph Structure
- Keep the graph simple and clear
- Use meaningful node names
- Document the flow between nodes
-
Error Handling
- Implement proper error handling
- Provide meaningful error messages
- Handle edge cases appropriately
Resources
Contributing
Feel free to:
- Add new examples
- Improve existing examples
- Add more documentation
- Report issues or suggest improvements
License
This project is licensed under the MIT License - see the LICENSE file for details.