A LangGraph run can loop through nodes dozens of times before it finishes, or does not finish. Agent Ping rolls the whole graph execution into one run record: what it cost, whether it completed, how long it took, and whether the output held up.
Graphs make agent control flow explicit, and they make runaway cost invisible. A conditional edge that keeps routing back through your model node burns tokens on every pass, and nothing in the provider bill tells you which graph, which customer, or which loop did it. LangSmith traces the steps; the run-level questions, what did this execution cost and did it succeed, still need answering.
Initialise once, then wrap the graph invocation and pass the callback handler. Every node the graph visits, including loops, retries and tool calls, rolls up into a single run record with cost, status and latency.
pip install agentping
import os
import agentping
from agentping import AgentPingCallbackHandler
agentping.init(api_key=os.environ["AGENTPING_API_KEY"])
# Wrap the invoke; every node the graph visits rolls up into one run.
with agentping.run("research-graph", customer_id="acme-corp"):
result = graph.invoke(
{"messages": [("user", question)]},
config={"callbacks": [AgentPingCallbackHandler()]},
)
Full setup, environment variables and options are in the Python SDK docs.
Send one run from LangGraph and see cost, status and latency. Then add an alert for cost spikes or missed runs.
Step-by-step guide: monitor LangGraph agents → Monitoring plain LangChain chains → Agent Ping vs LangSmith → Spend, cost attribution → Verify, quality scoring → Pulse, live monitoring →