cua-agent 0.4.6__py3-none-any.whl → 0.4.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cua-agent might be problematic. Click here for more details.

@@ -8,7 +8,7 @@ from litellm import completion, acompletion
8
8
  # Try to import HuggingFace dependencies
9
9
  try:
10
10
  import torch
11
- from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
11
+ from transformers import AutoModelForImageTextToText, AutoProcessor
12
12
  HF_AVAILABLE = True
13
13
  except ImportError:
14
14
  HF_AVAILABLE = False
@@ -40,7 +40,7 @@ class HuggingFaceLocalAdapter(CustomLLM):
40
40
  """
41
41
  if model_name not in self.models:
42
42
  # Load model
43
- model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
43
+ model = AutoModelForImageTextToText.from_pretrained(
44
44
  model_name,
45
45
  torch_dtype=torch.float16,
46
46
  device_map=self.device,
@@ -141,8 +141,7 @@ class HuggingFaceLocalAdapter(CustomLLM):
141
141
  )
142
142
 
143
143
  # Move inputs to the same device as model
144
- if torch.cuda.is_available() and self.device != "cpu":
145
- inputs = inputs.to("cuda")
144
+ inputs = inputs.to(model.device)
146
145
 
147
146
  # Generate response
148
147
  with torch.no_grad():
agent/agent.py CHANGED
@@ -411,6 +411,9 @@ class ComputerAgent:
411
411
  # Perform computer actions
412
412
  action = item.get("action")
413
413
  action_type = action.get("type")
414
+ if action_type is None:
415
+ print(f"Action type cannot be `None`: action={action}, action_type={action_type}")
416
+ return []
414
417
 
415
418
  # Extract action arguments (all fields except 'type')
416
419
  action_args = {k: v for k, v in action.items() if k != "type"}
agent/ui/gradio/app.py CHANGED
@@ -178,13 +178,20 @@ def create_computer_instance(
178
178
  """Create or get the global Computer instance."""
179
179
  global global_computer
180
180
  if global_computer is None:
181
- global_computer = Computer(
182
- verbosity=verbosity,
183
- os_type=os_type,
184
- provider_type=provider_type,
185
- name=name if name else "",
186
- api_key=api_key
187
- )
181
+ if provider_type == "localhost":
182
+ global_computer = Computer(
183
+ verbosity=verbosity,
184
+ os_type=os_type,
185
+ use_host_computer_server=True
186
+ )
187
+ else:
188
+ global_computer = Computer(
189
+ verbosity=verbosity,
190
+ os_type=os_type,
191
+ provider_type=provider_type,
192
+ name=name if name else "",
193
+ api_key=api_key
194
+ )
188
195
  return global_computer
189
196
 
190
197
 
@@ -211,7 +211,7 @@ if __name__ == "__main__":
211
211
  is_windows = platform.system().lower() == "windows"
212
212
  is_mac = platform.system().lower() == "darwin"
213
213
 
214
- providers = ["cloud"]
214
+ providers = ["cloud", "localhost"]
215
215
  if is_mac:
216
216
  providers += ["lume"]
217
217
  if is_windows:
@@ -403,6 +403,23 @@ if __name__ == "__main__":
403
403
  type="password",
404
404
  )
405
405
 
406
+ # Provider visibility update function
407
+ def update_provider_visibility(provider):
408
+ """Update visibility of container name and API key based on selected provider."""
409
+ is_localhost = provider == "localhost"
410
+ return [
411
+ gr.update(visible=not is_localhost), # container_name
412
+ gr.update(visible=not is_localhost and not has_cua_key) # cua_cloud_api_key
413
+ ]
414
+
415
+ # Connect provider change event
416
+ computer_provider.change(
417
+ fn=update_provider_visibility,
418
+ inputs=[computer_provider],
419
+ outputs=[container_name, cua_cloud_api_key],
420
+ queue=False
421
+ )
422
+
406
423
  # Connect UI update events
407
424
  for dropdown in [agent_loop, omni_model_choice, uitars_model_choice, openai_model_choice, anthropic_model_choice]:
408
425
  dropdown.change(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cua-agent
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: CUA (Computer Use) Agent for AI-driven computer interaction
5
5
  Author-Email: TryCua <gh@trycua.com>
6
6
  Requires-Python: >=3.11
@@ -12,7 +12,7 @@ Requires-Dist: typing-extensions>=4.12.2
12
12
  Requires-Dist: pydantic>=2.6.4
13
13
  Requires-Dist: rich>=13.7.1
14
14
  Requires-Dist: python-dotenv>=1.0.1
15
- Requires-Dist: cua-computer<0.5.0,>=0.3.0
15
+ Requires-Dist: cua-computer<0.5.0,>=0.4.0
16
16
  Requires-Dist: cua-core<0.2.0,>=0.1.8
17
17
  Requires-Dist: certifi>=2024.2.2
18
18
  Requires-Dist: litellm>=1.74.8
@@ -1,8 +1,8 @@
1
1
  agent/__init__.py,sha256=PfRgVa_aJQL9fK0D1g2r__Kdg3627EigNS31_M8Ivkk,1539
2
2
  agent/__main__.py,sha256=lBUe8Niqa5XoCjwFfXyX7GtnUwjjZXC1-j4V9mvUYSc,538
3
3
  agent/adapters/__init__.py,sha256=szM2HMten2WkcqXeRnan__-sXjpyS4eyvIW0LXSfj4U,178
4
- agent/adapters/huggingfacelocal_adapter.py,sha256=dnzzxYCvFiuDdNzsb_1uM-boWv1eS__dWMve_fAnlUc,8038
5
- agent/agent.py,sha256=Vn7ygehx19It5FarZJ2NwVwNTOtNYtD21x8LEBhlWcE,24609
4
+ agent/adapters/huggingfacelocal_adapter.py,sha256=o2IQI1wuZWDYgGPj92dkxTb3uk07XjJdvC19O2_aeak,7963
5
+ agent/agent.py,sha256=bSmc_5Jr4CTvTut8lgNwNpnk9w4sD9SACQb0GbT4zwg,24770
6
6
  agent/callbacks/__init__.py,sha256=yxxBXUqpXQ-jRi_ixJMtmQPxoNRy5Vz1PUBzNNa1Dwg,538
7
7
  agent/callbacks/base.py,sha256=UnnnYlh6XCm6HKZZsAPaT_Eyo9LUYLyjyNwF-QRm6Ns,4691
8
8
  agent/callbacks/budget_manager.py,sha256=RyKM-7iXQcDotYvrw3eURzeEHEXvQjID-NobtvQWE7k,1832
@@ -25,9 +25,9 @@ agent/types.py,sha256=GiLxIcF7s1XIh_WaY7tjdQPFpdTXb5MWVe_ZUPA0gkY,2364
25
25
  agent/ui/__init__.py,sha256=DTZpK85QXscXK2nM9HtpAhVBF13yAamUrtwrQSuV-kM,126
26
26
  agent/ui/__main__.py,sha256=vudWXYvGM0aNT5aZ94HPtGW8YXOZ4cLXepHyhUM_k1g,73
27
27
  agent/ui/gradio/__init__.py,sha256=yv4Mrfo-Sj2U5sVn_UJHAuwYCezo-5O4ItR2C9jzNko,145
28
- agent/ui/gradio/app.py,sha256=X7he4jzyFqWJDP1y_M8yfZvfdy6GHNuclLn4k9iIwAw,8824
29
- agent/ui/gradio/ui_components.py,sha256=WxFE-4wvdEgj7FPLNXUrs118sXJ9vN3kLkZxtto-weo,34474
30
- cua_agent-0.4.6.dist-info/METADATA,sha256=IQ-4ZaFKR0kig2ufns6UNE3ghdaktS0LKY2zchKnP9Q,12060
31
- cua_agent-0.4.6.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
32
- cua_agent-0.4.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
33
- cua_agent-0.4.6.dist-info/RECORD,,
28
+ agent/ui/gradio/app.py,sha256=9UOPwuwspLrnHGY91zdzuRqkMH4cmwOBH-f-BC0gVC4,9077
29
+ agent/ui/gradio/ui_components.py,sha256=hVMGZxAEq1LBHOqKj-RbDXJsj1j0Qw5dOV0ecWIHxmc,35397
30
+ cua_agent-0.4.7.dist-info/METADATA,sha256=wCahxHMvzKL-FkTFy4XlZZirBwl1v-RYWRcYbFcJBDk,12060
31
+ cua_agent-0.4.7.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
32
+ cua_agent-0.4.7.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
33
+ cua_agent-0.4.7.dist-info/RECORD,,