2121 SDKAgentCreateParams ,
2222 SDKDevboxCreateParams ,
2323 SDKObjectCreateParams ,
24+ SDKScenarioListParams ,
2425 SDKScorerCreateParams ,
2526 SDKBlueprintListParams ,
2627 SDKBlueprintCreateParams ,
3334from .async_agent import AsyncAgent
3435from .async_devbox import AsyncDevbox
3536from .async_scorer import AsyncScorer
37+ from .async_scenario import AsyncScenario
3638from .async_snapshot import AsyncSnapshot
3739from .async_blueprint import AsyncBlueprint
3840from .async_storage_object import AsyncStorageObject
@@ -543,7 +545,8 @@ async def list(self, **params: Unpack[SDKScorerListParams]) -> list[AsyncScorer]
543545 """
544546 page = await self ._client .scenarios .scorers .list (** params )
545547 return [AsyncScorer (self ._client , item .id ) async for item in page ]
546-
548+
549+
547550class AsyncAgentOps :
548551 """High-level async manager for creating and managing agents.
549552
@@ -553,15 +556,10 @@ class AsyncAgentOps:
553556 Example:
554557 >>> runloop = AsyncRunloopSDK()
555558 >>> # Create agent from NPM package
556- >>> agent = await runloop.agent.create_from_npm(
557- ... name="my-agent",
558- ... package_name="@runloop/example-agent"
559- ... )
559+ >>> agent = await runloop.agent.create_from_npm(name="my-agent", package_name="@runloop/example-agent")
560560 >>> # Create agent from Git repository
561561 >>> agent = await runloop.agent.create_from_git(
562- ... name="git-agent",
563- ... repository="https://github.com/user/agent-repo",
564- ... ref="main"
562+ ... name="git-agent", repository="https://github.com/user/agent-repo", ref="main"
565563 ... )
566564 >>> # List all agents
567565 >>> agents = await runloop.agent.list(limit=10)
@@ -615,7 +613,9 @@ async def create_from_npm(
615613 :raises ValueError: If 'source' is provided in params
616614 """
617615 if "source" in params :
618- raise ValueError ("Cannot specify 'source' when using create_from_npm(); source is automatically set to npm configuration" )
616+ raise ValueError (
617+ "Cannot specify 'source' when using create_from_npm(); source is automatically set to npm configuration"
618+ )
619619
620620 npm_config : dict = {"package_name" : package_name }
621621 if npm_version is not None :
@@ -655,7 +655,9 @@ async def create_from_pip(
655655 :raises ValueError: If 'source' is provided in params
656656 """
657657 if "source" in params :
658- raise ValueError ("Cannot specify 'source' when using create_from_pip(); source is automatically set to pip configuration" )
658+ raise ValueError (
659+ "Cannot specify 'source' when using create_from_pip(); source is automatically set to pip configuration"
660+ )
659661
660662 pip_config : dict = {"package_name" : package_name }
661663 if pip_version is not None :
@@ -692,7 +694,9 @@ async def create_from_git(
692694 :raises ValueError: If 'source' is provided in params
693695 """
694696 if "source" in params :
695- raise ValueError ("Cannot specify 'source' when using create_from_git(); source is automatically set to git configuration" )
697+ raise ValueError (
698+ "Cannot specify 'source' when using create_from_git(); source is automatically set to git configuration"
699+ )
696700
697701 git_config : dict = {"repository" : repository }
698702 if ref is not None :
@@ -724,7 +728,9 @@ async def create_from_object(
724728 :raises ValueError: If 'source' is provided in params
725729 """
726730 if "source" in params :
727- raise ValueError ("Cannot specify 'source' when using create_from_object(); source is automatically set to object configuration" )
731+ raise ValueError (
732+ "Cannot specify 'source' when using create_from_object(); source is automatically set to object configuration"
733+ )
728734
729735 object_config : dict = {"object_id" : object_id }
730736 if agent_setup is not None :
@@ -761,6 +767,45 @@ async def list(
761767 return [AsyncAgent (self ._client , item .id , item ) for item in page .agents ]
762768
763769
770+ class AsyncScenarioOps :
771+ """Manage scenarios (async). Access via ``runloop.scenario``.
772+
773+ Example:
774+ >>> runloop = AsyncRunloopSDK()
775+ >>> scenario = runloop.scenario.from_id("scn-xxx")
776+ >>> run = await scenario.run()
777+ >>> scenarios = await runloop.scenario.list()
778+ """
779+
780+ def __init__ (self , client : AsyncRunloop ) -> None :
781+ """Initialize AsyncScenarioOps.
782+
783+ :param client: AsyncRunloop client instance
784+ :type client: AsyncRunloop
785+ """
786+ self ._client = client
787+
788+ def from_id (self , scenario_id : str ) -> AsyncScenario :
789+ """Get an AsyncScenario instance for an existing scenario ID.
790+
791+ :param scenario_id: ID of the scenario
792+ :type scenario_id: str
793+ :return: AsyncScenario instance for the given ID
794+ :rtype: AsyncScenario
795+ """
796+ return AsyncScenario (self ._client , scenario_id )
797+
798+ async def list (self , ** params : Unpack [SDKScenarioListParams ]) -> list [AsyncScenario ]:
799+ """List all scenarios, optionally filtered by parameters.
800+
801+ :param params: See :typeddict:`~runloop_api_client.sdk._types.SDKScenarioListParams` for available parameters
802+ :return: List of scenarios
803+ :rtype: list[AsyncScenario]
804+ """
805+ page = await self ._client .scenarios .list (** params )
806+ return [AsyncScenario (self ._client , item .id ) async for item in page ]
807+
808+
764809class AsyncRunloopSDK :
765810 """High-level asynchronous entry point for the Runloop SDK.
766811
@@ -776,6 +821,8 @@ class AsyncRunloopSDK:
776821 :vartype devbox: AsyncDevboxOps
777822 :ivar blueprint: High-level async interface for blueprint management
778823 :vartype blueprint: AsyncBlueprintOps
824+ :ivar scenario: High-level async interface for scenario management
825+ :vartype scenario: AsyncScenarioOps
779826 :ivar scorer: High-level async interface for scorer management
780827 :vartype scorer: AsyncScorerOps
781828 :ivar snapshot: High-level async interface for snapshot management
@@ -795,6 +842,7 @@ class AsyncRunloopSDK:
795842 agent : AsyncAgentOps
796843 devbox : AsyncDevboxOps
797844 blueprint : AsyncBlueprintOps
845+ scenario : AsyncScenarioOps
798846 scorer : AsyncScorerOps
799847 snapshot : AsyncSnapshotOps
800848 storage_object : AsyncStorageObjectOps
@@ -840,6 +888,7 @@ def __init__(
840888 self .agent = AsyncAgentOps (self .api )
841889 self .devbox = AsyncDevboxOps (self .api )
842890 self .blueprint = AsyncBlueprintOps (self .api )
891+ self .scenario = AsyncScenarioOps (self .api )
843892 self .scorer = AsyncScorerOps (self .api )
844893 self .snapshot = AsyncSnapshotOps (self .api )
845894 self .storage_object = AsyncStorageObjectOps (self .api )
0 commit comments