Skip to content

Conversation

@sid-rl
Copy link
Contributor

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

Thin scenario class wrapper for sdk. Creation will be through a builder pattern (coming soon)

@sid-rl sid-rl force-pushed the siddarth/scenario-sdk branch from 10592f3 to dc8a68e Compare December 4, 2025 20:09
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.

double-check you committed everything. Other than that i just have some minor doc suggestions

Comment on lines 14 to 17
"""Async wrapper around a scenario resource.

Provides async methods for retrieving scenario details, updating the scenario,
and starting scenario runs.
Copy link
Contributor

Choose a reason for hiding this comment

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

get rid of the Async wrapper comment. It doesn't add value and it leaks system internals

"""

def __init__(self, client: AsyncRunloop, scenario_id: str) -> None:
"""Initialize the wrapper.
Copy link
Contributor

Choose a reason for hiding this comment

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

(same)

the underlying devbox, and retrieving scoring results.

Example:
>>> scenario = await sdk.scenario.from_id("scn-xxx")
Copy link
Contributor

Choose a reason for hiding this comment

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

you have await here but the method isn't async

The underlying devbox may still be starting; call await_env_ready()
on the returned ScenarioRun to wait for it to be ready.

:param params: See SDKScenarioRunParams for available parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

should be SDKScenarioRunAsyncParams; this is referencing the sync version

pass


class TestAsyncScenarioBuilder:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you might have missed a file. There's a test version of the builders, but I don't see the non-test version of the builder.

@sid-rl sid-rl requested a review from james-rl December 5, 2025 01:31
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.

Looks good to me.

Comment on lines 109 to 110
self._client.devboxes.await_running(self._devbox_id, polling_config=options.get("polling_config"))
return self.get_info(**filter_params(options, PollingRequestOptions))
Copy link
Contributor

Choose a reason for hiding this comment

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

await_env_ready forwards the polling config, but get_info doesn't support it, so the arg will get dropped

@sid-rl sid-rl merged commit 21f46f1 into next Dec 5, 2025
6 checks passed
@sid-rl sid-rl deleted the siddarth/scenario-sdk branch December 5, 2025 21:14
@stainless-app stainless-app bot mentioned this pull request Dec 5, 2025
stainless-app bot pushed a commit that referenced this pull request Dec 6, 2025
* uv lock upgrade

* scenario wrapper

* modified ScenarioStartRunParams to follow our previous pattern for use in the SDK

* fixed redundancy and formatting in scenario and scenario run unit tests

* formatting fixes

* changed scenario and scenario smoketests to update existing scenarios and add metadata tag instead of creating new ones every time (workaround for lack of cleanup option)

* changed scenario run methods to `run` and `run_async`, updated parameter TypedDicts appropriately

* exposed all scenario update parameters appropriately using typeddict

* formatting fixes

* remove scenario builder smoketests

* add score_and_complete and download_logs methods to scenario runs, and update docstrings to not leak internals

* add unit tests for ScenarioOps and AsyncScenarioOps

* update tests for scenario.update and change test name for scenario.run and run_async

* add unit tests for download_logs and score_and_complete

* don't pass polling_config to get_info within await_env_ready
stainless-app bot added a commit that referenced this pull request Dec 6, 2025
* chore(smoketests): fixed smoketests and cleaned up typing/formatting (#699)

* increase timeout for flaky smoketest

* don't convert params from TypedDict to dict (unnecessary and undoes type hints)

* docstring formatting fixes

* removed shell exec tests with 'working_dir' parameter testing

* feat(scenarios): added scenario class to sdk (#701)

* uv lock upgrade

* scenario wrapper

* modified ScenarioStartRunParams to follow our previous pattern for use in the SDK

* fixed redundancy and formatting in scenario and scenario run unit tests

* formatting fixes

* changed scenario and scenario smoketests to update existing scenarios and add metadata tag instead of creating new ones every time (workaround for lack of cleanup option)

* changed scenario run methods to `run` and `run_async`, updated parameter TypedDicts appropriately

* exposed all scenario update parameters appropriately using typeddict

* formatting fixes

* remove scenario builder smoketests

* add score_and_complete and download_logs methods to scenario runs, and update docstrings to not leak internals

* add unit tests for ScenarioOps and AsyncScenarioOps

* update tests for scenario.update and change test name for scenario.run and run_async

* add unit tests for download_logs and score_and_complete

* don't pass polling_config to get_info within await_env_ready

* release: 1.1.0

---------

Co-authored-by: sid-rl <siddarth@runloop.ai>
Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
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