Skip to main content

LangChain

To integrate our tracing features with LangChain, you simply need to use a callback handler, BaserunCallbackHandler, which you can pass when creating a client object or a chain. Currently, only our Python SDK supports integration with LangChain.

Tracing a client

If you use the BaserunCallbackHandler you do not need to use @baserun.trace- the handler does it for you.
python

Tracing a chain

To trace a chain, pass in the BaserunCallbackHandler to the callbacks parameter of LLMChain.
python

Tracing an agent

To trace an agent, pass in the BaserunCallbackHandler to the callback_manager parameter of initialize_agent.
python