Examples
Explore 70+ code examples covering various scenarios from basic to advanced.
Basic Concepts
Basic Example
Simple graph with hardcoded steps, demonstrating the most basic graph construction flow.
Basic LLM
Demonstrates how to integrate LLM into graph nodes for text generation.
Conditional Routing
Dynamically decide the next execution path based on state.
Conditional Edges
Use conditional edges to implement more complex control flow logic.
LangChain Integration
Demonstrates how to use LangChain tools and models.
Advanced Features
Parallel Execution
Fan-out/Fan-in execution pattern with state merging.
Configuration
Use runtime configuration to pass metadata and settings between nodes.
Custom Reducer
Define custom state reducers for complex merge logic.
State Schema
Manage complex state updates using structured Schema and Reducers.
Subgraphs
Nest other graphs within a graph for modularity and reuse.
Multiple Subgraphs
Managing multiple subgraph compositions.
Streaming Modes
Advanced streaming support for updates, values, messages modes.
Smart Messages
Smart message merging supporting ID-based upserts.
Command API
Node-level dynamic flow control and state updates.
Ephemeral Channels
Manage ephemeral state that is automatically cleared after each step.
Listeners
Add event listeners to the graph for monitoring or logging.
Streaming Pipeline
Build real-time streaming data processing pipelines.
Logger
Log graph execution events and state changes.
Context Store
Manage context with external stores.
Checkpointing
Memory Checkpoint
Basic in-memory state preservation.
File Checkpointing
Lightweight state persistence using file system.
File Checkpoint Resume
Demonstrates resuming execution from file checkpoints.
Durable Execution
Demonstrates crash recovery and execution resumption from checkpoints.
Human in the Loop (HITL)
Human Approval
Workflows involving interrupts and human approval steps.
Time Travel
Inspect, modify state history and fork execution (UpdateState).
Dynamic Interrupt
Pause execution within a node using graph.Interrupt.
Payment Interrupt
Human approval workflow example for payment scenarios.
Prebuilt Agents
Create Agent
Easily create and configure agents using the options pattern.
Dynamic Skill Agent
Agent with dynamic skill discovery and selection, automatically loading skills based on user requests.
ReAct Agent
Classic Reason and Action agent implementation.
Supervisor
Multi-agent orchestration using the Supervisor pattern.
Swarm
Multi-agent collaboration pattern using handoffs.
Planning Agent
Intelligent agent that creates workflow plans based on user requests.
Reflection Agent
Iterative improvement agent that refines responses through self-reflection.
Mental Loop
Simulator-in-the-loop agent that tests actions in a sandbox before execution.
Reflexive Metacognitive Agent
Self-aware agent with explicit self-model of capabilities.
Memory
Memory Basics
Basic usage of LangChain Memory components.
Memory Chatbot
Chatbot integrated with Memory, supporting long conversations.
Memory Strategies
Comprehensive guide to all 9 memory management strategies.
Memory Agent
Real-world agents using different memory strategies.
Memory Graph Integration
State-based memory integration in LangGraph workflows.
Memory
Additional memory examples and usage.
RAG (Retrieval Augmented Generation)
RAG Basics
Most basic implementation of Retrieval Augmented Generation.
RAG Pipeline
Complete RAG processing pipeline example.
Advanced RAG
Advanced RAG techniques including rewriting, scoring, etc.
Conditional RAG
RAG workflow that dynamically decides whether to retrieve based on query intent.
RAG Embeddings
RAG using Embeddings for vector retrieval.
RAG LangChain
RAG implementation deeply integrated with LangChain components.
RAG VectorStores
RAG using LangChain VectorStores interface.
RAG Chroma
RAG example integrating Chroma vector database.
RAG Query Rewrite
RAG with query rewriting for better retrieval.
GraphRAG (Knowledge Graph)
FalkorDB Graph
RAG using FalkorDB knowledge graph with automatic entity extraction.
FalkorDB Simple
Simple RAG with FalkorDB using manual entity/relationship creation.
FalkorDB Fast
Optimized RAG with FalkorDB for fast queries.
FalkorDB Debug
Debug version of FalkorDB RAG with detailed logging.
FalkorDB Debug Query
Query debugging for FalkorDB RAG.
Programmatic Tool Calling (PTC) v0.5.0+
PTC Basic
Demonstrates basic PTC usage with calculator, weather, and data processing tools.
PTC Simple Calculator
Simplest PTC example demonstrating basic tool calling.
PTC Expense Analysis
Complex expense data analysis example using PTC.
PTC + GoSkills
Integration of PTC with GoSkills for local tool execution.
Advanced Reasoning Patterns
Tree of Thoughts v0.6.0
Advanced reasoning using search trees to explore multiple problem-solving paths.
PEV Agent v0.6.0
Problem-Evidence-Validation agent for structured problem-solving and evidence collection.
Chat Agents v0.6.0
Multi-turn Chat Agent
Chatbot with conversation history tracking and memory management.
Async Streaming Chat
Async chat agent with real-time streaming responses.
Dynamic Tools Chat
Chat agent supporting runtime dynamic tool addition/removal.
Generics Support v0.6.0
Generic StateGraph
Type-safe state management using generics.
Listenable Generic StateGraph
Generic state graph implementation with event listening support.
Generic ReAct Agent
Type-safe ReAct agent implementation using generics.
Others
Visualization
Generate Mermaid, DOT, and ASCII charts for graphs.
MCP Agent
Agent implementation with Model Context Protocol (MCP) integration.
Tavily Search
Integrate Tavily search engine tool.
Exa Search
Integrate Exa search engine tool.
Brave Search
Integrate Brave search engine tool.
GoSkills Integration
Integrate GoSkills as tools.