LangGraphGo Examples
January 17, 2026 ยท View on GitHub
This directory contains 85+ examples demonstrating the features of LangGraphGo.
Table of Contents
- Basic Concepts
- State Management
- Graph Structure & Routing
- Parallel Execution
- Streaming & Events
- Persistence (Checkpointing)
- Human-in-the-Loop
- Pre-built Agents
- Programmatic Tool Calling (PTC)
- Memory
- RAG (Retrieval Augmented Generation)
- Tools & Integrations
- Advanced Patterns
Basic Concepts
- Basic Example - Simple graph with hardcoded steps
- Basic LLM - Integration with LLMs
- Arithmetic Example - Using LLM to calculate arithmetic expressions
- LangChain Integration - Using LangChain tools and models
State Management
- State Schema - Managing complex state updates with Schema and Reducers
- Custom Reducer - Defining custom state reducers for complex merge logic
- Smart Messages - Intelligent message merging with ID-based upserts
- Command API - Dynamic control flow and state updates from nodes
- Configuration - Using runtime configuration to pass metadata and settings
Graph Structure & Routing
- Conditional Routing - Dynamic routing based on state
- Conditional Edges - Using conditional edges for branching logic
- Subgraphs - Composing graphs within graphs
- Multiple Subgraphs - Managing multiple subgraph compositions
- Generic State Graph - Using generic types for type-safe state management
- Generic State Graph Listenable - Generic state graph with event listening
- Generic State Graph ReAct Agent - ReAct agent using generic types
Parallel Execution
- Parallel Execution - Fan-out/Fan-in execution with state merging
- Complex Parallel Execution - Advanced parallel execution with branches of varying lengths
Streaming & Events
- Streaming Modes - Advanced streaming with updates, values, and messages modes
- Streaming Pipeline - Building streaming data processing pipelines
- Listeners - Attaching event listeners to the graph
- Logger - Logging graph execution events
- LLM Streaming - Basic LLM streaming with callbacks
- LangChain Go Streaming - LangChain Go integration with streaming
- Adapter Streaming - Custom adapter streaming implementation
Persistence (Checkpointing)
- Memory Basic - In-memory checkpointing for state persistence
- Durable Execution - Crash recovery and resuming execution from checkpoints
- File Checkpointing - Checkpointing to file system
- File Checkpointing Resume - Resuming execution from file checkpoints
Human-in-the-Loop
- Human in the Loop - Workflow with interrupts and human approval steps
- Time Travel - Inspecting, modifying state history, and forking execution
- Dynamic Interrupt - Pausing execution from within a node using
graph.Interrupt - Payment Interrupt - Human approval workflow example for payment scenarios
- API Interrupt Demo - API-based interrupt demonstration for approval workflows
Pre-built Agents
Core Agent Patterns
- Create Agent - Easy way to create an agent with options
- Dynamic Skill Agent - Agent with dynamic skill discovery and selection
- ReAct Agent - Reason and Action agent using tools
Planning & Reasoning Agents
- Planning Agent - Intelligent agent that creates workflow plans based on user requests
- PEV Agent - Plan-Execute-Verify agent with self-correction and error recovery
- Reflection Agent - Iterative improvement agent that refines responses through self-reflection
- Tree of Thoughts - Search-based reasoning agent exploring multiple solution paths
- 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
- Reflexive Metacognitive Agent CN - Chinese version of the reflexive metacognitive agent
- Manus Agent - Advanced agent for document processing workflows
Multi-Agent Systems
- Supervisor - Multi-agent orchestration using a supervisor pattern
- Swarm - Multi-agent collaboration using handoffs
Chat Agents
- Chat Agent - Multi-turn conversation agent with automatic session management
- Chat Agent Async - Asynchronous streaming chat agent with real-time LLM response streaming
- Chat Agent Dynamic Tools - Chat agent with runtime tool management
Programmatic Tool Calling (PTC)
Programmatic Tool Calling reduces latency by ~10x by having the LLM generate code instead of structured tool outputs.
- PTC Basic - Introduction to Programmatic Tool Calling
- PTC Simple - Simple PTC example with calculator and weather tools
- PTC Expense Analysis - Complex expense analysis scenario
- PTC + GoSkills - Integration of PTC with GoSkills for local tool execution
Memory
Conversation memory strategies for maintaining context across sessions.
- Memory Basic - Basic usage of LangChain memory adapters
- Memory Chatbot - Chatbot with LangChain memory integration
- 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
RAG (Retrieval Augmented Generation)
Basic RAG
- RAG Basic - Basic RAG implementation
- RAG Pipeline - Complete RAG pipeline
- RAG with LangChain - RAG using LangChain components
Advanced RAG
- RAG Advanced - Advanced RAG techniques
- RAG Conditional - Conditional RAG workflow
- RAG with Embeddings - RAG using embeddings
- RAG Query Rewrite - RAG with query rewriting for better retrieval
- LightRAG Simple - Basic LightRAG usage
- LightRAG Advanced - Advanced LightRAG patterns
RAG with Vector Stores
- RAG with VectorStores - RAG using LangChain VectorStores
- RAG with Chroma - RAG using Chroma database
- RAG with Chroma v2 - RAG using Chroma v2 database
- RAG with Chromem - RAG using chromem-go in-memory store
- RAG with Milvus - RAG using Milvus vector database
- RAG with Qwen Ranker - RAG with Qwen-based reranking
- RAG with Memory - RAG with conversation memory integration
GraphRAG (Knowledge Graph)
- RAG with FalkorDB Graph - RAG using FalkorDB knowledge graph with automatic entity extraction
- RAG with FalkorDB Simple - Simple RAG with FalkorDB using manual entity/relationship creation
- RAG with FalkorDB Fast - Optimized RAG with FalkorDB for fast queries
- RAG with FalkorDB Debug - Debug version with detailed logging
- RAG with FalkorDB Debug Query - Query debugging for FalkorDB RAG
Tools & Integrations
Search Tools
- Tavily Search - Using Tavily search tool with ReAct agent
- Exa Search - Using Exa search tool with ReAct agent
- Brave Search - Using Brave search API with agents
Other Integrations
- GoSkills Integration - Integrating GoSkills as tools for agents
- MCP Agent - Using Model Context Protocol (MCP) tools with agents
- Context Store - Managing context with external stores
Advanced Patterns
- Visualization - Generating Mermaid diagrams for graphs
Running Examples
Most examples can be run directly:
cd examples/<example_name>
go run main.go
Some examples may require additional setup:
- API Keys: Search tools (Tavily, Exa, Brave) require API keys
- Databases: FalkorDB examples require FalkorDB to be running
- Vector Stores: Chroma examples require Chroma DB to be running
- Redis: Some checkpointing examples require Redis
Example Categories
| Category | Count | Description |
|---|---|---|
| Basic Concepts | 3 | Getting started examples |
| State Management | 5 | State schema and reducers |
| Graph Structure | 7 | Routing, subgraphs, generics |
| Parallel Execution | 2 | Concurrent execution patterns |
| Streaming & Events | 7 | Real-time data flow |
| Persistence | 4 | Checkpointing and recovery |
| Human-in-the-Loop | 5 | Interactive workflows |
| Pre-built Agents | 18 | Ready-to-use agent patterns |
| PTC | 4 | Programmatic tool calling |
| Memory | 6 | Conversation memory strategies |
| RAG | 22 | Retrieval-augmented generation |
| Tools & Integrations | 6 | External service integrations |
| Advanced | 1 | Visualization and debugging |
| Total | 85+ | Comprehensive examples |