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
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:
| 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 |
Key Concepts Quick Reference
| 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 |
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.