In the API documentation, I only found the interface at run granularity, but I want to get the Trace data of the conversation between the user and my Agent at Thread granularity.
If I get it at run granularity, I need to process it twice, which is especially troublesome. Can the LangSmith API/SDK provide interfaces related to Thread?
1 Like
LangSmith doesn’t currently have a direct Thread-level API endpoint. You need to use the runs API with thread filtering. Use the list_runs()
method with the filter
parameter to get all runs for a specific thread:
from langsmith import Client
client = Client()
runs = client.list_runs(filter=f'eq(thread_id, "{thread_id}")')
This returns all runs for that thread in one call, avoiding the need to process individual runs separately. You can also add additional filters like date ranges or run types to narrow down the results. While not a dedicated thread endpoint, this approach gives you thread level trace data efficiently.
1 Like