langsmith.async_client.AsyncClient.list_runs#

async AsyncClient.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) AsyncIterator[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 –

  • -------- –

  • project (List root traces in a) –

  • code-block: (..) – python: project_runs = client.list_runs(project_name=”<your_project>”)

  • hours (List LLM and Chat runs in the last 24) –

  • code-block: –

    python: todays_llm_runs = client.list_runs(

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

    )

  • project –

  • code-block: – python: root_runs = client.list_runs(project_name=”<your_project>”, is_root=1)

  • errors (List runs without) –

  • code-block: – python: correct_runs = client.list_runs(project_name=”<your_project>”, error=False)

  • query) (List runs and only return their inputs/outputs (to speed up the) –

  • code-block: –

    python: input_output_runs = client.list_runs(

    project_name=”<your_project>”, select=[β€œinputs”, β€œoutputs”]

    )

  • ID (List runs by run) –

  • code-block: –

    python: run_ids = [

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

    ] selected_runs = client.list_runs(id=run_ids)

  • had (List all "chain" type runs that took more than 10 seconds and) –

  • 5000 (total_tokens greater than) –

  • code-block: –

    python: chain_runs = client.list_runs(

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

    )

  • 1 (List all runs called "extractor" whose root of the trace was assigned feedback "user_score" score of) –

  • code-block: –

    python: 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))’,

    )

  • 0 (List all runs that started after a specific timestamp and either have "error" not equal to null or a "Correctness" feedback score equal to) –

  • code-block: –

    python: 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))))’,

    )

  • seconds (List all runs where tags include "experimental" or "beta" and latency is greater than 2) –

  • code-block: –

    python: 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:

AsyncIterator[Run]