1616 session_navigate_params ,
1717)
1818from ._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
19+ from .types .session_start_response import SessionStartResponse , Data as SessionStartResponseData
1920from .types .session_act_response import SessionActResponse
2021from .types .session_end_response import SessionEndResponse
2122from .types .session_execute_response import SessionExecuteResponse
@@ -36,12 +37,15 @@ def _with_default_frame_id(params: TSessionParams) -> TSessionParams:
3637 from ._client import Stagehand , AsyncStagehand
3738
3839
39- class Session :
40+ class Session ( SessionStartResponse ) :
4041 """A Stagehand session bound to a specific `session_id`."""
4142
42- def __init__ (self , client : Stagehand , id : str ) -> None :
43+ def __init__ (self , client : Stagehand , id : str , data : SessionStartResponseData , success : bool ) -> None :
4344 self ._client = client
4445 self .id = id
46+ # in case user tries to use client.sessions.start(...) return value as a SessionStartResponse dataclass/dict
47+ super ().__init__ (data = data , success = success )
48+
4549
4650 def navigate (
4751 self ,
@@ -158,12 +162,13 @@ def end(
158162 )
159163
160164
161- class AsyncSession :
165+ class AsyncSession ( SessionStartResponse ) :
162166 """Async variant of `Session`."""
163167
164- def __init__ (self , client : AsyncStagehand , id : str ) -> None :
168+ def __init__ (self , client : AsyncStagehand , id : str , data : SessionStartResponseData , success : bool ) -> None :
165169 self ._client = client
166170 self .id = id
171+ super ().__init__ (data = data , success = success )
167172
168173 async def navigate (
169174 self ,
0 commit comments