cua-agent 0.4.13__py3-none-any.whl → 0.4.15__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 +0 -9
- agent/callbacks/telemetry.py +8 -9
- agent/loops/uitars.py +9 -1
- agent/ui/gradio/app.py +2 -2
- agent/ui/gradio/ui_components.py +2 -2
- {cua_agent-0.4.13.dist-info → cua_agent-0.4.15.dist-info}/METADATA +3 -3
- {cua_agent-0.4.13.dist-info → cua_agent-0.4.15.dist-info}/RECORD +9 -10
- agent/telemetry.py +0 -142
- {cua_agent-0.4.13.dist-info → cua_agent-0.4.15.dist-info}/WHEEL +0 -0
- {cua_agent-0.4.13.dist-info → cua_agent-0.4.15.dist-info}/entry_points.txt +0 -0
agent/__init__.py
CHANGED
|
@@ -28,13 +28,9 @@ try:
|
|
|
28
28
|
# Import from core telemetry for basic functions
|
|
29
29
|
from core.telemetry import (
|
|
30
30
|
is_telemetry_enabled,
|
|
31
|
-
flush,
|
|
32
31
|
record_event,
|
|
33
32
|
)
|
|
34
33
|
|
|
35
|
-
# Import set_dimension from our own telemetry module
|
|
36
|
-
from .telemetry import set_dimension
|
|
37
|
-
|
|
38
34
|
# Check if telemetry is enabled
|
|
39
35
|
if is_telemetry_enabled():
|
|
40
36
|
logger.info("Telemetry is enabled")
|
|
@@ -49,11 +45,6 @@ try:
|
|
|
49
45
|
},
|
|
50
46
|
)
|
|
51
47
|
|
|
52
|
-
# Set the package version as a dimension
|
|
53
|
-
set_dimension("agent_version", __version__)
|
|
54
|
-
|
|
55
|
-
# Flush events to ensure they're sent
|
|
56
|
-
flush()
|
|
57
48
|
else:
|
|
58
49
|
logger.info("Telemetry is disabled")
|
|
59
50
|
except ImportError as e:
|
agent/callbacks/telemetry.py
CHANGED
|
@@ -7,13 +7,18 @@ import uuid
|
|
|
7
7
|
from typing import List, Dict, Any, Optional, Union
|
|
8
8
|
|
|
9
9
|
from .base import AsyncCallbackHandler
|
|
10
|
-
from
|
|
10
|
+
from core.telemetry import (
|
|
11
11
|
record_event,
|
|
12
12
|
is_telemetry_enabled,
|
|
13
|
-
set_dimension,
|
|
14
|
-
SYSTEM_INFO,
|
|
15
13
|
)
|
|
16
14
|
|
|
15
|
+
import platform
|
|
16
|
+
|
|
17
|
+
SYSTEM_INFO = {
|
|
18
|
+
"os": platform.system().lower(),
|
|
19
|
+
"os_version": platform.release(),
|
|
20
|
+
"python_version": platform.python_version(),
|
|
21
|
+
}
|
|
17
22
|
|
|
18
23
|
class TelemetryCallback(AsyncCallbackHandler):
|
|
19
24
|
"""
|
|
@@ -65,11 +70,6 @@ class TelemetryCallback(AsyncCallbackHandler):
|
|
|
65
70
|
**SYSTEM_INFO
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
# Set session-level dimensions
|
|
69
|
-
set_dimension("session_id", self.session_id)
|
|
70
|
-
set_dimension("agent_type", agent_info["agent_type"])
|
|
71
|
-
set_dimension("model", agent_info["model"])
|
|
72
|
-
|
|
73
73
|
record_event("agent_session_start", agent_info)
|
|
74
74
|
|
|
75
75
|
async def on_run_start(self, kwargs: Dict[str, Any], old_items: List[Dict[str, Any]]) -> None:
|
|
@@ -98,7 +98,6 @@ class TelemetryCallback(AsyncCallbackHandler):
|
|
|
98
98
|
if trajectory:
|
|
99
99
|
run_data["uploaded_trajectory"] = trajectory
|
|
100
100
|
|
|
101
|
-
set_dimension("run_id", self.run_id)
|
|
102
101
|
record_event("agent_run_start", run_data)
|
|
103
102
|
|
|
104
103
|
async def on_run_end(self, kwargs: Dict[str, Any], old_items: List[Dict[str, Any]], new_items: List[Dict[str, Any]]) -> None:
|
agent/loops/uitars.py
CHANGED
|
@@ -782,11 +782,19 @@ class UITARSConfig:
|
|
|
782
782
|
# Extract response content
|
|
783
783
|
response_content = response.choices[0].message.content.strip() # type: ignore
|
|
784
784
|
|
|
785
|
+
print(response_content)
|
|
786
|
+
|
|
785
787
|
# Parse the response to extract click coordinates
|
|
786
|
-
# Look for click action with coordinates
|
|
788
|
+
# Look for click action with coordinates (with special tokens)
|
|
787
789
|
click_pattern = r"click\(point='<\|box_start\|>\((\d+),(\d+)\)<\|box_end\|>'\)"
|
|
788
790
|
match = re.search(click_pattern, response_content)
|
|
789
791
|
|
|
792
|
+
# Fallback: Look for simpler format without special tokens
|
|
793
|
+
if not match:
|
|
794
|
+
# Pattern for: click(start_box='(x,y)') or click(point='(x,y)')
|
|
795
|
+
fallback_pattern = r"click\((?:start_box|point)='\((\d+),(\d+)\)'\)"
|
|
796
|
+
match = re.search(fallback_pattern, response_content)
|
|
797
|
+
|
|
790
798
|
if match:
|
|
791
799
|
x, y = int(match.group(1)), int(match.group(2))
|
|
792
800
|
# Scale coordinates back to original image dimensions
|
agent/ui/gradio/app.py
CHANGED
|
@@ -114,14 +114,14 @@ MODEL_MAPPINGS = {
|
|
|
114
114
|
"Anthropic: Claude 4 Opus (20250514)": "anthropic/claude-opus-4-20250514",
|
|
115
115
|
"Anthropic: Claude 4 Sonnet (20250514)": "anthropic/claude-sonnet-4-20250514",
|
|
116
116
|
"Anthropic: Claude 3.7 Sonnet (20250219)": "anthropic/claude-3-7-sonnet-20250219",
|
|
117
|
-
"Anthropic: Claude 3.5 Sonnet (
|
|
117
|
+
"Anthropic: Claude 3.5 Sonnet (20241022)": "anthropic/claude-3-5-sonnet-20241022",
|
|
118
118
|
},
|
|
119
119
|
"omni": {
|
|
120
120
|
"default": "omniparser+openai/gpt-4o",
|
|
121
121
|
"OMNI: OpenAI GPT-4o": "omniparser+openai/gpt-4o",
|
|
122
122
|
"OMNI: OpenAI GPT-4o mini": "omniparser+openai/gpt-4o-mini",
|
|
123
123
|
"OMNI: Claude 3.7 Sonnet (20250219)": "omniparser+anthropic/claude-3-7-sonnet-20250219",
|
|
124
|
-
"OMNI: Claude 3.5 Sonnet (
|
|
124
|
+
"OMNI: Claude 3.5 Sonnet (20241022)": "omniparser+anthropic/claude-3-5-sonnet-20241022",
|
|
125
125
|
},
|
|
126
126
|
"uitars": {
|
|
127
127
|
"default": "huggingface-local/ByteDance-Seed/UI-TARS-1.5-7B" if is_mac else "ui-tars",
|
agent/ui/gradio/ui_components.py
CHANGED
|
@@ -38,13 +38,13 @@ def create_gradio_ui() -> gr.Blocks:
|
|
|
38
38
|
"Anthropic: Claude 4 Opus (20250514)",
|
|
39
39
|
"Anthropic: Claude 4 Sonnet (20250514)",
|
|
40
40
|
"Anthropic: Claude 3.7 Sonnet (20250219)",
|
|
41
|
-
"Anthropic: Claude 3.5 Sonnet (
|
|
41
|
+
"Anthropic: Claude 3.5 Sonnet (20241022)",
|
|
42
42
|
]
|
|
43
43
|
omni_models = [
|
|
44
44
|
"OMNI: OpenAI GPT-4o",
|
|
45
45
|
"OMNI: OpenAI GPT-4o mini",
|
|
46
46
|
"OMNI: Claude 3.7 Sonnet (20250219)",
|
|
47
|
-
"OMNI: Claude 3.5 Sonnet (
|
|
47
|
+
"OMNI: Claude 3.5 Sonnet (20241022)"
|
|
48
48
|
]
|
|
49
49
|
|
|
50
50
|
# Check if API keys are available
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cua-agent
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.15
|
|
4
4
|
Summary: CUA (Computer Use) Agent for AI-driven computer interaction
|
|
5
5
|
Author-Email: TryCua <gh@trycua.com>
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
7
|
Requires-Dist: httpx>=0.27.0
|
|
8
8
|
Requires-Dist: aiohttp>=3.9.3
|
|
9
9
|
Requires-Dist: asyncio
|
|
@@ -138,7 +138,7 @@ if __name__ == "__main__":
|
|
|
138
138
|
### Anthropic Claude (Computer Use API)
|
|
139
139
|
```python
|
|
140
140
|
model="anthropic/claude-3-5-sonnet-20241022"
|
|
141
|
-
model="anthropic/claude-3-
|
|
141
|
+
model="anthropic/claude-3-7-sonnet-20250219"
|
|
142
142
|
model="anthropic/claude-opus-4-20250514"
|
|
143
143
|
model="anthropic/claude-sonnet-4-20250514"
|
|
144
144
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
agent/__init__.py,sha256=
|
|
1
|
+
agent/__init__.py,sha256=MaW-BczJ-lCACPYH39DvFhE7ZWiSo7sBO6pBfyO7Nxc,1269
|
|
2
2
|
agent/__main__.py,sha256=lBUe8Niqa5XoCjwFfXyX7GtnUwjjZXC1-j4V9mvUYSc,538
|
|
3
3
|
agent/adapters/__init__.py,sha256=lNH6srgIMmZOI7dgicJs3LCk_1MeqLF0lou9n7b23Ts,238
|
|
4
4
|
agent/adapters/huggingfacelocal_adapter.py,sha256=Uqjtcohhzd33VFh38Ra2y4Uv_lTghMswoqS1t-KKFkw,8480
|
|
@@ -10,7 +10,7 @@ agent/callbacks/budget_manager.py,sha256=RyKM-7iXQcDotYvrw3eURzeEHEXvQjID-NobtvQ
|
|
|
10
10
|
agent/callbacks/image_retention.py,sha256=tiuRT5ke9xXTb2eP8Gz-2ITyAMY29LURUH6AbjX3RP8,6165
|
|
11
11
|
agent/callbacks/logging.py,sha256=OOxU97EzrxlnUAtiEnvy9FB7SwCUK90-rdpDFA2Ae4E,10921
|
|
12
12
|
agent/callbacks/pii_anonymization.py,sha256=NEkUTUjQBi82nqus7kT-1E4RaeQ2hQrY7YCnKndLhP8,3272
|
|
13
|
-
agent/callbacks/telemetry.py,sha256=
|
|
13
|
+
agent/callbacks/telemetry.py,sha256=RbUDhE41mTi8g9hNre0EpltK_NUZkLj8buJLWBzs0Ek,7363
|
|
14
14
|
agent/callbacks/trajectory_saver.py,sha256=VHbiDQzI_XludkWhZIVqIMrsxgwKfFWwVtqaRot_D4U,12231
|
|
15
15
|
agent/cli.py,sha256=AgaXwywHd3nGQWuqMRj6SbPyFaCPjfo5980Y1ApQOTQ,12413
|
|
16
16
|
agent/computers/__init__.py,sha256=39ISJsaREaQIZckpzxSuLhuR763wUU3TxUux78EKjAg,1477
|
|
@@ -35,16 +35,15 @@ agent/loops/gta1.py,sha256=ha5TaUWqUzTffx_ow1WiBU8i3VNP-6FL5XC66ajPFjg,5829
|
|
|
35
35
|
agent/loops/model_types.csv,sha256=GmFn4x80yoUpQZuQ-GXtJkPVlOLYWZ5u_5A73HRyeNE,112
|
|
36
36
|
agent/loops/omniparser.py,sha256=-db8JUL2Orn47ERIaLbuNShAXn4LeIgYzRWphn_9Dg4,15071
|
|
37
37
|
agent/loops/openai.py,sha256=8Ad_XufpENmLq1nEnhzF3oswPrPK1EPz-C5NU8UOEs0,8035
|
|
38
|
-
agent/loops/uitars.py,sha256=
|
|
38
|
+
agent/loops/uitars.py,sha256=PVNOdwcn2K6RgaxoU-9I4HjBTsEH073M11LTqTrN7C4,31849
|
|
39
39
|
agent/responses.py,sha256=TTJ3wXN_eb0J26GKhO3cVQngOiZ1AgUPIUadozLUQyE,28991
|
|
40
|
-
agent/telemetry.py,sha256=87ZTyBaT0wEPQn4v76II3g0V3GERuIVbypoX-Ug6FKQ,4786
|
|
41
40
|
agent/types.py,sha256=ZoWY8a3GZtB8V0SnOzoI7DQy4nP_GRubxJKbuLPOc8c,840
|
|
42
41
|
agent/ui/__init__.py,sha256=DTZpK85QXscXK2nM9HtpAhVBF13yAamUrtwrQSuV-kM,126
|
|
43
42
|
agent/ui/__main__.py,sha256=vudWXYvGM0aNT5aZ94HPtGW8YXOZ4cLXepHyhUM_k1g,73
|
|
44
43
|
agent/ui/gradio/__init__.py,sha256=yv4Mrfo-Sj2U5sVn_UJHAuwYCezo-5O4ItR2C9jzNko,145
|
|
45
|
-
agent/ui/gradio/app.py,sha256=
|
|
46
|
-
agent/ui/gradio/ui_components.py,sha256=
|
|
47
|
-
cua_agent-0.4.
|
|
48
|
-
cua_agent-0.4.
|
|
49
|
-
cua_agent-0.4.
|
|
50
|
-
cua_agent-0.4.
|
|
44
|
+
agent/ui/gradio/app.py,sha256=Ol97YEbwREZZQ9_PMjVHlfOcu9BGsawxgAGAm79hT80,9117
|
|
45
|
+
agent/ui/gradio/ui_components.py,sha256=dJUvKDmc1oSejtoR_gU_oWWYwxaOOQyPloSYRGMrUCQ,36068
|
|
46
|
+
cua_agent-0.4.15.dist-info/METADATA,sha256=NZ_ccvhA-BeLMnCajZAfVhzXvttSRHYfTdJlezFCks8,12616
|
|
47
|
+
cua_agent-0.4.15.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
|
|
48
|
+
cua_agent-0.4.15.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
49
|
+
cua_agent-0.4.15.dist-info/RECORD,,
|
agent/telemetry.py
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"""Agent telemetry for tracking anonymous usage and feature usage."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
import os
|
|
5
|
-
import platform
|
|
6
|
-
import sys
|
|
7
|
-
from typing import Dict, Any, Callable
|
|
8
|
-
|
|
9
|
-
# Import the core telemetry module
|
|
10
|
-
TELEMETRY_AVAILABLE = False
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Local fallbacks in case core telemetry isn't available
|
|
14
|
-
def _noop(*args: Any, **kwargs: Any) -> None:
|
|
15
|
-
"""No-op function for when telemetry is not available."""
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# Define default functions with unique names to avoid shadowing
|
|
20
|
-
_default_record_event = _noop
|
|
21
|
-
_default_increment_counter = _noop
|
|
22
|
-
_default_set_dimension = _noop
|
|
23
|
-
_default_get_telemetry_client = lambda: None
|
|
24
|
-
_default_flush = _noop
|
|
25
|
-
_default_is_telemetry_enabled = lambda: False
|
|
26
|
-
_default_is_telemetry_globally_disabled = lambda: True
|
|
27
|
-
|
|
28
|
-
# Set the actual functions to the defaults initially
|
|
29
|
-
record_event = _default_record_event
|
|
30
|
-
increment_counter = _default_increment_counter
|
|
31
|
-
set_dimension = _default_set_dimension
|
|
32
|
-
get_telemetry_client = _default_get_telemetry_client
|
|
33
|
-
flush = _default_flush
|
|
34
|
-
is_telemetry_enabled = _default_is_telemetry_enabled
|
|
35
|
-
is_telemetry_globally_disabled = _default_is_telemetry_globally_disabled
|
|
36
|
-
|
|
37
|
-
logger = logging.getLogger("agent.telemetry")
|
|
38
|
-
|
|
39
|
-
try:
|
|
40
|
-
# Import from core telemetry
|
|
41
|
-
from core.telemetry import (
|
|
42
|
-
record_event as core_record_event,
|
|
43
|
-
increment as core_increment,
|
|
44
|
-
get_telemetry_client as core_get_telemetry_client,
|
|
45
|
-
flush as core_flush,
|
|
46
|
-
is_telemetry_enabled as core_is_telemetry_enabled,
|
|
47
|
-
is_telemetry_globally_disabled as core_is_telemetry_globally_disabled,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
# Override the default functions with actual implementations
|
|
51
|
-
record_event = core_record_event
|
|
52
|
-
get_telemetry_client = core_get_telemetry_client
|
|
53
|
-
flush = core_flush
|
|
54
|
-
is_telemetry_enabled = core_is_telemetry_enabled
|
|
55
|
-
is_telemetry_globally_disabled = core_is_telemetry_globally_disabled
|
|
56
|
-
|
|
57
|
-
def increment_counter(counter_name: str, value: int = 1) -> None:
|
|
58
|
-
"""Wrapper for increment to maintain backward compatibility."""
|
|
59
|
-
if is_telemetry_enabled():
|
|
60
|
-
core_increment(counter_name, value)
|
|
61
|
-
|
|
62
|
-
def set_dimension(name: str, value: Any) -> None:
|
|
63
|
-
"""Set a dimension that will be attached to all events."""
|
|
64
|
-
logger.debug(f"Setting dimension {name}={value}")
|
|
65
|
-
|
|
66
|
-
TELEMETRY_AVAILABLE = True
|
|
67
|
-
logger.info("Successfully imported telemetry")
|
|
68
|
-
except ImportError as e:
|
|
69
|
-
logger.warning(f"Could not import telemetry: {e}")
|
|
70
|
-
logger.debug("Telemetry not available, using no-op functions")
|
|
71
|
-
|
|
72
|
-
# Get system info once to use in telemetry
|
|
73
|
-
SYSTEM_INFO = {
|
|
74
|
-
"os": platform.system().lower(),
|
|
75
|
-
"os_version": platform.release(),
|
|
76
|
-
"python_version": platform.python_version(),
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def enable_telemetry() -> bool:
|
|
81
|
-
"""Enable telemetry if available.
|
|
82
|
-
|
|
83
|
-
Returns:
|
|
84
|
-
bool: True if telemetry was successfully enabled, False otherwise
|
|
85
|
-
"""
|
|
86
|
-
global TELEMETRY_AVAILABLE, record_event, increment_counter, get_telemetry_client, flush, is_telemetry_enabled, is_telemetry_globally_disabled
|
|
87
|
-
|
|
88
|
-
# Check if globally disabled using core function
|
|
89
|
-
if TELEMETRY_AVAILABLE and is_telemetry_globally_disabled():
|
|
90
|
-
logger.info("Telemetry is globally disabled via environment variable - cannot enable")
|
|
91
|
-
return False
|
|
92
|
-
|
|
93
|
-
# Already enabled
|
|
94
|
-
if TELEMETRY_AVAILABLE:
|
|
95
|
-
return True
|
|
96
|
-
|
|
97
|
-
# Try to import and enable
|
|
98
|
-
try:
|
|
99
|
-
from core.telemetry import (
|
|
100
|
-
record_event,
|
|
101
|
-
increment,
|
|
102
|
-
get_telemetry_client,
|
|
103
|
-
flush,
|
|
104
|
-
is_telemetry_globally_disabled,
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
# Check again after import
|
|
108
|
-
if is_telemetry_globally_disabled():
|
|
109
|
-
logger.info("Telemetry is globally disabled via environment variable - cannot enable")
|
|
110
|
-
return False
|
|
111
|
-
|
|
112
|
-
TELEMETRY_AVAILABLE = True
|
|
113
|
-
logger.info("Telemetry successfully enabled")
|
|
114
|
-
return True
|
|
115
|
-
except ImportError as e:
|
|
116
|
-
logger.warning(f"Could not enable telemetry: {e}")
|
|
117
|
-
return False
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def is_telemetry_enabled() -> bool:
|
|
121
|
-
"""Check if telemetry is enabled.
|
|
122
|
-
|
|
123
|
-
Returns:
|
|
124
|
-
bool: True if telemetry is enabled, False otherwise
|
|
125
|
-
"""
|
|
126
|
-
# Use the core function if available, otherwise use our local flag
|
|
127
|
-
if TELEMETRY_AVAILABLE:
|
|
128
|
-
from core.telemetry import is_telemetry_enabled as core_is_enabled
|
|
129
|
-
|
|
130
|
-
return core_is_enabled()
|
|
131
|
-
return False
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
def record_agent_initialization() -> None:
|
|
135
|
-
"""Record when an agent instance is initialized."""
|
|
136
|
-
if TELEMETRY_AVAILABLE and is_telemetry_enabled():
|
|
137
|
-
record_event("agent_initialized", SYSTEM_INFO)
|
|
138
|
-
|
|
139
|
-
# Set dimensions that will be attached to all events
|
|
140
|
-
set_dimension("os", SYSTEM_INFO["os"])
|
|
141
|
-
set_dimension("os_version", SYSTEM_INFO["os_version"])
|
|
142
|
-
set_dimension("python_version", SYSTEM_INFO["python_version"])
|
|
File without changes
|
|
File without changes
|