langsmith.client.Client.list_runs#

Client.list_runs(*, project_id: UUID | str | Sequence[UUID | str] | None = None, project_name: str | Sequence[str] | None = None, run_type: str | None = None, trace_id: UUID | str | None = None, reference_example_id: UUID | str | None = None, query: str | None = None, filter: str | None = None, trace_filter: str | None = None, tree_filter: str | None = None, is_root: bool | None = None, parent_run_id: UUID | str | None = None, start_time: datetime | None = None, error: bool | None = None, run_ids: Sequence[UUID | str] | None = None, select: Sequence[str] | None = None, limit: int | None = None, **kwargs: Any) Iterator[Run][source]#

List runs from the LangSmith API.

Parameters:
  • project_id (UUID or None, default=None) – The ID(s) of the project to filter by.

  • project_name (str or None, default=None) – The name(s) of the project to filter by.

  • run_type (str or None, default=None) – The type of the runs to filter by.

  • trace_id (UUID or None, default=None) – The ID of the trace to filter by.

  • reference_example_id (UUID or None, default=None) – The ID of the reference example to filter by.

  • query (str or None, default=None) – The query string to filter by.

  • filter (str or None, default=None) – The filter string to filter by.

  • trace_filter (str or None, default=None) – Filter to apply to the ROOT run in the trace tree. This is meant to be used in conjunction with the regular filter parameter to let you filter runs by attributes of the root run within a trace.

  • tree_filter (str or None, default=None) – Filter to apply to OTHER runs in the trace tree, including sibling and child runs. This is meant to be used in conjunction with the regular filter parameter to let you filter runs by attributes of any run within a trace.

  • is_root (bool or None, default=None) – Whether to filter by root runs.

  • parent_run_id (UUID or None, default=None) – The ID of the parent run to filter by.

  • start_time (datetime or None, default=None) – The start time to filter by.

  • error (bool or None, default=None) – Whether to filter by error status.

  • run_ids (List[str or UUID] or None, default=None) – The IDs of the runs to filter by.

  • limit (int or None, default=None) – The maximum number of runs to return.

  • **kwargs (Any) – Additional keyword arguments.

  • Yields –

  • ------ –

  • Run – The runs.

  • Examples –

  • -------- –

  • code-block: (..) –

    python: # List all runs in a project project_runs = client.list_runs(project_name=”<your_project>”)

    # List LLM and Chat runs in the last 24 hours todays_llm_runs = client.list_runs(

    project_name=”<your_project>”, start_time=datetime.now() - timedelta(days=1), run_type=”llm”,

    )

    # List root traces in a project root_runs = client.list_runs(project_name=”<your_project>”, is_root=1)

    # List runs without errors correct_runs = client.list_runs(project_name=”<your_project>”, error=False)

    # List runs and only return their inputs/outputs (to speed up the query) input_output_runs = client.list_runs(

    project_name=”<your_project>”, select=[“inputs”, “outputs”]

    )

    # List runs by run ID run_ids = [

    ”a36092d2-4ad5-4fb4-9c0d-0dba9a2ed836”, “9398e6be-964f-4aa4-8ae9-ad78cd4b7074”,

    ] selected_runs = client.list_runs(id=run_ids)

    # List all “chain” type runs that took more than 10 seconds and had # total_tokens greater than 5000 chain_runs = client.list_runs(

    project_name=”<your_project>”, filter=’and(eq(run_type, “chain”), gt(latency, 10), gt(total_tokens, 5000))’,

    )

    # List all runs called “extractor” whose root of the trace was assigned feedback “user_score” score of 1 good_extractor_runs = client.list_runs(

    project_name=”<your_project>”, filter=’eq(name, “extractor”)’, trace_filter=’and(eq(feedback_key, “user_score”), eq(feedback_score, 1))’,

    )

    # List all runs that started after a specific timestamp and either have “error” not equal to null or a “Correctness” feedback score equal to 0 complex_runs = client.list_runs(

    project_name=”<your_project>”, filter=’and(gt(start_time, “2023-07-15T12:34:56Z”), or(neq(error, null), and(eq(feedback_key, “Correctness”), eq(feedback_score, 0.0))))’,

    )

    # List all runs where tags include “experimental” or “beta” and latency is greater than 2 seconds tagged_runs = client.list_runs(

    project_name=”<your_project>”, filter=’and(or(has(tags, “experimental”), has(tags, “beta”)), gt(latency, 2))’,

    )

  • select (Sequence[str] | None) –

Return type:

Iterator[Run]