Skip to main content

aip_sdk.iter_runs

aip_sdk.iter_runs(project_id: str | None = None, status: RunStatus | None = None, *, metric: str | None = None, metric_config_name: str | None = None, metric_config_version: str | None = None, workspace_id: str | None = None, all_workspaces: bool = False, per_page: int = 20, client: APIClient | None = None) -> Iterator[RunSummary]

Iterate every matching run, newest first, auto-paginating — same filters as list_runs(), walking every page instead of returning one.

Reads your session's workspace unless you name one, and raises if none is set. Pass all_workspaces=True to read across every workspace you can access.

Parameters

  • project_id str | None: Only return runs in this project.
  • status RunStatus | None: Only return runs in this status.
  • metric str | None: The metric metric_config_name/metric_config_version match against; requires at least one of them.
  • metric_config_name str | None: Only runs whose scoring snapshot for metric resolved this config name. Requires metric.
  • metric_config_version str | None: Same, for config version. Requires metric.
  • workspace_id str | None: Only return runs in this workspace.
  • all_workspaces bool: Read across every workspace you can access.
  • per_page int: Page size used internally for each request (1-100).
  • client APIClient | None: Optional API client. Defaults to the module-level client.

Yields

  • RunSummary RunSummary: each matching run, across as many pages as needed.

Raises

  • InvalidArgumentError: If per_page is out of range, or the metric/config-filter pairing is inconsistent.
  • AuthError: If no credentials are configured.
  • APIError: If a listing request fails or returns a malformed response.
  • ForbiddenError: If workspace_id names a workspace you cannot access.
  • NoWorkspaceSelectedError: No workspace was passed, none is configured for the session, and all_workspaces was not set. Raised at this call, before any request.

Example:

for summary in aip.iter_runs(metric="agent.custom_judge_rubric", metric_config_name="rubric_prompt_a"):
print(summary.id, summary.status)