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
ollamavia Docker Compose - Temporal — required for durable execution and checkpointing
- AgentVisor CLI —
agentvisor serve .starts the runtime jq— used by the examples below to pretty-print API responses
The included compose.yml in each template starts both Ollama and Temporal locally.
Examples
Work through these in order to build from fundamentals to expert patterns:
| Step | Example | Difficulty | Key Feature |
|---|---|---|---|
| 1 | Chatbot Agent | Basic | add_messages, checkpointing, HTTP proxy |
| 2 | QA Agent | Intermediate | bind_tools(), ReAct pattern, tool policies |
| 3 | Task Agent | Intermediate | interrupt(), human-in-the-loop, durable approval |
| 4 | MCP Agent | Intermediate | MCP Gateway, dynamic tool discovery |
| 5 | Tracing Agent | Intermediate | OpenLLMetry, manual spans, Jaeger, agent span forwarding |
| 6 | Research Agent | Advanced | Fine-grained HTTP policies, internal network blocking |
| 7 | Coordinator Agent | Expert | Multi-agent orchestration, sub-agent policies |
| 8 | Pentest Agent | Expert | gVisor shell execution, credential substitution, agentvisor build |
How It Works
LangGraph agents in AgentVisor work through the LangGraph framework provider:
- Discovery: AgentVisor detects
langgraph.jsonand selects the LangGraph provider automatically — checked first, ahead of every other framework's discovery file - Schema extraction: Graph schemas are extracted via a three-tier fallback — a build-time cache, then dynamic extraction, then graph names only from
langgraph.json - Execution:
python3 -m agentvisor.langgraph.runnerloads and invokes your compiled graph inside the sandbox - Checkpointing:
AgentVisorCheckpointeris a drop-inBaseCheckpointSaverthat stores graph state in Temporal automatically
Key Concepts
| Concept | What It Is | Where You'll See It |
|---|---|---|
StateGraph | LangGraph class for defining agent flow as a directed graph | All examples |
add_messages | Annotation that automatically accumulates conversation history in state | Chatbot, QA, Task |
bind_tools() | Attaches tool definitions to an LLM so it can call them | QA, Research, Coordinator |
interrupt() | Pauses graph execution and waits for human input via the Thread API | Task Agent |
langgraph.json | Config file AgentVisor reads to discover your graph entry points | All examples |
AgentVisorCheckpointer | Drop-in BaseCheckpointSaver that stores state in Temporal | Chatbot, QA, Task, Coordinator |
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.
See Also
- LangGraph Agents Guide — graph discovery, schema extraction, and framework configuration in depth