LangGraph
AxonPushLangGraphHandler records every node traversal of a StateGraph on top of the full LangChain callback surface.
AxonPushLangGraphHandler extends
AxonPushCallbackHandler with two extra
events that record per-node traversal of a StateGraph. LangGraph still
consumes LangChain.js’s callback interface, so everything the LangChain handler
emits is emitted here too.
Tested against @langchain/langgraph@^0.4.
Install
npm install @axonpush/sdk @langchain/langgraph
Attach the handler
import { AxonPush, AxonPushLangGraphHandler } from "@axonpush/sdk";
const client = new AxonPush();
const handler = new AxonPushLangGraphHandler({
client,
channelId: process.env.AXONPUSH_CHANNEL_ID!,
agentId: "research-graph",
});
Then pass it wherever LangGraph accepts callbacks:
import { StateGraph } from "@langchain/langgraph";
const graph = new StateGraph({ channels })
.addNode("agent", agentNode)
.addNode("tools", toolNode)
.compile();
const result = await graph.invoke(input, { callbacks: [handler] });
agentId defaults to "langgraph".
What gets emitted
Everything from the LangChain handler, plus:
| Identifier | axonpush eventType | Payload |
|---|---|---|
graph.node.start | agent.start | node_name, truncated inputs |
graph.node.end | agent.end | truncated outputs |
graph.node.start only fires when a node name can be resolved, from
LangChain’s runName, then metadata.langgraph_node, then serialized.name.
Graph-level events carry metadata.framework: "langgraph" and
metadata.node; the inherited chain and LLM events carry
metadata.framework: "langchain".
Reading node identity
LangGraph compiles nodes into anonymous Runnables: handleChainStart receives
serialized = {} and the node’s identity arrives in the trailing runName
argument and metadata.langgraph_node. Before 0.0.7 the handler read only
serialized.name, so every step in every graph was labelled
chain_type: "unknown". It now falls through the full chain of derivations and
also propagates langgraph_node, langgraph_step, langgraph_triggers, and
thread_id into event metadata, enough to group a trace by node or by
conversation thread in the UI.
No code change is needed to pick this up; upgrade the package.