LangChain
Trace LangChain chain, LLM, and tool invocations by attaching an AxonPushCallbackHandler to your chain’s callback list. Every lifecycle event ships to AxonPush in real time.
Installation
Section titled “Installation”npm install @axonpush/sdk @langchain/coreimport { AxonPush } from "@axonpush/sdk";import { AxonPushCallbackHandler } from "@axonpush/sdk/integrations/langchain";
const client = new AxonPush({ apiKey: process.env.AXONPUSH_API_KEY!, tenantId: process.env.AXONPUSH_TENANT_ID!,});
const handler = new AxonPushCallbackHandler({ client, channelId: 1, agentId: "my-agent",});import { ChatOpenAI } from "@langchain/openai";import { RunnableSequence } from "@langchain/core/runnables";
const chain = RunnableSequence.from([prompt, new ChatOpenAI()]);const result = await chain.invoke(input, { callbacks: [handler] });Events Traced
Section titled “Events Traced”| Event | When |
|---|---|
chain.start | A chain or runnable begins execution |
chain.end | A chain or runnable completes successfully |
chain.error | A chain or runnable throws an error |
llm.start | An LLM call begins |
llm.end | An LLM call completes |
llm.token | A streaming token is received |
llm.error | An LLM call fails |
tool.*.start | A tool invocation begins |
tool.end | A tool invocation completes |
tool.error | A tool invocation fails |