Skip to main content

Installation

Usage with LangChain

Usage with LangGraph

Usage with Chains

How It Works

MeshAICallbackHandler implements LangChain’s callback interface. The on_llm_end method:
  1. Extracts the model name from LLMResult.llm_output
  2. Extracts token usage from the response metadata
  3. Infers the provider from the model name
  4. Sends to MeshAI (buffered, non-blocking)
Works with any LangChain-compatible model: ChatOpenAI, ChatAnthropic, ChatGoogle, etc.