cua-agent 0.1.3__py3-none-any.whl → 0.1.5__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.

agent/__init__.py CHANGED
@@ -1,18 +1,52 @@
1
1
  """CUA (Computer Use) Agent for AI-driven computer interaction."""
2
2
 
3
+ import sys
4
+ import logging
5
+
3
6
  __version__ = "0.1.0"
4
7
 
8
+ # Initialize logging
9
+ logger = logging.getLogger("cua.agent")
10
+
5
11
  # Initialize telemetry when the package is imported
6
12
  try:
7
- from core.telemetry import enable_telemetry, set_dimension
8
-
9
- # Enable telemetry by default
10
- enable_telemetry()
11
- # Set the package version as a dimension
12
- set_dimension("agent_version", __version__)
13
- except ImportError:
14
- # Core telemetry not available
15
- pass
13
+ # Import from core telemetry for basic functions
14
+ from core.telemetry import (
15
+ is_telemetry_enabled,
16
+ flush,
17
+ record_event,
18
+ )
19
+
20
+ # Import set_dimension from our own telemetry module
21
+ from .core.telemetry import set_dimension
22
+
23
+ # Check if telemetry is enabled
24
+ if is_telemetry_enabled():
25
+ logger.info("Telemetry is enabled")
26
+
27
+ # Record package initialization
28
+ record_event(
29
+ "module_init",
30
+ {
31
+ "module": "agent",
32
+ "version": __version__,
33
+ "python_version": sys.version,
34
+ },
35
+ )
36
+
37
+ # Set the package version as a dimension
38
+ set_dimension("agent_version", __version__)
39
+
40
+ # Flush events to ensure they're sent
41
+ flush()
42
+ else:
43
+ logger.info("Telemetry is disabled")
44
+ except ImportError as e:
45
+ # Telemetry not available
46
+ logger.warning(f"Telemetry not available: {e}")
47
+ except Exception as e:
48
+ # Other issues with telemetry
49
+ logger.warning(f"Error initializing telemetry: {e}")
16
50
 
17
51
  from .core.factory import AgentFactory
18
52
  from .core.agent import ComputerAgent
agent/core/agent.py CHANGED
@@ -83,13 +83,6 @@ class ComputerAgent(BaseComputerAgent):
83
83
  # Store telemetry preference
84
84
  self.telemetry_enabled = telemetry_enabled
85
85
 
86
- # Pass telemetry preference to computer if available
87
- if hasattr(computer, "telemetry_enabled"):
88
- # Computer doesn't have a setter for telemetry_enabled
89
- # Use disable_telemetry() method if telemetry is disabled
90
- if not telemetry_enabled and hasattr(computer, "disable_telemetry"):
91
- computer.disable_telemetry()
92
-
93
86
  # Process the model configuration
94
87
  self.model = self._process_model_config(model, loop)
95
88
  self.loop_type = loop
agent/core/telemetry.py CHANGED
@@ -4,8 +4,7 @@ import logging
4
4
  import os
5
5
  import platform
6
6
  import sys
7
- import time
8
- from typing import Dict, Any, Optional
7
+ from typing import Dict, Any
9
8
 
10
9
  # Import the core telemetry module
11
10
  TELEMETRY_AVAILABLE = False
@@ -106,13 +105,6 @@ def enable_telemetry() -> bool:
106
105
  return False
107
106
 
108
107
 
109
- def disable_telemetry() -> None:
110
- """Disable telemetry for this session."""
111
- global TELEMETRY_AVAILABLE
112
- TELEMETRY_AVAILABLE = False
113
- logger.info("Telemetry disabled for this session")
114
-
115
-
116
108
  def is_telemetry_enabled() -> bool:
117
109
  """Check if telemetry is enabled.
118
110
 
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.1
2
+ Name: cua-agent
3
+ Version: 0.1.5
4
+ Summary: CUA (Computer Use) Agent for AI-driven computer interaction
5
+ Author-Email: TryCua <gh@trycua.com>
6
+ Requires-Python: <3.13,>=3.10
7
+ Requires-Dist: httpx<0.29.0,>=0.27.0
8
+ Requires-Dist: aiohttp<4.0.0,>=3.9.3
9
+ Requires-Dist: asyncio
10
+ Requires-Dist: anyio<5.0.0,>=4.4.1
11
+ Requires-Dist: typing-extensions<5.0.0,>=4.12.2
12
+ Requires-Dist: pydantic<3.0.0,>=2.6.4
13
+ Requires-Dist: rich<14.0.0,>=13.7.1
14
+ Requires-Dist: python-dotenv<2.0.0,>=1.0.1
15
+ Requires-Dist: cua-computer<0.2.0,>=0.1.0
16
+ Requires-Dist: cua-core<0.2.0,>=0.1.0
17
+ Requires-Dist: certifi>=2024.2.2
18
+ Provides-Extra: anthropic
19
+ Requires-Dist: anthropic>=0.49.0; extra == "anthropic"
20
+ Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "anthropic"
21
+ Provides-Extra: som
22
+ Requires-Dist: torch>=2.2.1; extra == "som"
23
+ Requires-Dist: torchvision>=0.17.1; extra == "som"
24
+ Requires-Dist: ultralytics>=8.0.0; extra == "som"
25
+ Requires-Dist: transformers>=4.38.2; extra == "som"
26
+ Requires-Dist: cua-som<0.2.0,>=0.1.0; extra == "som"
27
+ Requires-Dist: anthropic<0.47.0,>=0.46.0; extra == "som"
28
+ Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "som"
29
+ Requires-Dist: openai<2.0.0,>=1.14.0; extra == "som"
30
+ Requires-Dist: groq<0.5.0,>=0.4.0; extra == "som"
31
+ Requires-Dist: dashscope<2.0.0,>=1.13.0; extra == "som"
32
+ Requires-Dist: requests<3.0.0,>=2.31.0; extra == "som"
33
+ Provides-Extra: all
34
+ Requires-Dist: torch>=2.2.1; extra == "all"
35
+ Requires-Dist: torchvision>=0.17.1; extra == "all"
36
+ Requires-Dist: ultralytics>=8.0.0; extra == "all"
37
+ Requires-Dist: transformers>=4.38.2; extra == "all"
38
+ Requires-Dist: cua-som<0.2.0,>=0.1.0; extra == "all"
39
+ Requires-Dist: anthropic<0.47.0,>=0.46.0; extra == "all"
40
+ Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "all"
41
+ Requires-Dist: openai<2.0.0,>=1.14.0; extra == "all"
42
+ Requires-Dist: groq<0.5.0,>=0.4.0; extra == "all"
43
+ Requires-Dist: dashscope<2.0.0,>=1.13.0; extra == "all"
44
+ Requires-Dist: requests<3.0.0,>=2.31.0; extra == "all"
45
+ Description-Content-Type: text/markdown
46
+
47
+ <div align="center">
48
+ <h1>
49
+ <div class="image-wrapper" style="display: inline-block;">
50
+ <picture>
51
+ <source media="(prefers-color-scheme: dark)" alt="logo" height="150" srcset="../../img/logo_white.png" style="display: block; margin: auto;">
52
+ <source media="(prefers-color-scheme: light)" alt="logo" height="150" srcset="../../img/logo_black.png" style="display: block; margin: auto;">
53
+ <img alt="Shows my svg">
54
+ </picture>
55
+ </div>
56
+
57
+ [![Python](https://img.shields.io/badge/Python-333333?logo=python&logoColor=white&labelColor=333333)](#)
58
+ [![macOS](https://img.shields.io/badge/macOS-000000?logo=apple&logoColor=F0F0F0)](#)
59
+ [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?&logo=discord&logoColor=white)](https://discord.com/invite/mVnXXpdE85)
60
+ [![PyPI](https://img.shields.io/pypi/v/cua-computer?color=333333)](https://pypi.org/project/cua-computer/)
61
+ </h1>
62
+ </div>
63
+
64
+ **Agent** is a Computer Use (CUA) framework for running multi-app agentic workflows targeting macOS and Linux sandbox, supporting local (Ollama) and cloud model providers (OpenAI, Anthropic, Groq, DeepSeek, Qwen). The framework integrates with Microsoft's OmniParser for enhanced UI understanding and interaction.
65
+
66
+ ### Get started with Agent
67
+
68
+ ```python
69
+ from agent import ComputerAgent, AgentLoop, LLMProvider
70
+ from computer import Computer
71
+
72
+ computer = Computer(verbosity=logging.INFO)
73
+
74
+ agent = ComputerAgent(
75
+ computer=computer,
76
+ loop=AgentLoop.ANTHROPIC,
77
+ # loop=AgentLoop.OMNI,
78
+ model=LLM(provider=LLMProvider.ANTHROPIC, name="claude-3-7-sonnet-20250219"),
79
+ # model=LLM(provider=LLMProvider.OPENAI, name="gpt-4.5-preview"),
80
+ save_trajectory=True,
81
+ trajectory_dir=str(Path("trajectories")),
82
+ only_n_most_recent_images=3,
83
+ verbosity=logging.INFO,
84
+ )
85
+
86
+ tasks = [
87
+ """
88
+ Please help me with the following task:
89
+ 1. Open Safari browser
90
+ 2. Go to Wikipedia.org
91
+ 3. Search for "Claude AI"
92
+ 4. Summarize the main points you find about Claude AI
93
+ """
94
+ ]
95
+
96
+ async with agent:
97
+ for i, task in enumerate(tasks, 1):
98
+ print(f"\nExecuting task {i}/{len(tasks)}: {task}")
99
+ async for result in agent.run(task):
100
+ print(result)
101
+ print(f"Task {i} completed")
102
+ ```
103
+
104
+ ## Install
105
+
106
+ ### cua-agent
107
+
108
+ ```bash
109
+ pip install "cua-agent[all]"
110
+
111
+ # or install specific loop providers
112
+ pip install "cua-agent[anthropic]"
113
+ pip install "cua-agent[omni]"
114
+ ```
115
+
116
+ ## Run
117
+
118
+ Refer to these notebooks for step-by-step guides on how to use the Computer-Use Agent (CUA):
119
+
120
+ - [Agent Notebook](../../notebooks/agent_nb.ipynb) - Complete examples and workflows
@@ -1,8 +1,8 @@
1
1
  agent/README.md,sha256=8EFnLrKejthEcL9bZflQSbvA-KwpiPanBz8TEEwRub8,2153
2
- agent/__init__.py,sha256=iX9e3iSpdUtqZAK9smiqwo3OcipR2v5rlXQyDiXXVxQ,691
2
+ agent/__init__.py,sha256=sxUp_I8cI4NVa2DY8g-tsJe5_XJJe5VdeS_VLgA98EM,1569
3
3
  agent/core/README.md,sha256=VOXNVbR0ugxf9gCXYmZtUU2kngZhfi29haT_oSxK0Lk,3559
4
4
  agent/core/__init__.py,sha256=0htZ-VfsH9ixHB8j_SXu_uv6r3XXsq5TrghFNd-yRNE,709
5
- agent/core/agent.py,sha256=MN_A5gVS_E_1e9UFdRR8iKeR2xMfbbIL-9xK6w7GNwo,9703
5
+ agent/core/agent.py,sha256=A07a7mRtKqpX2AHCP1i8KesOqoOETfh23CyTTQth6vI,9327
6
6
  agent/core/base_agent.py,sha256=te9rk2tJZpEhDUEB1xSaFqe1zeOjmzMdHF5LaUDP2K0,6276
7
7
  agent/core/callbacks.py,sha256=VbGIf5QkHh3Q0KsLM6wv7hRdIA5WExTVYLm64bckyUA,4306
8
8
  agent/core/computer_agent.py,sha256=JGLMl_PwImUttmQh2amdLlXHS9CUyZ9MW20J1Xid7dM,2417
@@ -10,7 +10,7 @@ agent/core/experiment.py,sha256=FKmSDyA2YFSrO3q-91ZT29Jm1lm24YCuK59wQ6z-6IM,7930
10
10
  agent/core/factory.py,sha256=WraOEHWPXBSN4R3DO7M2ctyadodeA8tzHM3dUjdQ_3A,3441
11
11
  agent/core/loop.py,sha256=vhdlSy_hIY3-a92uTGdF3oYE5Qcq0U2hyTJNmXunnfc,9009
12
12
  agent/core/messages.py,sha256=N8pV8Eh-AJpMuDPRI5OGWUIOU6DRr-pQjK9XU0go9Hk,7637
13
- agent/core/telemetry.py,sha256=bOP3z74dpXwvn1bGCVxe67jwu1m-4nYmKlypAJovqCQ,4304
13
+ agent/core/telemetry.py,sha256=cCnITdDxOSHM0qKV7Fe5sV2gD6B_InRxMVFm-EgKF7M,4083
14
14
  agent/core/tools/__init__.py,sha256=xZen-PqUp2dUaMEHJowXCQm33_5Sxhsx9PSoD0rq6tI,489
15
15
  agent/core/tools/base.py,sha256=CdzRFNuOjNfzgyTUN4ZoCGkUDR5HI0ECQVpvrUdEij8,2295
16
16
  agent/core/tools/bash.py,sha256=jnJKVlHn8np8e0gWd8EO0_qqjMkfQzutSugA_Iol4jE,1585
@@ -61,7 +61,7 @@ agent/types/__init__.py,sha256=61UFJT-w0CT4YRn0LiTx4A7fsMdVQjlXO9vnmbI1A7Y,604
61
61
  agent/types/base.py,sha256=Iy_Q2DIBMLtwWdLyfvHw_6E2ltYu3bIv8GUNy3LYkGs,1133
62
62
  agent/types/messages.py,sha256=4-hwtxeAhto90_EZpHFducddtsHUsHauvXzYrpKG4RE,953
63
63
  agent/types/tools.py,sha256=Jes2CFCFqC727WWHbO-sG7V03rBHnQe5X7Oi9ZkuScI,877
64
- cua_agent-0.1.3.dist-info/METADATA,sha256=jrj3DGxV6UHOSezXqLY2BhjmZxI1Eunv9aFXcoUQmgs,1928
65
- cua_agent-0.1.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
66
- cua_agent-0.1.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
67
- cua_agent-0.1.3.dist-info/RECORD,,
64
+ cua_agent-0.1.5.dist-info/METADATA,sha256=yyoO57p8w39kdnzJY1bT6YelaaZRxzokxQUNMFyJQZY,4528
65
+ cua_agent-0.1.5.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
66
+ cua_agent-0.1.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
67
+ cua_agent-0.1.5.dist-info/RECORD,,
@@ -1,45 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cua-agent
3
- Version: 0.1.3
4
- Summary: CUA (Computer Use) Agent for AI-driven computer interaction
5
- Author-Email: TryCua <gh@trycua.com>
6
- Requires-Python: <3.13,>=3.10
7
- Requires-Dist: httpx<0.29.0,>=0.27.0
8
- Requires-Dist: aiohttp<4.0.0,>=3.9.3
9
- Requires-Dist: asyncio
10
- Requires-Dist: anyio<5.0.0,>=4.4.1
11
- Requires-Dist: typing-extensions<5.0.0,>=4.12.2
12
- Requires-Dist: pydantic<3.0.0,>=2.6.4
13
- Requires-Dist: rich<14.0.0,>=13.7.1
14
- Requires-Dist: python-dotenv<2.0.0,>=1.0.1
15
- Requires-Dist: cua-computer<0.2.0,>=0.1.0
16
- Requires-Dist: cua-core<0.2.0,>=0.1.0
17
- Requires-Dist: certifi>=2024.2.2
18
- Provides-Extra: anthropic
19
- Requires-Dist: anthropic>=0.49.0; extra == "anthropic"
20
- Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "anthropic"
21
- Provides-Extra: som
22
- Requires-Dist: torch>=2.2.1; extra == "som"
23
- Requires-Dist: torchvision>=0.17.1; extra == "som"
24
- Requires-Dist: ultralytics>=8.0.0; extra == "som"
25
- Requires-Dist: transformers>=4.38.2; extra == "som"
26
- Requires-Dist: cua-som<0.2.0,>=0.1.0; extra == "som"
27
- Requires-Dist: anthropic<0.47.0,>=0.46.0; extra == "som"
28
- Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "som"
29
- Requires-Dist: openai<2.0.0,>=1.14.0; extra == "som"
30
- Requires-Dist: groq<0.5.0,>=0.4.0; extra == "som"
31
- Requires-Dist: dashscope<2.0.0,>=1.13.0; extra == "som"
32
- Requires-Dist: requests<3.0.0,>=2.31.0; extra == "som"
33
- Provides-Extra: all
34
- Requires-Dist: torch>=2.2.1; extra == "all"
35
- Requires-Dist: torchvision>=0.17.1; extra == "all"
36
- Requires-Dist: ultralytics>=8.0.0; extra == "all"
37
- Requires-Dist: transformers>=4.38.2; extra == "all"
38
- Requires-Dist: cua-som<0.2.0,>=0.1.0; extra == "all"
39
- Requires-Dist: anthropic<0.47.0,>=0.46.0; extra == "all"
40
- Requires-Dist: boto3<2.0.0,>=1.35.81; extra == "all"
41
- Requires-Dist: openai<2.0.0,>=1.14.0; extra == "all"
42
- Requires-Dist: groq<0.5.0,>=0.4.0; extra == "all"
43
- Requires-Dist: dashscope<2.0.0,>=1.13.0; extra == "all"
44
- Requires-Dist: requests<3.0.0,>=2.31.0; extra == "all"
45
-