@@ -110,8 +110,71 @@ def test_windows() -> None:
110110 assert response .output .combined_valuation is not None
111111 windows_instance .stop ()
112112
113+ def test_ubuntu_thinking () -> None :
114+ _check_api_key ()
115+ client = Scrapybara ()
116+
117+ ubuntu_instance = client .start_ubuntu ()
118+ print (ubuntu_instance .get_stream_url ().stream_url )
119+ assert ubuntu_instance .id is not None
120+ instances = client .get_instances ()
121+ assert len (instances ) > 0
122+ screenshot_response = ubuntu_instance .screenshot ()
123+ assert screenshot_response .base_64_image is not None
124+ ubuntu_instance .browser .start ()
125+ cdp_url = ubuntu_instance .browser .get_cdp_url ()
126+ assert cdp_url is not None
127+ response = client .act (
128+ model = Anthropic (name = "claude-3-7-sonnet-20250219-thinking" ),
129+ system = UBUNTU_SYSTEM_PROMPT ,
130+ prompt = "Go to the YC website and get the number of funded startups and combined valuation" ,
131+ tools = [
132+ ComputerTool (ubuntu_instance ),
133+ BashTool (ubuntu_instance ),
134+ EditTool (ubuntu_instance ),
135+ ],
136+ schema = YCStats ,
137+ on_step = lambda step : print (step .text , step .tool_calls , step .reasoning_parts ),
138+ )
139+ print (response .output )
140+ assert response .output is not None
141+ assert response .output .number_of_startups is not None
142+ assert response .output .combined_valuation is not None
143+ ubuntu_instance .browser .stop ()
144+ ubuntu_instance .stop ()
145+
146+
147+ def test_browser_thinking () -> None :
148+ _check_api_key ()
149+ client = Scrapybara ()
150+
151+ browser_instance = client .start_browser ()
152+ print (browser_instance .get_stream_url ().stream_url )
153+ assert browser_instance .id is not None
154+ screenshot_response = browser_instance .screenshot ()
155+ assert screenshot_response .base_64_image is not None
156+ cdp_url = browser_instance .get_cdp_url ()
157+ assert cdp_url is not None
158+ response = client .act (
159+ model = Anthropic (name = "claude-3-7-sonnet-20250219-thinking" ),
160+ system = BROWSER_SYSTEM_PROMPT ,
161+ prompt = "Go to the YC website and get the number of funded startups and combined valuation" ,
162+ tools = [
163+ ComputerTool (browser_instance ),
164+ ],
165+ schema = YCStats ,
166+ on_step = lambda step : print (step .text , step .tool_calls , step .reasoning_parts ),
167+ )
168+ print (response .output )
169+ assert response .output is not None
170+ assert response .output .number_of_startups is not None
171+ assert response .output .combined_valuation is not None
172+ browser_instance .stop ()
173+
113174
114175if __name__ == "__main__" :
115176 test_ubuntu ()
116177 test_browser ()
178+ test_ubuntu_thinking ()
179+ test_browser_thinking ()
117180 # test_windows()
0 commit comments