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

Files changed (57) hide show
  1. agent/__init__.py +3 -2
  2. agent/core/__init__.py +1 -6
  3. agent/core/{computer_agent.py → agent.py} +31 -76
  4. agent/core/{loop.py → base.py} +68 -127
  5. agent/core/factory.py +104 -0
  6. agent/core/messages.py +279 -125
  7. agent/core/provider_config.py +15 -0
  8. agent/core/types.py +45 -0
  9. agent/core/visualization.py +197 -0
  10. agent/providers/anthropic/api/client.py +142 -1
  11. agent/providers/anthropic/api_handler.py +140 -0
  12. agent/providers/anthropic/callbacks/__init__.py +5 -0
  13. agent/providers/anthropic/loop.py +207 -221
  14. agent/providers/anthropic/response_handler.py +226 -0
  15. agent/providers/anthropic/tools/bash.py +0 -97
  16. agent/providers/anthropic/utils.py +368 -0
  17. agent/providers/omni/__init__.py +1 -20
  18. agent/providers/omni/api_handler.py +42 -0
  19. agent/providers/omni/clients/anthropic.py +4 -0
  20. agent/providers/omni/image_utils.py +0 -72
  21. agent/providers/omni/loop.py +491 -607
  22. agent/providers/omni/parser.py +58 -4
  23. agent/providers/omni/tools/__init__.py +25 -7
  24. agent/providers/omni/tools/base.py +29 -0
  25. agent/providers/omni/tools/bash.py +43 -38
  26. agent/providers/omni/tools/computer.py +144 -182
  27. agent/providers/omni/tools/manager.py +25 -45
  28. agent/providers/omni/types.py +1 -3
  29. agent/providers/omni/utils.py +224 -145
  30. agent/providers/openai/__init__.py +6 -0
  31. agent/providers/openai/api_handler.py +453 -0
  32. agent/providers/openai/loop.py +440 -0
  33. agent/providers/openai/response_handler.py +205 -0
  34. agent/providers/openai/tools/__init__.py +15 -0
  35. agent/providers/openai/tools/base.py +79 -0
  36. agent/providers/openai/tools/computer.py +319 -0
  37. agent/providers/openai/tools/manager.py +106 -0
  38. agent/providers/openai/types.py +36 -0
  39. agent/providers/openai/utils.py +98 -0
  40. cua_agent-0.1.18.dist-info/METADATA +165 -0
  41. cua_agent-0.1.18.dist-info/RECORD +73 -0
  42. agent/README.md +0 -63
  43. agent/providers/anthropic/messages/manager.py +0 -112
  44. agent/providers/omni/callbacks.py +0 -78
  45. agent/providers/omni/clients/groq.py +0 -101
  46. agent/providers/omni/experiment.py +0 -276
  47. agent/providers/omni/messages.py +0 -171
  48. agent/providers/omni/tool_manager.py +0 -91
  49. agent/providers/omni/visualization.py +0 -130
  50. agent/types/__init__.py +0 -23
  51. agent/types/base.py +0 -41
  52. agent/types/messages.py +0 -36
  53. cua_agent-0.1.6.dist-info/METADATA +0 -120
  54. cua_agent-0.1.6.dist-info/RECORD +0 -64
  55. /agent/{types → core}/tools.py +0 -0
  56. {cua_agent-0.1.6.dist-info → cua_agent-0.1.18.dist-info}/WHEEL +0 -0
  57. {cua_agent-0.1.6.dist-info → cua_agent-0.1.18.dist-info}/entry_points.txt +0 -0
agent/types/base.py DELETED
@@ -1,41 +0,0 @@
1
- """Base type definitions."""
2
-
3
- from enum import Enum, auto
4
- from typing import Dict, Any
5
- from pydantic import BaseModel, ConfigDict
6
-
7
-
8
- class HostConfig(BaseModel):
9
- """Host configuration."""
10
-
11
- model_config = ConfigDict(extra="forbid")
12
- hostname: str
13
- port: int
14
-
15
- @property
16
- def address(self) -> str:
17
- return f"{self.hostname}:{self.port}"
18
-
19
-
20
- class TaskResult(BaseModel):
21
- """Result of a task execution."""
22
-
23
- model_config = ConfigDict(extra="forbid")
24
- result: str
25
- vnc_password: str
26
-
27
-
28
- class Annotation(BaseModel):
29
- """Annotation metadata."""
30
-
31
- model_config = ConfigDict(extra="forbid")
32
- id: str
33
- vm_url: str
34
-
35
-
36
- class AgentLoop(Enum):
37
- """Enumeration of available loop types."""
38
-
39
- ANTHROPIC = auto() # Anthropic implementation
40
- OMNI = auto() # OmniLoop implementation
41
- # Add more loop types as needed
agent/types/messages.py DELETED
@@ -1,36 +0,0 @@
1
- """Message-related type definitions."""
2
-
3
- from typing import List, Dict, Any, Optional
4
- from pydantic import BaseModel, ConfigDict
5
-
6
- from .tools import ToolInvocation
7
-
8
- class Message(BaseModel):
9
- """Base message type."""
10
- model_config = ConfigDict(extra='forbid')
11
- role: str
12
- content: str
13
- annotations: Optional[List[Dict[str, Any]]] = None
14
- toolInvocations: Optional[List[ToolInvocation]] = None
15
- data: Optional[List[Dict[str, Any]]] = None
16
- errors: Optional[List[str]] = None
17
-
18
- class Request(BaseModel):
19
- """Request type."""
20
- model_config = ConfigDict(extra='forbid')
21
- messages: List[Message]
22
- selectedModel: str
23
-
24
- class Response(BaseModel):
25
- """Response type."""
26
- model_config = ConfigDict(extra='forbid')
27
- messages: List[Message]
28
- vm_url: str
29
-
30
- class StepMessage(Message):
31
- """Message for a single step."""
32
- pass
33
-
34
- class DisengageMessage(BaseModel):
35
- """Message indicating disengagement."""
36
- pass
@@ -1,120 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cua-agent
3
- Version: 0.1.6
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,64 +0,0 @@
1
- agent/README.md,sha256=8EFnLrKejthEcL9bZflQSbvA-KwpiPanBz8TEEwRub8,2153
2
- agent/__init__.py,sha256=Pil-INEbTU7iOlZXP3QN-kV_IHtW9uk7PuJCON319Ws,1437
3
- agent/core/README.md,sha256=VOXNVbR0ugxf9gCXYmZtUU2kngZhfi29haT_oSxK0Lk,3559
4
- agent/core/__init__.py,sha256=bds3kSkCILroIxxqU4scCPPCr-pooIkF2S4oU3OgsGY,638
5
- agent/core/callbacks.py,sha256=VbGIf5QkHh3Q0KsLM6wv7hRdIA5WExTVYLm64bckyUA,4306
6
- agent/core/computer_agent.py,sha256=7JOwAEeB1CL8Sw_1WAE3_a9tswZyCaBdXWDCfD3r7M4,9976
7
- agent/core/experiment.py,sha256=Ywj6q3JZFDKicfPuQsDl0vSN55HS7-Cnk3u3EcUCKe8,8866
8
- agent/core/loop.py,sha256=j4zI7h6mifQ5kMn9y0NcjAi1ZpvSBHoPL7Lk2e1OGsQ,9255
9
- agent/core/messages.py,sha256=N8pV8Eh-AJpMuDPRI5OGWUIOU6DRr-pQjK9XU0go9Hk,7637
10
- agent/core/telemetry.py,sha256=HElPd32k_w2SJ6t-Cc3j_2-AKdLbFwh2YlM8QViDgRw,4790
11
- agent/core/tools/__init__.py,sha256=xZen-PqUp2dUaMEHJowXCQm33_5Sxhsx9PSoD0rq6tI,489
12
- agent/core/tools/base.py,sha256=CdzRFNuOjNfzgyTUN4ZoCGkUDR5HI0ECQVpvrUdEij8,2295
13
- agent/core/tools/bash.py,sha256=jnJKVlHn8np8e0gWd8EO0_qqjMkfQzutSugA_Iol4jE,1585
14
- agent/core/tools/collection.py,sha256=NuwTn6dXSyznxWodfmFDQwUlxxaGb4oBPym4AEJABSQ,1338
15
- agent/core/tools/computer.py,sha256=lT_aW3huoYpcM8kffuokELupSz_WZG_qkaW1gITRC58,3892
16
- agent/core/tools/edit.py,sha256=kv4jTKCM0VXrnoNErf7mT-xlr81-7T8v49_VA9y_L4Y,2005
17
- agent/core/tools/manager.py,sha256=IRsCXjGc076nncQuyIjODoafnHTDhrf9sP5B4q5Pcdo,1742
18
- agent/providers/__init__.py,sha256=b4tIBAaIB1V7p8V0BWipHVnMhfHH_OuVgP4OWGSHdD8,194
19
- agent/providers/anthropic/__init__.py,sha256=Mj11IZnVshZ2iHkvg4Z5-jrQIaD1WvzDz2Zk_pMwqIA,149
20
- agent/providers/anthropic/api/client.py,sha256=Y_g4Xg8Ko4tCqjipVm0GBMw-86vw0KQVXS5aWzJinzw,7038
21
- agent/providers/anthropic/api/logging.py,sha256=vHpwkIyOZdkSTVIH4ycbBPd4a_rzhP7Osu1I-Ayouwc,5154
22
- agent/providers/anthropic/callbacks/manager.py,sha256=dRKN7MuBze2dLal0iHDxCKYqMdh_KShSphuwn7zC-c4,1878
23
- agent/providers/anthropic/loop.py,sha256=uPjgXoGRdJb5bsJchUh_0aUuyRBm-HSp7jaM2cKg61I,19466
24
- agent/providers/anthropic/messages/manager.py,sha256=6FobzAHh5-7dxaxbUdG1--1UY4w-mh3MFytX6ONrK3c,4972
25
- agent/providers/anthropic/prompts.py,sha256=nHFfgPrfvnWrEdVP7EUBGUHAI85D2X9HeZirk9EwncU,1941
26
- agent/providers/anthropic/tools/__init__.py,sha256=JyZwuVtPUnZwRSZBSCdQv9yxbLCsygm3l8Ywjjt9qTQ,661
27
- agent/providers/anthropic/tools/base.py,sha256=WnRDbqO25tQzLpS2RU2ZXTLF5wd5IqU7SiyRAglQat4,2752
28
- agent/providers/anthropic/tools/bash.py,sha256=CIh4pO0jEdSZApnjpmFhrQbTTiwxivuOgv1-QLN0Ydw,5740
29
- agent/providers/anthropic/tools/collection.py,sha256=RBK_6hxfHExR-EOxadiLl0OznmFj07nyIUjFgaYZ6Eo,960
30
- agent/providers/anthropic/tools/computer.py,sha256=vYni1jDOOgzSSBOJxHcEKxvKUYRp5_nQ-9dmpGdLwm4,25858
31
- agent/providers/anthropic/tools/edit.py,sha256=EGRP61MDA4Oue1D7Q-_vLpd6LdGbdBA1Z4HSZ66DbmI,13465
32
- agent/providers/anthropic/tools/manager.py,sha256=yNvgTkfEqnOz5isDF0RxvmBMZB0uh2PipFEH-PUXpoY,2020
33
- agent/providers/anthropic/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
34
- agent/providers/anthropic/types.py,sha256=SF00kOMC1ui8j9Ah56KaeiR2cL394qCHjFIsBpXxt5w,421
35
- agent/providers/omni/__init__.py,sha256=eTUh4Pmh4zO-RLnP-wAFm8EkJBMImT-G2xnVIYWRti0,744
36
- agent/providers/omni/callbacks.py,sha256=ZG9NCgsHWt6y5jKsfcGLaoLxTpmKnIhCArDdeP4q9sA,2369
37
- agent/providers/omni/clients/anthropic.py,sha256=X_QRVxqwA_ExdUqgBEwo1aHOfZQxVIBDmDugNHF97OM,3554
38
- agent/providers/omni/clients/base.py,sha256=zAAgPi0jl3SWPC730R9l79E8bfYPSo39UtCSE-mrK6I,1076
39
- agent/providers/omni/clients/groq.py,sha256=HEinpE0_Cp_-geMyjJ8qaTPl0regPtETPkem4U13qG4,3599
40
- agent/providers/omni/clients/openai.py,sha256=E4TAXMUFoYTunJETCWCNx5XAc6xutiN4rB6PlVpzC5s,5972
41
- agent/providers/omni/clients/utils.py,sha256=Ani9CVVBm_J2Dl51WG6p1GVuoI6cq8scISrG0pmQ37o,688
42
- agent/providers/omni/experiment.py,sha256=ZZ45U5NEkpzMNeMO9hJfpRf3iPNFaSZVwChcfqOgbI0,10002
43
- agent/providers/omni/image_utils.py,sha256=qIFuNi5cIMVwrqYBXG1T6PxUlbxz7gIngFFP39bZIlU,2782
44
- agent/providers/omni/loop.py,sha256=10GxyZFG8wAYObaaInWSZDRVwWNnZk_qhqdGr3PIPe0,44022
45
- agent/providers/omni/messages.py,sha256=zdjQCAMH-hOyrQQesHhTiIsQbw43KqVSmVIzS8JOIFA,6134
46
- agent/providers/omni/parser.py,sha256=4n1rzaD-mHi7sMfeqChgOyrJuciwzL95x32BGI6GATM,9194
47
- agent/providers/omni/prompts.py,sha256=Mupjy0bUwBjcAeLXpE1r1jisYPSlhwsp-IXJKEKrEtw,3779
48
- agent/providers/omni/tool_manager.py,sha256=O6DxyEI-Vg6jt99phh011o4q4me_vNhH2YffIxkO4GM,2585
49
- agent/providers/omni/tools/__init__.py,sha256=RkxsPTow3jpOKuXJ1ZKb-KBi6lbxGWfjC9gaV6hSZIs,278
50
- agent/providers/omni/tools/bash.py,sha256=y_ibfP9iRcbiU_E0faAoa4DCP_BlkMlKOOURdBBIGZE,2030
51
- agent/providers/omni/tools/computer.py,sha256=s8WVA_xGROEfdmCYjEqr563ySp4DRMlsLVuu54nH0Ww,9129
52
- agent/providers/omni/tools/manager.py,sha256=EyNABQeJc8bEcJ4hFsRodKyBNkZpThfOHk1Ku3Pzsg8,2519
53
- agent/providers/omni/types.py,sha256=rpr7-mH9VK1R-nJ6tVu1gKp427j-hw1DpHc197b44nU,1017
54
- agent/providers/omni/utils.py,sha256=X2IBki6yJQFaEz7PDjkx8CqQq2R1v7nldRcOT5j7YcA,6381
55
- agent/providers/omni/visualization.py,sha256=N3qVQLxYmia3iSVC5oCt5YRlMPuVfylCOyB99R33u8U,3924
56
- agent/telemetry.py,sha256=pVGxbj0ewnvq4EGj28CydN4a1iOfvZR_XKL3vIOqhOM,390
57
- agent/types/__init__.py,sha256=Xi6nNSsfbsGxs3We8gbdEY0ew0Jf0A0Prs5393Tvveg,568
58
- agent/types/base.py,sha256=_5LNleRTqoL55VHEEZntL8x-OQom2A3FiTf2ttdM_HQ,857
59
- agent/types/messages.py,sha256=4-hwtxeAhto90_EZpHFducddtsHUsHauvXzYrpKG4RE,953
60
- agent/types/tools.py,sha256=Jes2CFCFqC727WWHbO-sG7V03rBHnQe5X7Oi9ZkuScI,877
61
- cua_agent-0.1.6.dist-info/METADATA,sha256=rD_j8q7aC5wkNQtpbgRLyo3-5z_zCDivJE8MwyPpz6I,4528
62
- cua_agent-0.1.6.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
63
- cua_agent-0.1.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
64
- cua_agent-0.1.6.dist-info/RECORD,,
File without changes