LangChain Support
Back to SDKs and APIs

How do I filter runs by multiple run IDs using tree filters?

SDKs and APIs·1 min read·Nov 23, 2025··

Context

When you have multiple run IDs (for example, 200 runs) and want to retrieve them efficiently using the LangSmith client with a tree filter, you may notice that the run_id field only supports the "is" operator rather than "in" for multiple values. Making individual list_runs calls for each run ID can be slow and inefficient.

Answer

You can filter runs by multiple run IDs using the in operator with the id field in your tree filter. Here's the solution:

Use the following syntax with the LangSmith client:

client.list_runs(
    project_name="your-project-name", 
    tree_filter='in(id,["run-id-1","run-id-2","run-id-3"])'
)

Replace "run-id-1","run-id-2","run-id-3" with your actual run IDs. This approach allows you to retrieve multiple runs in a single API call instead of making separate calls for each run ID.

Note: While the run_id field only supports the "is" operator, the id field supports the in operator for filtering multiple values efficiently.