Skip to main content

Framework Integrations

TokenSense provides native callback handlers for both LangChain and LlamaIndex. Instead of wrapping your LLM client with observe(), you simply attach the respective TokenSense callback handler to your LLM configuration. This provides full observability into complex agentic workflows, RAG pipelines, and multi-step reasoning chains.

LangChain

Import TokenSenseCallbackHandler and pass it into the callbacks list when invoking your LangChain models.

LlamaIndex

Import TokenSenseLlamaIndexCallback and add it to your global CallbackManager before running your query engines or agents.