@@ -876,26 +876,20 @@ def test_parse_retry_after_header(
876876 @mock .patch ("stagehand._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
877877 @pytest .mark .respx (base_url = base_url )
878878 def test_retrying_timeout_errors_doesnt_leak (self , respx_mock : MockRouter , client : Stagehand ) -> None :
879- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act" ).mock (
880- side_effect = httpx .TimeoutException ("Test timeout error" )
881- )
879+ respx_mock .post ("/v1/sessions/start" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
882880
883881 with pytest .raises (APITimeoutError ):
884- client .sessions .with_streaming_response .act (
885- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
886- ).__enter__ ()
882+ client .sessions .with_streaming_response .start (model_name = "gpt-4o" ).__enter__ ()
887883
888884 assert _get_open_connections (client ) == 0
889885
890886 @mock .patch ("stagehand._base_client.BaseClient._calculate_retry_timeout" , _low_retry_timeout )
891887 @pytest .mark .respx (base_url = base_url )
892888 def test_retrying_status_errors_doesnt_leak (self , respx_mock : MockRouter , client : Stagehand ) -> None :
893- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (return_value = httpx .Response (500 ))
889+ respx_mock .post ("/v1/sessions/start " ).mock (return_value = httpx .Response (500 ))
894890
895891 with pytest .raises (APIStatusError ):
896- client .sessions .with_streaming_response .act (
897- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
898- ).__enter__ ()
892+ client .sessions .with_streaming_response .start (model_name = "gpt-4o" ).__enter__ ()
899893 assert _get_open_connections (client ) == 0
900894
901895 @pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -922,11 +916,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
922916 return httpx .Response (500 )
923917 return httpx .Response (200 )
924918
925- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
919+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
926920
927- response = client .sessions .with_raw_response .act (
928- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
929- )
921+ response = client .sessions .with_raw_response .start (model_name = "gpt-4o" )
930922
931923 assert response .retries_taken == failures_before_success
932924 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -948,12 +940,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
948940 return httpx .Response (500 )
949941 return httpx .Response (200 )
950942
951- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
943+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
952944
953- response = client .sessions .with_raw_response .act (
954- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" ,
955- input = "Click the login button" ,
956- extra_headers = {"x-stainless-retry-count" : Omit ()},
945+ response = client .sessions .with_raw_response .start (
946+ model_name = "gpt-4o" , extra_headers = {"x-stainless-retry-count" : Omit ()}
957947 )
958948
959949 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
@@ -975,12 +965,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
975965 return httpx .Response (500 )
976966 return httpx .Response (200 )
977967
978- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
968+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
979969
980- response = client .sessions .with_raw_response .act (
981- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" ,
982- input = "Click the login button" ,
983- extra_headers = {"x-stainless-retry-count" : "42" },
970+ response = client .sessions .with_raw_response .start (
971+ model_name = "gpt-4o" , extra_headers = {"x-stainless-retry-count" : "42" }
984972 )
985973
986974 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
@@ -1856,14 +1844,10 @@ async def test_parse_retry_after_header(
18561844 async def test_retrying_timeout_errors_doesnt_leak (
18571845 self , respx_mock : MockRouter , async_client : AsyncStagehand
18581846 ) -> None :
1859- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act" ).mock (
1860- side_effect = httpx .TimeoutException ("Test timeout error" )
1861- )
1847+ respx_mock .post ("/v1/sessions/start" ).mock (side_effect = httpx .TimeoutException ("Test timeout error" ))
18621848
18631849 with pytest .raises (APITimeoutError ):
1864- await async_client .sessions .with_streaming_response .act (
1865- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
1866- ).__aenter__ ()
1850+ await async_client .sessions .with_streaming_response .start (model_name = "gpt-4o" ).__aenter__ ()
18671851
18681852 assert _get_open_connections (async_client ) == 0
18691853
@@ -1872,12 +1856,10 @@ async def test_retrying_timeout_errors_doesnt_leak(
18721856 async def test_retrying_status_errors_doesnt_leak (
18731857 self , respx_mock : MockRouter , async_client : AsyncStagehand
18741858 ) -> None :
1875- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (return_value = httpx .Response (500 ))
1859+ respx_mock .post ("/v1/sessions/start " ).mock (return_value = httpx .Response (500 ))
18761860
18771861 with pytest .raises (APIStatusError ):
1878- await async_client .sessions .with_streaming_response .act (
1879- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
1880- ).__aenter__ ()
1862+ await async_client .sessions .with_streaming_response .start (model_name = "gpt-4o" ).__aenter__ ()
18811863 assert _get_open_connections (async_client ) == 0
18821864
18831865 @pytest .mark .parametrize ("failures_before_success" , [0 , 2 , 4 ])
@@ -1904,11 +1886,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
19041886 return httpx .Response (500 )
19051887 return httpx .Response (200 )
19061888
1907- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
1889+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
19081890
1909- response = await client .sessions .with_raw_response .act (
1910- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" , input = "Click the login button"
1911- )
1891+ response = await client .sessions .with_raw_response .start (model_name = "gpt-4o" )
19121892
19131893 assert response .retries_taken == failures_before_success
19141894 assert int (response .http_request .headers .get ("x-stainless-retry-count" )) == failures_before_success
@@ -1930,12 +1910,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
19301910 return httpx .Response (500 )
19311911 return httpx .Response (200 )
19321912
1933- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
1913+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
19341914
1935- response = await client .sessions .with_raw_response .act (
1936- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" ,
1937- input = "Click the login button" ,
1938- extra_headers = {"x-stainless-retry-count" : Omit ()},
1915+ response = await client .sessions .with_raw_response .start (
1916+ model_name = "gpt-4o" , extra_headers = {"x-stainless-retry-count" : Omit ()}
19391917 )
19401918
19411919 assert len (response .http_request .headers .get_list ("x-stainless-retry-count" )) == 0
@@ -1957,12 +1935,10 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
19571935 return httpx .Response (500 )
19581936 return httpx .Response (200 )
19591937
1960- respx_mock .post ("/v1/sessions/c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123/act " ).mock (side_effect = retry_handler )
1938+ respx_mock .post ("/v1/sessions/start " ).mock (side_effect = retry_handler )
19611939
1962- response = await client .sessions .with_raw_response .act (
1963- id = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123" ,
1964- input = "Click the login button" ,
1965- extra_headers = {"x-stainless-retry-count" : "42" },
1940+ response = await client .sessions .with_raw_response .start (
1941+ model_name = "gpt-4o" , extra_headers = {"x-stainless-retry-count" : "42" }
19661942 )
19671943
19681944 assert response .http_request .headers .get ("x-stainless-retry-count" ) == "42"
0 commit comments