cua-agent 0.2.4__py3-none-any.whl → 0.2.6__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/core/tools.py +2 -2
- agent/core/types.py +7 -7
- agent/providers/anthropic/prompts.py +4 -1
- agent/ui/gradio/app.py +24 -8
- {cua_agent-0.2.4.dist-info → cua_agent-0.2.6.dist-info}/METADATA +2 -2
- {cua_agent-0.2.4.dist-info → cua_agent-0.2.6.dist-info}/RECORD +8 -8
- {cua_agent-0.2.4.dist-info → cua_agent-0.2.6.dist-info}/WHEEL +0 -0
- {cua_agent-0.2.4.dist-info → cua_agent-0.2.6.dist-info}/entry_points.txt +0 -0
agent/core/tools.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Tool-related type definitions."""
|
|
2
2
|
|
|
3
|
-
from enum import
|
|
3
|
+
from enum import StrEnum
|
|
4
4
|
from typing import Dict, Any, Optional
|
|
5
5
|
from pydantic import BaseModel, ConfigDict
|
|
6
6
|
|
|
7
|
-
class ToolInvocationState(
|
|
7
|
+
class ToolInvocationState(StrEnum):
|
|
8
8
|
"""States for tool invocation."""
|
|
9
9
|
CALL = 'call'
|
|
10
10
|
PARTIAL_CALL = 'partial-call'
|
agent/core/types.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"""Core type definitions."""
|
|
2
2
|
|
|
3
3
|
from typing import Any, Dict, List, Optional, TypedDict, Union
|
|
4
|
-
from enum import
|
|
4
|
+
from enum import StrEnum
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class AgentLoop(
|
|
8
|
+
class AgentLoop(StrEnum):
|
|
9
9
|
"""Enumeration of available loop types."""
|
|
10
10
|
|
|
11
|
-
ANTHROPIC =
|
|
12
|
-
OMNI =
|
|
13
|
-
OPENAI =
|
|
14
|
-
OLLAMA =
|
|
15
|
-
UITARS =
|
|
11
|
+
ANTHROPIC = "anthropic" # Anthropic implementation
|
|
12
|
+
OMNI = "omni" # OmniLoop implementation
|
|
13
|
+
OPENAI = "openai" # OpenAI implementation
|
|
14
|
+
OLLAMA = "ollama" # OLLAMA implementation
|
|
15
|
+
UITARS = "uitars" # UI-TARS implementation
|
|
16
16
|
# Add more loop types as needed
|
|
17
17
|
|
|
18
18
|
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
import platform
|
|
5
5
|
|
|
6
|
+
today = datetime.today()
|
|
7
|
+
today = f"{today.strftime('%A, %B')} {today.day}, {today.year}"
|
|
8
|
+
|
|
6
9
|
SYSTEM_PROMPT = f"""<SYSTEM_CAPABILITY>
|
|
7
10
|
* You are utilising a macOS virtual machine using ARM architecture with internet access and Safari as default browser.
|
|
8
11
|
* You can feel free to install macOS applications with your bash tool. Use curl instead of wget.
|
|
@@ -10,7 +13,7 @@ SYSTEM_PROMPT = f"""<SYSTEM_CAPABILITY>
|
|
|
10
13
|
* When using your bash tool with commands that are expected to output very large quantities of text, redirect into a tmp file and use str_replace_editor or `grep -n -B <lines before> -A <lines after> <query> <filename>` to confirm output.
|
|
11
14
|
* When viewing a page it can be helpful to zoom out so that you can see everything on the page. Either that, or make sure you scroll down to see everything before deciding something isn't available.
|
|
12
15
|
* When using your computer function calls, they take a while to run and send back to you. Where possible/feasible, try to chain multiple of these calls all into one function calls request.
|
|
13
|
-
* The current date is {
|
|
16
|
+
* The current date is {today}.
|
|
14
17
|
</SYSTEM_CAPABILITY>
|
|
15
18
|
|
|
16
19
|
<IMPORTANT>
|
agent/ui/gradio/app.py
CHANGED
|
@@ -22,7 +22,7 @@ Supported Agent Loops and Models:
|
|
|
22
22
|
Requirements:
|
|
23
23
|
- Mac with Apple Silicon (M1/M2/M3/M4)
|
|
24
24
|
- macOS 14 (Sonoma) or newer
|
|
25
|
-
- Python 3.
|
|
25
|
+
- Python 3.11+
|
|
26
26
|
- Lume CLI installed (https://github.com/trycua/cua)
|
|
27
27
|
- OpenAI or Anthropic API key
|
|
28
28
|
"""
|
|
@@ -31,6 +31,7 @@ import os
|
|
|
31
31
|
import asyncio
|
|
32
32
|
import logging
|
|
33
33
|
import json
|
|
34
|
+
import platform
|
|
34
35
|
from pathlib import Path
|
|
35
36
|
from typing import Dict, List, Optional, AsyncGenerator, Any, Tuple, Union
|
|
36
37
|
import gradio as gr
|
|
@@ -129,6 +130,9 @@ class GradioChatScreenshotHandler(DefaultCallbackHandler):
|
|
|
129
130
|
)
|
|
130
131
|
|
|
131
132
|
|
|
133
|
+
# Detect if current device is MacOS
|
|
134
|
+
is_mac = platform.system().lower() == "darwin"
|
|
135
|
+
|
|
132
136
|
# Map model names to specific provider model names
|
|
133
137
|
MODEL_MAPPINGS = {
|
|
134
138
|
"openai": {
|
|
@@ -165,7 +169,7 @@ MODEL_MAPPINGS = {
|
|
|
165
169
|
},
|
|
166
170
|
"uitars": {
|
|
167
171
|
# UI-TARS models using MLXVLM provider
|
|
168
|
-
"default": "mlx-community/UI-TARS-1.5-7B-4bit",
|
|
172
|
+
"default": "mlx-community/UI-TARS-1.5-7B-4bit" if is_mac else "tgi",
|
|
169
173
|
"mlx-community/UI-TARS-1.5-7B-4bit": "mlx-community/UI-TARS-1.5-7B-4bit",
|
|
170
174
|
"mlx-community/UI-TARS-1.5-7B-6bit": "mlx-community/UI-TARS-1.5-7B-6bit"
|
|
171
175
|
},
|
|
@@ -445,7 +449,8 @@ def create_gradio_ui(
|
|
|
445
449
|
# Check for API keys
|
|
446
450
|
openai_api_key = os.environ.get("OPENAI_API_KEY", "")
|
|
447
451
|
anthropic_api_key = os.environ.get("ANTHROPIC_API_KEY", "")
|
|
448
|
-
|
|
452
|
+
cua_api_key = os.environ.get("CUA_API_KEY", "")
|
|
453
|
+
|
|
449
454
|
# Always show models regardless of API key availability
|
|
450
455
|
openai_models = ["OpenAI: Computer-Use Preview"]
|
|
451
456
|
anthropic_models = [
|
|
@@ -463,25 +468,29 @@ def create_gradio_ui(
|
|
|
463
468
|
# Check if API keys are available
|
|
464
469
|
has_openai_key = bool(openai_api_key)
|
|
465
470
|
has_anthropic_key = bool(anthropic_api_key)
|
|
471
|
+
has_cua_key = bool(cua_api_key)
|
|
466
472
|
|
|
467
473
|
print("has_openai_key", has_openai_key)
|
|
468
474
|
print("has_anthropic_key", has_anthropic_key)
|
|
475
|
+
print("has_cua_key", has_cua_key)
|
|
469
476
|
|
|
470
477
|
# Get Ollama models for OMNI
|
|
471
478
|
ollama_models = get_ollama_models()
|
|
472
479
|
if ollama_models:
|
|
473
480
|
omni_models += ollama_models
|
|
474
481
|
|
|
482
|
+
# Detect if current device is MacOS
|
|
483
|
+
is_mac = platform.system().lower() == "darwin"
|
|
484
|
+
|
|
475
485
|
# Format model choices
|
|
476
486
|
provider_to_models = {
|
|
477
487
|
"OPENAI": openai_models,
|
|
478
488
|
"ANTHROPIC": anthropic_models,
|
|
479
489
|
"OMNI": omni_models + ["Custom model (OpenAI compatible API)", "Custom model (ollama)"], # Add custom model options
|
|
480
|
-
"UITARS": [
|
|
490
|
+
"UITARS": ([
|
|
481
491
|
"mlx-community/UI-TARS-1.5-7B-4bit",
|
|
482
492
|
"mlx-community/UI-TARS-1.5-7B-6bit",
|
|
483
|
-
|
|
484
|
-
], # UI-TARS options with MLX models
|
|
493
|
+
] if is_mac else []) + ["Custom model (OpenAI compatible API)"], # UI-TARS options with MLX models
|
|
485
494
|
}
|
|
486
495
|
|
|
487
496
|
# --- Apply Saved Settings (override defaults if available) ---
|
|
@@ -727,10 +736,14 @@ if __name__ == "__main__":
|
|
|
727
736
|
info="Select the operating system for the computer",
|
|
728
737
|
)
|
|
729
738
|
|
|
739
|
+
# Detect if current device is MacOS
|
|
740
|
+
is_mac = platform.system().lower() == "darwin"
|
|
741
|
+
|
|
730
742
|
computer_provider = gr.Radio(
|
|
731
743
|
choices=["cloud", "lume"],
|
|
732
744
|
label="Provider",
|
|
733
|
-
value="lume",
|
|
745
|
+
value="lume" if is_mac else "cloud",
|
|
746
|
+
visible=is_mac,
|
|
734
747
|
info="Select the computer provider",
|
|
735
748
|
)
|
|
736
749
|
|
|
@@ -747,6 +760,7 @@ if __name__ == "__main__":
|
|
|
747
760
|
value="",
|
|
748
761
|
type="password",
|
|
749
762
|
info="Required for cloud provider",
|
|
763
|
+
visible=(not has_cua_key)
|
|
750
764
|
)
|
|
751
765
|
|
|
752
766
|
with gr.Accordion("Agent Configuration", open=True):
|
|
@@ -1171,6 +1185,8 @@ if __name__ == "__main__":
|
|
|
1171
1185
|
else:
|
|
1172
1186
|
# For Ollama or default OAICOMPAT (without custom key), no key needed/expected
|
|
1173
1187
|
api_key = ""
|
|
1188
|
+
|
|
1189
|
+
cua_cloud_api_key = cua_cloud_api_key or os.environ.get("CUA_API_KEY", "")
|
|
1174
1190
|
|
|
1175
1191
|
# --- Save Settings Before Running Agent ---
|
|
1176
1192
|
current_settings = {
|
|
@@ -1439,7 +1455,7 @@ if __name__ == "__main__":
|
|
|
1439
1455
|
def test_cua():
|
|
1440
1456
|
"""Standalone function to launch the Gradio app."""
|
|
1441
1457
|
demo = create_gradio_ui()
|
|
1442
|
-
demo.launch(share=False) # Don't create a public link
|
|
1458
|
+
demo.launch(share=False, inbrowser=True) # Don't create a public link
|
|
1443
1459
|
|
|
1444
1460
|
|
|
1445
1461
|
if __name__ == "__main__":
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cua-agent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
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.11
|
|
7
7
|
Requires-Dist: httpx<0.29.0,>=0.27.0
|
|
8
8
|
Requires-Dist: aiohttp<4.0.0,>=3.9.3
|
|
9
9
|
Requires-Dist: asyncio
|
|
@@ -8,7 +8,7 @@ agent/core/factory.py,sha256=zzlCdibctqhf8Uta-SrvE-G7h59wAw-7SGhHiGvS9GY,4608
|
|
|
8
8
|
agent/core/messages.py,sha256=-OVMDqcxK5MUHPEkHliK29XFJYMRAc1keFvzrUyrOmM,16231
|
|
9
9
|
agent/core/provider_config.py,sha256=jB3fLsEsf806HQZ8jtzfSq4bCYGYONBeuCOoog_Nv_Y,768
|
|
10
10
|
agent/core/telemetry.py,sha256=HElPd32k_w2SJ6t-Cc3j_2-AKdLbFwh2YlM8QViDgRw,4790
|
|
11
|
-
agent/core/tools.py,sha256=
|
|
11
|
+
agent/core/tools.py,sha256=53aPme3O8U91n122Smu3TGbyGjQQe2zDimaZgKkFNi0,878
|
|
12
12
|
agent/core/tools/__init__.py,sha256=xZen-PqUp2dUaMEHJowXCQm33_5Sxhsx9PSoD0rq6tI,489
|
|
13
13
|
agent/core/tools/base.py,sha256=CdzRFNuOjNfzgyTUN4ZoCGkUDR5HI0ECQVpvrUdEij8,2295
|
|
14
14
|
agent/core/tools/bash.py,sha256=jnJKVlHn8np8e0gWd8EO0_qqjMkfQzutSugA_Iol4jE,1585
|
|
@@ -16,7 +16,7 @@ agent/core/tools/collection.py,sha256=NuwTn6dXSyznxWodfmFDQwUlxxaGb4oBPym4AEJABS
|
|
|
16
16
|
agent/core/tools/computer.py,sha256=lT_aW3huoYpcM8kffuokELupSz_WZG_qkaW1gITRC58,3892
|
|
17
17
|
agent/core/tools/edit.py,sha256=kv4jTKCM0VXrnoNErf7mT-xlr81-7T8v49_VA9y_L4Y,2005
|
|
18
18
|
agent/core/tools/manager.py,sha256=IRsCXjGc076nncQuyIjODoafnHTDhrf9sP5B4q5Pcdo,1742
|
|
19
|
-
agent/core/types.py,sha256=
|
|
19
|
+
agent/core/types.py,sha256=8DBbj2v9EYZ7e4NKbYHnZuWRsGV6tuij7FRSLRrg89I,2444
|
|
20
20
|
agent/core/visualization.py,sha256=1DuFF5sSeSf5BRSevBMDxml9-ajl7BQLFm5KBUwMbI8,6573
|
|
21
21
|
agent/providers/__init__.py,sha256=b4tIBAaIB1V7p8V0BWipHVnMhfHH_OuVgP4OWGSHdD8,194
|
|
22
22
|
agent/providers/anthropic/__init__.py,sha256=Mj11IZnVshZ2iHkvg4Z5-jrQIaD1WvzDz2Zk_pMwqIA,149
|
|
@@ -26,7 +26,7 @@ agent/providers/anthropic/api_handler.py,sha256=pWXcqDs0ruviDhRNRrz5Ac9ZH4yDv6Zl
|
|
|
26
26
|
agent/providers/anthropic/callbacks/__init__.py,sha256=PciBb6Z6MKSwfXqDjU3pV_0FS4MOn_Np_A7_skD-6dA,104
|
|
27
27
|
agent/providers/anthropic/callbacks/manager.py,sha256=euIah5yiM8nhisN-RWXewo6v0WQr0c-FbMBO04r6dJk,1865
|
|
28
28
|
agent/providers/anthropic/loop.py,sha256=Sepfo0b0oQT98xd3Sv2S7Xc81bfU7L4_Zv3VTiapKkg,21661
|
|
29
|
-
agent/providers/anthropic/prompts.py,sha256=
|
|
29
|
+
agent/providers/anthropic/prompts.py,sha256=EaqyvUb90yybv75VsBYzu4sroga7eMACys0uH9mIVWM,1993
|
|
30
30
|
agent/providers/anthropic/response_handler.py,sha256=ZTprV4NTP9Eb9jQ7QgEKZBX0L6rMj5nqBRiE3Zfws8I,8008
|
|
31
31
|
agent/providers/anthropic/tools/__init__.py,sha256=JyZwuVtPUnZwRSZBSCdQv9yxbLCsygm3l8Ywjjt9qTQ,661
|
|
32
32
|
agent/providers/anthropic/tools/base.py,sha256=WnRDbqO25tQzLpS2RU2ZXTLF5wd5IqU7SiyRAglQat4,2752
|
|
@@ -79,8 +79,8 @@ agent/providers/uitars/utils.py,sha256=493STTEEJcVhVbQgR0e8rNTI1DjkxUx8IgIv3wkJ1
|
|
|
79
79
|
agent/telemetry.py,sha256=pVGxbj0ewnvq4EGj28CydN4a1iOfvZR_XKL3vIOqhOM,390
|
|
80
80
|
agent/ui/__init__.py,sha256=ohhxJLBin6k1hl5sKcmBST8mgh23WXgAXz3pN4f470E,45
|
|
81
81
|
agent/ui/gradio/__init__.py,sha256=ANKZhv1HqsLheWbLVBlyRQ7Q5qGeXuPi5jDs8vu-ZMo,579
|
|
82
|
-
agent/ui/gradio/app.py,sha256=
|
|
83
|
-
cua_agent-0.2.
|
|
84
|
-
cua_agent-0.2.
|
|
85
|
-
cua_agent-0.2.
|
|
86
|
-
cua_agent-0.2.
|
|
82
|
+
agent/ui/gradio/app.py,sha256=StBehGfPJhE6ywnxU3CHDPkZrOm_2XMT1Npepf89G5c,70675
|
|
83
|
+
cua_agent-0.2.6.dist-info/METADATA,sha256=S__b2BEFawXYdS-AOJ9qZRHxgzcvIF8cgVL49rq7LRM,12688
|
|
84
|
+
cua_agent-0.2.6.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
85
|
+
cua_agent-0.2.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
86
|
+
cua_agent-0.2.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|