How to trace the OpenAI Assistants API?
The native integrations for OpenAI (Python & JS/TS) do not instrument the Assistants API natively as it shifts state to OpenAI (threads, etc.). However, you can still trace the API calls via our Python and JS integrations and visualize the results in Langfuse.
Python
You can instrument the OpenAI Assistants API (opens in a new tab) via the Langfuse observe()
decorator. We have prepared a simple example to demonstrate how to trace the API calls and visualize the results in Langfuse.
JS/TS
We do not yet have a published example on how to do this via the Langfuse JS/TS SDK. However, you can have a look at the Python example to understand the general approach: (1) create an assistant, (2) run it on a thread, and (3) observe the execution with Langfuse tracing.