tutorial

How to Monitor LangGraph with Vigilmon

"Learn how to monitor LangGraph agentic applications with Vigilmon — track graph execution health, stateful agent availability, human-in-the-loop pipeline reliability, and set up alerting for agent workflow regressions."

How to Monitor LangGraph with Vigilmon

LangGraph is LangChain's graph-based framework for building stateful, multi-actor agentic applications. It models AI workflows as directed graphs where nodes are LLM calls or tools and edges are conditional transitions — enabling planning-execution-evaluation agent loops, human-in-the-loop interrupts, persistent memory via checkpoints, and complex multi-agent supervisor patterns.

LangGraph applications are inherently stateful and long-running. A graph that pauses for human approval, a supervisor agent that routes between subgraphs, or a planning loop that calls multiple LLMs and tools in sequence — any node in that graph can fail silently while the application appears to be running. This guide covers how to use Vigilmon to keep your LangGraph deployments reliable.


Why Monitor LangGraph Applications

LangGraph graphs introduce failure modes that don't exist in simple stateless APIs:

  1. Infinite loop regressions — conditional edge logic can route a graph into a cycle that never terminates; the process hangs and consumes tokens until timeout or OOM
  2. Checkpoint state corruption — persistent memory via checkpoints can accumulate malformed state that breaks graph re-entry on the next invocation
  3. Human-in-the-loop stalls — graphs waiting for human approval can stay paused indefinitely if the notification mechanism (email, Slack) fails
  4. Subgraph communication failures — in multi-agent supervisor patterns, a failing subagent node can silently return None and cause the supervisor to make incorrect routing decisions
  5. LLM provider latency spikes — a graph with 10 nodes each calling an LLM multiplies provider latency; a 2× slowdown makes the whole graph feel broken
  6. API endpoint availability — if you expose your LangGraph application via LangServe or a custom FastAPI wrapper, that endpoint needs uptime monitoring

Vigilmon provides heartbeat monitoring, HTTP availability checks, and response-time alerting to catch all of these.


Key Metrics to Monitor

| Metric | What it indicates | |--------|------------------| | Graph execution heartbeat | Scheduled graph runs are completing | | API endpoint availability | LangServe or wrapper is reachable | | Response time per endpoint | Graph latency is within acceptable bounds | | Keyword in response | Graph output is non-empty and valid | | Human-in-the-loop queue depth | Pending approvals are not stacking up | | LLM provider availability | Upstream dependency status |


Setup Guide

1. Monitor the LangServe or FastAPI Endpoint

If you serve your LangGraph application via LangServe or a FastAPI wrapper, add an HTTP monitor in Vigilmon:

In Vigilmon:

  1. Monitors → New Monitor
  2. Type: HTTP
  3. URL: https://yourapp.com/your-graph/invoke
  4. Method: POST with a minimal test payload
  5. Expected status: 200
  6. Interval: 5 minutes
  7. Save

Test your endpoint manually first to confirm the payload format:

# For a LangServe-hosted graph
curl -X POST https://yourapp.com/research-agent/invoke \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "messages": [{"role": "user", "content": "ping"}]
    },
    "config": {}
  }'

Configure Vigilmon's keyword check to assert that "output" or "messages" appears in the response — this confirms the graph ran to completion, not just that the HTTP server is up.

Add a /health route to your LangServe application for a faster, cheaper liveness check:

# app.py — LangServe with a health endpoint
from fastapi import FastAPI
from langserve import add_routes
from langchain_core.runnables import RunnableLambda

app = FastAPI()

# Mount your graph
add_routes(app, your_graph, path="/research-agent")

@app.get("/health")
async def health():
    return {"ok": True, "service": "langgraph-research-agent"}

2. Add Heartbeats to Scheduled Graph Runs

For any LangGraph workflow that runs on a schedule (daily report generation, nightly data enrichment, periodic memory consolidation), add a Vigilmon heartbeat:

In Vigilmon:

  1. Monitors → New Monitor
  2. Type: Heartbeat
  3. Name: LangGraph — Daily Report Agent
  4. Expected interval: 24 hours
  5. Grace period: 1 hour
  6. Save — copy the ping URL

Instrument your graph invocation script:

import requests
import os
from langgraph.graph import StateGraph, END
from typing import TypedDict, Annotated
import operator

VIGILMON_HB = os.environ.get("VIGILMON_HEARTBEAT_URL", "")

class AgentState(TypedDict):
    messages: Annotated[list, operator.add]
    report: str

def run_daily_report_graph(topic: str) -> str:
    # Build and compile your graph
    workflow = StateGraph(AgentState)
    workflow.add_node("researcher", research_node)
    workflow.add_node("writer", writer_node)
    workflow.add_node("reviewer", reviewer_node)
    workflow.add_edge("researcher", "writer")
    workflow.add_edge("writer", "reviewer")
    workflow.add_edge("reviewer", END)
    workflow.set_entry_point("researcher")

    graph = workflow.compile()

    result = graph.invoke({"messages": [("user", f"Write a daily report on {topic}")]})

    if VIGILMON_HB:
        try:
            requests.get(VIGILMON_HB, timeout=5)
        except Exception as e:
            print(f"[vigilmon] Heartbeat ping failed (non-fatal): {e}")

    return result["report"]

if __name__ == "__main__":
    run_daily_report_graph("AI industry trends")

3. Monitor Human-in-the-Loop Pipeline Freshness

LangGraph's interrupt mechanism lets graphs pause for human approval. These paused states can stall indefinitely. Expose a health endpoint that checks whether there are pending approvals older than your SLA:

# hitl_health.py — FastAPI health route
import time
from fastapi import FastAPI
from your_persistence import get_pending_interrupts  # your checkpoint store query

app = FastAPI()

STALE_THRESHOLD_SECONDS = 3600  # 1 hour SLA for human review

@app.get("/health/hitl")
async def hitl_health():
    pending = get_pending_interrupts()  # List of {thread_id, created_at, type}
    stale = [
        p for p in pending
        if time.time() - p["created_at"] > STALE_THRESHOLD_SECONDS
    ]

    return {
        "ok": len(stale) == 0,
        "pending_count": len(pending),
        "stale_count": len(stale),
        "stale_threads": [p["thread_id"] for p in stale[:5]],
    }

Point Vigilmon at /health/hitl with a keyword check on "ok":true. Alert when stale_count is non-zero — it means your notification pipeline (Slack DM, email) for human-in-the-loop approval is broken.

4. Track Graph Execution Health with a Checkpoint Monitor

LangGraph's checkpoint system uses a persistence backend (SQLite, Postgres, Redis). Monitor that backend's availability directly:

# checkpoint_health.py
import time
from fastapi import FastAPI
from langgraph.checkpoint.postgres import PostgresSaver
import psycopg

app = FastAPI()

DB_URL = "postgresql://user:pass@localhost/langgraph"

@app.get("/health/checkpoints")
async def checkpoint_health():
    try:
        with psycopg.connect(DB_URL) as conn:
            with conn.cursor() as cur:
                cur.execute("SELECT COUNT(*) FROM checkpoints WHERE created_at > NOW() - INTERVAL '1 hour'")
                recent_count = cur.fetchone()[0]
        return {"ok": True, "checkpoints_last_hour": recent_count}
    except Exception as e:
        return {"ok": False, "error": str(e)}

This confirms the checkpoint store is reachable and that graph state is being persisted — a checkpoint store that silently stops writing means agent memory is broken for all users.

5. Monitor the Underlying LLM Providers

Each node in your LangGraph application calls an LLM. Add dedicated Vigilmon monitors for your providers:

# OpenAI (GPT-4 nodes)
https://api.openai.com/v1/models

# Anthropic (Claude nodes)
https://api.anthropic.com/v1/models

# Together AI, Groq, etc.
https://api.groq.com/openai/v1/models

See the AI API monitoring guide for authentication and detailed setup. A multi-node graph that calls OpenAI and Anthropic in sequence will fail entirely when either provider is down — monitor both independently.


Alerting

Configure Vigilmon alerts for your LangGraph monitors:

  1. Open each monitor → Alerts
  2. Add notification channels:
    • Slack: #ai-ops for graph execution failures and endpoint outages
    • Email: On-call engineer for missed heartbeats
    • PagerDuty: Production-serving graph failures (customer-facing applications)

Recommended thresholds:

| Monitor | Alert after | Escalate after | |---------|------------|----------------| | LangServe API endpoint | 2 consecutive failures | 3 consecutive failures | | Health endpoint | 1 failure | 5-minute sustained failure | | Scheduled graph heartbeat | 1 missed heartbeat | N/A (single run) | | HITL health (stale approvals) | 1 failure | 30-minute sustained failure | | Checkpoint store | 1 failure | 5-minute sustained failure | | LLM provider API | 1 failure | 15-minute sustained failure |

Set the response time warning threshold on your /invoke endpoint to 30 000ms — multi-node LLM graphs are slow by nature, but anything above 30 seconds usually indicates a stuck node or infinite loop.


Monitoring Multi-Agent Supervisor Patterns

If you build multi-agent supervisors with LangGraph (a supervisor graph that routes between specialized subgraph agents), create a Vigilmon monitor group:

  1. Groups → New Group
  2. Name: "LangGraph Multi-Agent System"
  3. Add:
    • The supervisor graph endpoint monitor
    • Each subagent endpoint monitor
    • The checkpoint store health monitor
    • All LLM provider monitors
  4. Alert if any monitor fails

A subagent failure that doesn't propagate to the supervisor will show up as a degraded response — the supervisor keeps routing to it and getting bad results. Monitoring each subagent endpoint independently catches this.


Conclusion

LangGraph makes it possible to build sophisticated agentic workflows with persistent state, human-in-the-loop, and complex conditional logic — but that power requires operational discipline. Heartbeat monitors catch scheduled graphs that silently stop running. HTTP monitors catch API endpoints that go down. Checkpoint store monitors catch persistence failures that break agent memory across sessions.

Start with one heartbeat per scheduled graph and one HTTP monitor per public endpoint — you'll catch the most common production failures in under ten minutes of setup.


Further Reading

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →