Skip to main content

LangGraph Examples

LangGraph is a library for building stateful, multi-step AI agents as graphs of computation. AgentVisor integrates natively with LangGraph, providing durable execution via Temporal, policy-enforced HTTP proxying, and seamless checkpointing — so your graph-based agents run safely without changes to your application code.

Prerequisites

  • Ollama (or another LLM endpoint) — most examples use ollama via Docker Compose
  • Temporal — required for durable execution and checkpointing
  • AgentVisor CLI — agentvisor serve . starts the runtime

The included compose.yml in each template starts both Ollama and Temporal locally.

Learning Path

Work through these examples in order to build from fundamentals to expert patterns:

StepExampleDifficultyKey Feature
1Chatbot AgentBasicadd_messages, checkpointing, HTTP proxy
2QA AgentIntermediatebind_tools(), ReAct pattern, tool policies
3Task AgentIntermediateinterrupt(), human-in-the-loop, durable approval
4MCP AgentIntermediateMCP Gateway, dynamic tool discovery
5Tracing AgentIntermediateOpenLLMetry, manual spans, Jaeger, agent span forwarding
6Research AgentAdvancedFine-grained HTTP policies, internal network blocking
7Coordinator AgentExpertMulti-agent orchestration, sub-agent policies
8Pentest AgentExpertgVisor shell execution, credential substitution, agentvisor build

Key Concepts Quick Reference

ConceptWhat It IsWhere You'll See It
StateGraphLangGraph class for defining agent flow as a directed graphAll examples
add_messagesAnnotation that automatically accumulates conversation history in stateChatbot, QA, Task
bind_tools()Attaches tool definitions to an LLM so it can call themQA, Research, Coordinator
interrupt()Pauses graph execution and waits for human input via the Thread APITask Agent
langgraph.jsonConfig file AgentVisor reads to discover your graph entry pointsAll examples
AgentVisorCheckpointerDrop-in BaseCheckpointSaver that stores state in TemporalChatbot, QA, Task, Coordinator

For deeper coverage of how AgentVisor integrates with LangGraph — including graph discovery, schema extraction, and framework configuration — see the LangGraph Agents Guide.

Quick Start

# Scaffold any example from a template
agentvisor template create langgraph/chatbot-agent
cd chatbot-agent

# Start Temporal and Ollama
docker compose up -d

# Run the agent
agentvisor serve .

Then open http://localhost:8090/swagger-ui/ to explore the API.