You can list threads, with optional filters. It returns a paginated list of threads.The returned thread list doesn’t contain the thread steps. If you need the steps, you should use the export_threads method.
Copy
threads = await client.api.list_threads(first=None, after=None, filters=None)print(threads["pageInfo"])for thread in threads["data"]: print(thread.to_dict())
This method is optimized to export a large number of threads. It returns a paginated list of threads with their steps.
You can optionally filter the threads.
Copy
from literalai.thread import DateTimeFilter, ThreadFilterfilters = ThreadFilter( createdAt=DateTimeFilter(operator="gt", value="2023-12-14"),)page = 1result = await client.api.export_threads(page=page, filters=filters)while result.hasNextPage: page += 1 result = await client.api.export_threads(page=page, filters=filters) # Do something with the thread list in result.data