Skip to content

Conversation

@sid-rl
Copy link
Contributor

@sid-rl sid-rl commented Dec 17, 2025

Add new SDK classes for managing benchmark runs:

  • BenchmarkRun: Synchronous class for benchmark run operations

    • get_info(): Retrieve run status and metadata
    • cancel(): Cancel the benchmark run
    • complete(): Mark the run as completed
    • list_scenario_runs(): List scenario runs with filtering
  • AsyncBenchmarkRun: Async version with the same interface

  • SDKBenchmarkRunListScenarioRunsParams: TypedDict for list params

  • Unit tests for both sync and async classes

  • E2E smoketests validating against real API

@sid-rl sid-rl requested a review from james-rl December 17, 2025 01:38
Copy link
Contributor

@james-rl james-rl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few areas of potential inconsistency or where the naming looks a bit weird, but this looks generally ok.

# Get info
info = benchmark_run.get_info()
assert info.id == run_data.id
assert info.state in ["queued", "running", "completed", "canceled"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queued doesn't exist as a state?

Comment on lines 112 to 126
def list_scenario_runs(
self,
**params: Unpack[SDKBenchmarkRunListScenarioRunsParams],
) -> List[ScenarioRunView]:
"""List all scenario runs for this benchmark run.

:param params: See :typeddict:`~runloop_api_client.sdk._types.SDKBenchmarkRunListScenarioRunsParams` for available parameters
:return: List of scenario run views
:rtype: List[ScenarioRunView]
"""
page = self._client.benchmarks.runs.list_scenario_runs(
self._id,
**params,
)
return list(page)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider improving the interaction pattern to provide something like a paged iterator (or adding a separate iterator method to do this instead).

Comment on lines +63 to +66
async def get_info(
self,
**options: Unpack[BaseRequestOptions],
) -> BenchmarkRunView:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this something else instead? get_state or refresh?

@sid-rl sid-rl force-pushed the siddarth/benchmark-sdk branch from 04b9a9c to 4650641 Compare December 17, 2025 18:17
@sid-rl sid-rl requested a review from james-rl December 17, 2025 20:22
Copy link
Contributor

@james-rl james-rl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a shame that get_info is now a widely supported convention but I agree that it's worse to make a change to only one place.

A minor nit for you in the comments, but this generally looks good

self._id = run_id
self._benchmark_id = benchmark_id

@override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you want @override without a base class

Comment on lines +42 to +44
@override
def __repr__(self) -> str:
return f"<BenchmarkRun id={self._id!r}>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here

@sid-rl sid-rl merged commit 1021c5a into next Dec 17, 2025
6 checks passed
@sid-rl sid-rl deleted the siddarth/benchmark-sdk branch December 17, 2025 20:37
@stainless-app stainless-app bot mentioned this pull request Dec 17, 2025
stainless-app bot pushed a commit that referenced this pull request Dec 18, 2025
* update requirements-dev

* pyproject formatting nit

* feat(sdk): add BenchmarkRun and AsyncBenchmarkRun classes

* fixed smoketests

* `list_scenario_runs()` now returns a list of ScenarioRun/AsyncScenarioRun objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants