cua-agent 0.1.5__py3-none-any.whl → 0.1.17__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 +3 -4
- agent/core/__init__.py +3 -10
- agent/core/computer_agent.py +207 -32
- agent/core/experiment.py +20 -3
- agent/core/loop.py +78 -120
- agent/core/messages.py +279 -125
- agent/core/telemetry.py +44 -32
- agent/core/types.py +35 -0
- agent/core/visualization.py +197 -0
- agent/providers/anthropic/api/client.py +142 -1
- agent/providers/anthropic/api_handler.py +140 -0
- agent/providers/anthropic/callbacks/__init__.py +5 -0
- agent/providers/anthropic/loop.py +224 -209
- agent/providers/anthropic/messages/manager.py +3 -1
- agent/providers/anthropic/response_handler.py +229 -0
- agent/providers/anthropic/tools/base.py +1 -1
- agent/providers/anthropic/tools/bash.py +0 -97
- agent/providers/anthropic/tools/collection.py +2 -2
- agent/providers/anthropic/tools/computer.py +34 -24
- agent/providers/anthropic/tools/manager.py +2 -2
- agent/providers/anthropic/utils.py +370 -0
- agent/providers/omni/__init__.py +1 -20
- agent/providers/omni/api_handler.py +42 -0
- agent/providers/omni/clients/anthropic.py +4 -0
- agent/providers/omni/image_utils.py +0 -72
- agent/providers/omni/loop.py +497 -607
- agent/providers/omni/parser.py +60 -5
- agent/providers/omni/tools/__init__.py +25 -8
- agent/providers/omni/tools/base.py +29 -0
- agent/providers/omni/tools/bash.py +43 -38
- agent/providers/omni/tools/computer.py +144 -181
- agent/providers/omni/tools/manager.py +26 -48
- agent/providers/omni/types.py +0 -4
- agent/providers/omni/utils.py +225 -144
- {cua_agent-0.1.5.dist-info → cua_agent-0.1.17.dist-info}/METADATA +6 -36
- cua_agent-0.1.17.dist-info/RECORD +63 -0
- agent/core/agent.py +0 -252
- agent/core/base_agent.py +0 -164
- agent/core/factory.py +0 -102
- agent/providers/omni/callbacks.py +0 -78
- agent/providers/omni/clients/groq.py +0 -101
- agent/providers/omni/experiment.py +0 -273
- agent/providers/omni/messages.py +0 -171
- agent/providers/omni/tool_manager.py +0 -91
- agent/providers/omni/visualization.py +0 -130
- agent/types/__init__.py +0 -26
- agent/types/base.py +0 -53
- agent/types/messages.py +0 -36
- cua_agent-0.1.5.dist-info/RECORD +0 -67
- /agent/{types → core}/tools.py +0 -0
- {cua_agent-0.1.5.dist-info → cua_agent-0.1.17.dist-info}/WHEEL +0 -0
- {cua_agent-0.1.5.dist-info → cua_agent-0.1.17.dist-info}/entry_points.txt +0 -0
|
@@ -1,83 +1,61 @@
|
|
|
1
|
-
"""
|
|
2
|
-
|
|
3
|
-
from typing import Dict, List, Any
|
|
4
|
-
from enum import Enum
|
|
1
|
+
"""Tool manager for the Omni provider."""
|
|
5
2
|
|
|
3
|
+
from typing import Any, Dict, List
|
|
6
4
|
from computer.computer import Computer
|
|
7
5
|
|
|
8
|
-
from ....core.tools import BaseToolManager
|
|
6
|
+
from ....core.tools import BaseToolManager, ToolResult
|
|
9
7
|
from ....core.tools.collection import ToolCollection
|
|
8
|
+
from .computer import ComputerTool
|
|
9
|
+
from .bash import BashTool
|
|
10
|
+
from ..types import LLMProvider
|
|
10
11
|
|
|
11
|
-
from .bash import OmniBashTool
|
|
12
|
-
from .computer import OmniComputerTool
|
|
13
|
-
from .edit import OmniEditTool
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class ProviderType(Enum):
|
|
17
|
-
"""Supported provider types."""
|
|
18
|
-
|
|
19
|
-
ANTHROPIC = "anthropic"
|
|
20
|
-
OPENAI = "openai"
|
|
21
|
-
CLAUDE = "claude" # Alias for Anthropic
|
|
22
|
-
GPT = "gpt" # Alias for OpenAI
|
|
23
12
|
|
|
13
|
+
class ToolManager(BaseToolManager):
|
|
14
|
+
"""Manages Omni provider tool initialization and execution."""
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def __init__(self, computer: Computer):
|
|
29
|
-
"""Initialize Omni tool manager.
|
|
16
|
+
def __init__(self, computer: Computer, provider: LLMProvider):
|
|
17
|
+
"""Initialize the tool manager.
|
|
30
18
|
|
|
31
19
|
Args:
|
|
32
|
-
computer: Computer instance for tools
|
|
20
|
+
computer: Computer instance for computer-related tools
|
|
21
|
+
provider: The LLM provider being used
|
|
33
22
|
"""
|
|
34
23
|
super().__init__(computer)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
self.
|
|
38
|
-
self.
|
|
24
|
+
self.provider = provider
|
|
25
|
+
# Initialize Omni-specific tools
|
|
26
|
+
self.computer_tool = ComputerTool(self.computer)
|
|
27
|
+
self.bash_tool = BashTool(self.computer)
|
|
39
28
|
|
|
40
29
|
def _initialize_tools(self) -> ToolCollection:
|
|
41
30
|
"""Initialize all available tools."""
|
|
42
|
-
return ToolCollection(self.computer_tool, self.bash_tool
|
|
31
|
+
return ToolCollection(self.computer_tool, self.bash_tool)
|
|
43
32
|
|
|
44
33
|
async def _initialize_tools_specific(self) -> None:
|
|
45
|
-
"""Initialize provider-specific tool requirements."""
|
|
34
|
+
"""Initialize Omni provider-specific tool requirements."""
|
|
46
35
|
await self.computer_tool.initialize_dimensions()
|
|
47
36
|
|
|
48
37
|
def get_tool_params(self) -> List[Dict[str, Any]]:
|
|
49
38
|
"""Get tool parameters for API calls.
|
|
50
39
|
|
|
51
40
|
Returns:
|
|
52
|
-
List of tool parameters
|
|
41
|
+
List of tool parameters for the current provider's API
|
|
53
42
|
"""
|
|
54
43
|
if self.tools is None:
|
|
55
44
|
raise RuntimeError("Tools not initialized. Call initialize() first.")
|
|
45
|
+
|
|
56
46
|
return self.tools.to_params()
|
|
57
47
|
|
|
58
|
-
def
|
|
59
|
-
"""
|
|
48
|
+
async def execute_tool(self, name: str, tool_input: dict[str, Any]) -> ToolResult:
|
|
49
|
+
"""Execute a tool with the given input.
|
|
60
50
|
|
|
61
51
|
Args:
|
|
62
|
-
|
|
52
|
+
name: Name of the tool to execute
|
|
53
|
+
tool_input: Input parameters for the tool
|
|
63
54
|
|
|
64
55
|
Returns:
|
|
65
|
-
|
|
56
|
+
Result of the tool execution
|
|
66
57
|
"""
|
|
67
58
|
if self.tools is None:
|
|
68
59
|
raise RuntimeError("Tools not initialized. Call initialize() first.")
|
|
69
60
|
|
|
70
|
-
|
|
71
|
-
tools = self.tools.to_params()
|
|
72
|
-
|
|
73
|
-
# Customize for each provider if needed
|
|
74
|
-
if provider in [ProviderType.ANTHROPIC, ProviderType.CLAUDE]:
|
|
75
|
-
# Format for Anthropic API
|
|
76
|
-
# Additional adjustments can be made here
|
|
77
|
-
pass
|
|
78
|
-
elif provider in [ProviderType.OPENAI, ProviderType.GPT]:
|
|
79
|
-
# Format for OpenAI API
|
|
80
|
-
# Future implementation
|
|
81
|
-
pass
|
|
82
|
-
|
|
83
|
-
return tools
|
|
61
|
+
return await self.tools.run(name=name, tool_input=tool_input)
|
agent/providers/omni/types.py
CHANGED
agent/providers/omni/utils.py
CHANGED
|
@@ -1,155 +1,236 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Main entry point for computer agents."""
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import asyncio
|
|
4
|
+
import json
|
|
5
5
|
import logging
|
|
6
|
-
|
|
7
|
-
from
|
|
6
|
+
import os
|
|
7
|
+
from typing import Any, Dict, List, Optional
|
|
8
|
+
from som.models import ParseResult
|
|
9
|
+
from ...core.types import AgentResponse
|
|
8
10
|
|
|
9
11
|
logger = logging.getLogger(__name__)
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
def
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
async def to_openai_agent_response_format(
|
|
15
|
+
response: Any,
|
|
16
|
+
messages: List[Dict[str, Any]],
|
|
17
|
+
parsed_screen: Optional[ParseResult] = None,
|
|
18
|
+
parser: Optional[Any] = None,
|
|
19
|
+
model: Optional[str] = None,
|
|
20
|
+
) -> AgentResponse:
|
|
21
|
+
"""Create an OpenAI computer use agent compatible response format.
|
|
16
22
|
|
|
17
23
|
Args:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
response: The original API response
|
|
25
|
+
messages: List of messages in standard OpenAI format
|
|
26
|
+
parsed_screen: Optional pre-parsed screen information
|
|
27
|
+
parser: Optional parser instance for coordinate calculation
|
|
28
|
+
model: Optional model name
|
|
21
29
|
|
|
22
30
|
Returns:
|
|
23
|
-
|
|
31
|
+
A response formatted according to OpenAI's computer use agent standard, including:
|
|
32
|
+
- All standard OpenAI computer use agent fields
|
|
33
|
+
- Original response in response.choices[0].message
|
|
34
|
+
- Full message history in messages field
|
|
24
35
|
"""
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
36
|
+
from datetime import datetime
|
|
37
|
+
import time
|
|
38
|
+
|
|
39
|
+
# Create a unique ID for this response
|
|
40
|
+
response_id = f"resp_{datetime.now().strftime('%Y%m%d%H%M%S')}_{id(response)}"
|
|
41
|
+
reasoning_id = f"rs_{response_id}"
|
|
42
|
+
action_id = f"cu_{response_id}"
|
|
43
|
+
call_id = f"call_{response_id}"
|
|
44
|
+
|
|
45
|
+
# Extract the last assistant message
|
|
46
|
+
assistant_msg = None
|
|
47
|
+
for msg in reversed(messages):
|
|
48
|
+
if msg["role"] == "assistant":
|
|
49
|
+
assistant_msg = msg
|
|
50
|
+
break
|
|
51
|
+
|
|
52
|
+
if not assistant_msg:
|
|
53
|
+
# If no assistant message found, create a default one
|
|
54
|
+
assistant_msg = {"role": "assistant", "content": "No response available"}
|
|
55
|
+
|
|
56
|
+
# Initialize output array
|
|
57
|
+
output_items = []
|
|
58
|
+
|
|
59
|
+
# Extract reasoning and action details from the response
|
|
60
|
+
content = assistant_msg["content"]
|
|
61
|
+
reasoning_text = None
|
|
62
|
+
action_details = None
|
|
63
|
+
|
|
64
|
+
for item in content:
|
|
65
|
+
if isinstance(item, dict) and item.get("type") == "text":
|
|
66
|
+
try:
|
|
67
|
+
# Try to parse JSON from text block
|
|
68
|
+
text_content = item.get("text", "")
|
|
69
|
+
parsed_json = json.loads(text_content)
|
|
70
|
+
|
|
71
|
+
# Get reasoning text
|
|
72
|
+
if reasoning_text is None:
|
|
73
|
+
reasoning_text = parsed_json.get("Explanation", "")
|
|
74
|
+
|
|
75
|
+
# Extract action details
|
|
76
|
+
action = parsed_json.get("Action", "").lower()
|
|
77
|
+
text_input = parsed_json.get("Text", "")
|
|
78
|
+
value = parsed_json.get("Value", "") # Also handle Value field
|
|
79
|
+
box_id = parsed_json.get("Box ID") # Extract Box ID
|
|
80
|
+
|
|
81
|
+
if action in ["click", "left_click"]:
|
|
82
|
+
# Always calculate coordinates from Box ID for click actions
|
|
83
|
+
x, y = 100, 100 # Default fallback values
|
|
84
|
+
|
|
85
|
+
if parsed_screen and box_id is not None and parser is not None:
|
|
86
|
+
try:
|
|
87
|
+
box_id_int = (
|
|
88
|
+
box_id
|
|
89
|
+
if isinstance(box_id, int)
|
|
90
|
+
else int(str(box_id)) if str(box_id).isdigit() else None
|
|
91
|
+
)
|
|
92
|
+
if box_id_int is not None:
|
|
93
|
+
# Use the parser's method to calculate coordinates
|
|
94
|
+
x, y = await parser.calculate_click_coordinates(
|
|
95
|
+
box_id_int, parsed_screen
|
|
96
|
+
)
|
|
97
|
+
except Exception as e:
|
|
98
|
+
logger.error(
|
|
99
|
+
f"Error extracting coordinates for Box ID {box_id}: {str(e)}"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
action_details = {
|
|
103
|
+
"type": "click",
|
|
104
|
+
"button": "left",
|
|
105
|
+
"box_id": (
|
|
106
|
+
(
|
|
107
|
+
box_id
|
|
108
|
+
if isinstance(box_id, int)
|
|
109
|
+
else int(box_id) if str(box_id).isdigit() else None
|
|
110
|
+
)
|
|
111
|
+
if box_id is not None
|
|
112
|
+
else None
|
|
113
|
+
),
|
|
114
|
+
"x": x,
|
|
115
|
+
"y": y,
|
|
116
|
+
}
|
|
117
|
+
elif action in ["type", "type_text"] and (text_input or value):
|
|
118
|
+
action_details = {
|
|
119
|
+
"type": "type",
|
|
120
|
+
"text": text_input or value,
|
|
121
|
+
}
|
|
122
|
+
elif action == "hotkey" and value:
|
|
123
|
+
action_details = {
|
|
124
|
+
"type": "hotkey",
|
|
125
|
+
"keys": value,
|
|
126
|
+
}
|
|
127
|
+
elif action == "scroll":
|
|
128
|
+
# Use default coordinates for scrolling
|
|
129
|
+
delta_x = 0
|
|
130
|
+
delta_y = 0
|
|
131
|
+
# Try to extract scroll delta values from content if available
|
|
132
|
+
scroll_data = parsed_json.get("Scroll", {})
|
|
133
|
+
if scroll_data:
|
|
134
|
+
delta_x = scroll_data.get("delta_x", 0)
|
|
135
|
+
delta_y = scroll_data.get("delta_y", 0)
|
|
136
|
+
action_details = {
|
|
137
|
+
"type": "scroll",
|
|
138
|
+
"x": 100,
|
|
139
|
+
"y": 100,
|
|
140
|
+
"scroll_x": delta_x,
|
|
141
|
+
"scroll_y": delta_y,
|
|
142
|
+
}
|
|
143
|
+
elif action == "none":
|
|
144
|
+
# Handle case when action is None (task completion)
|
|
145
|
+
action_details = {"type": "none", "description": "Task completed"}
|
|
146
|
+
except json.JSONDecodeError:
|
|
147
|
+
# If not JSON, just use as reasoning text
|
|
148
|
+
if reasoning_text is None:
|
|
149
|
+
reasoning_text = ""
|
|
150
|
+
reasoning_text += item.get("text", "")
|
|
151
|
+
|
|
152
|
+
# Add reasoning item if we have text content
|
|
153
|
+
if reasoning_text:
|
|
154
|
+
output_items.append(
|
|
155
|
+
{
|
|
156
|
+
"type": "reasoning",
|
|
157
|
+
"id": reasoning_id,
|
|
158
|
+
"summary": [
|
|
159
|
+
{
|
|
160
|
+
"type": "summary_text",
|
|
161
|
+
"text": reasoning_text[:200], # Truncate to reasonable length
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# If no action details extracted, use default
|
|
168
|
+
if not action_details:
|
|
169
|
+
action_details = {
|
|
170
|
+
"type": "click",
|
|
171
|
+
"button": "left",
|
|
172
|
+
"x": 100,
|
|
173
|
+
"y": 100,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
# Add computer_call item
|
|
177
|
+
computer_call = {
|
|
178
|
+
"type": "computer_call",
|
|
179
|
+
"id": action_id,
|
|
180
|
+
"call_id": call_id,
|
|
181
|
+
"action": action_details,
|
|
182
|
+
"pending_safety_checks": [],
|
|
183
|
+
"status": "completed",
|
|
184
|
+
}
|
|
185
|
+
output_items.append(computer_call)
|
|
186
|
+
|
|
187
|
+
# Extract user and assistant messages from the history
|
|
188
|
+
user_messages = []
|
|
189
|
+
assistant_messages = []
|
|
190
|
+
for msg in messages:
|
|
191
|
+
if msg["role"] == "user":
|
|
192
|
+
user_messages.append(msg)
|
|
193
|
+
elif msg["role"] == "assistant":
|
|
194
|
+
assistant_messages.append(msg)
|
|
195
|
+
|
|
196
|
+
# Create the OpenAI-compatible response format with all expected fields
|
|
197
|
+
return {
|
|
198
|
+
"id": response_id,
|
|
199
|
+
"object": "response",
|
|
200
|
+
"created_at": int(time.time()),
|
|
201
|
+
"status": "completed",
|
|
202
|
+
"error": None,
|
|
203
|
+
"incomplete_details": None,
|
|
204
|
+
"instructions": None,
|
|
205
|
+
"max_output_tokens": None,
|
|
206
|
+
"model": model or "unknown",
|
|
207
|
+
"output": output_items,
|
|
208
|
+
"parallel_tool_calls": True,
|
|
209
|
+
"previous_response_id": None,
|
|
210
|
+
"reasoning": {"effort": "medium", "generate_summary": "concise"},
|
|
211
|
+
"store": True,
|
|
212
|
+
"temperature": 1.0,
|
|
213
|
+
"text": {"format": {"type": "text"}},
|
|
214
|
+
"tool_choice": "auto",
|
|
215
|
+
"tools": [
|
|
216
|
+
{
|
|
217
|
+
"type": "computer_use_preview",
|
|
218
|
+
"display_height": 768,
|
|
219
|
+
"display_width": 1024,
|
|
220
|
+
"environment": "mac",
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"top_p": 1.0,
|
|
224
|
+
"truncation": "auto",
|
|
225
|
+
"usage": {
|
|
226
|
+
"input_tokens": 0, # Placeholder values
|
|
227
|
+
"input_tokens_details": {"cached_tokens": 0},
|
|
228
|
+
"output_tokens": 0, # Placeholder values
|
|
229
|
+
"output_tokens_details": {"reasoning_tokens": 0},
|
|
230
|
+
"total_tokens": 0, # Placeholder values
|
|
231
|
+
},
|
|
232
|
+
"user": None,
|
|
233
|
+
"metadata": {},
|
|
234
|
+
# Include the original response for backward compatibility
|
|
235
|
+
"response": {"choices": [{"message": assistant_msg, "finish_reason": "stop"}]},
|
|
236
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cua-agent
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.17
|
|
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.13,>=3.10
|
|
@@ -63,43 +63,13 @@ Description-Content-Type: text/markdown
|
|
|
63
63
|
|
|
64
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
65
|
|
|
66
|
-
|
|
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
|
-
)
|
|
66
|
+
> While our north star is to create a 1-click experience, this preview of Agent might be still a bit rough around the edges. We appreciate your patience as we work to improve the experience.
|
|
85
67
|
|
|
86
|
-
|
|
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
|
-
]
|
|
68
|
+
### Get started with Agent
|
|
95
69
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
async for result in agent.run(task):
|
|
100
|
-
print(result)
|
|
101
|
-
print(f"Task {i} completed")
|
|
102
|
-
```
|
|
70
|
+
<div align="center">
|
|
71
|
+
<img src="../../img/agent.png"/>
|
|
72
|
+
</div>
|
|
103
73
|
|
|
104
74
|
## Install
|
|
105
75
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
agent/README.md,sha256=8EFnLrKejthEcL9bZflQSbvA-KwpiPanBz8TEEwRub8,2153
|
|
2
|
+
agent/__init__.py,sha256=unuQyUFOh9nIJTkEtHhowtriY2nL-mn-qr4BXHNzXPo,1500
|
|
3
|
+
agent/core/README.md,sha256=VOXNVbR0ugxf9gCXYmZtUU2kngZhfi29haT_oSxK0Lk,3559
|
|
4
|
+
agent/core/__init__.py,sha256=Q6NGlyPha0kSOwxuGxN0uG-B9V_YOJhvewYvYhe22R0,503
|
|
5
|
+
agent/core/callbacks.py,sha256=VbGIf5QkHh3Q0KsLM6wv7hRdIA5WExTVYLm64bckyUA,4306
|
|
6
|
+
agent/core/computer_agent.py,sha256=2UvlO1mu5xl4Qu4lPE5m0nm88_ZN2lwmwTil7638EjQ,9697
|
|
7
|
+
agent/core/experiment.py,sha256=Ywj6q3JZFDKicfPuQsDl0vSN55HS7-Cnk3u3EcUCKe8,8866
|
|
8
|
+
agent/core/loop.py,sha256=Z85TRQvVmGi6rK57UtmzlkPim9usXqSmGvnAIVuSKcM,7474
|
|
9
|
+
agent/core/messages.py,sha256=-OVMDqcxK5MUHPEkHliK29XFJYMRAc1keFvzrUyrOmM,16231
|
|
10
|
+
agent/core/telemetry.py,sha256=HElPd32k_w2SJ6t-Cc3j_2-AKdLbFwh2YlM8QViDgRw,4790
|
|
11
|
+
agent/core/tools.py,sha256=Jes2CFCFqC727WWHbO-sG7V03rBHnQe5X7Oi9ZkuScI,877
|
|
12
|
+
agent/core/tools/__init__.py,sha256=xZen-PqUp2dUaMEHJowXCQm33_5Sxhsx9PSoD0rq6tI,489
|
|
13
|
+
agent/core/tools/base.py,sha256=CdzRFNuOjNfzgyTUN4ZoCGkUDR5HI0ECQVpvrUdEij8,2295
|
|
14
|
+
agent/core/tools/bash.py,sha256=jnJKVlHn8np8e0gWd8EO0_qqjMkfQzutSugA_Iol4jE,1585
|
|
15
|
+
agent/core/tools/collection.py,sha256=NuwTn6dXSyznxWodfmFDQwUlxxaGb4oBPym4AEJABSQ,1338
|
|
16
|
+
agent/core/tools/computer.py,sha256=lT_aW3huoYpcM8kffuokELupSz_WZG_qkaW1gITRC58,3892
|
|
17
|
+
agent/core/tools/edit.py,sha256=kv4jTKCM0VXrnoNErf7mT-xlr81-7T8v49_VA9y_L4Y,2005
|
|
18
|
+
agent/core/tools/manager.py,sha256=IRsCXjGc076nncQuyIjODoafnHTDhrf9sP5B4q5Pcdo,1742
|
|
19
|
+
agent/core/types.py,sha256=YKmEIUI26Ig_eGrvQzrjmNiAYSoHL7pJV4H8GlSs-Wg,924
|
|
20
|
+
agent/core/visualization.py,sha256=1DuFF5sSeSf5BRSevBMDxml9-ajl7BQLFm5KBUwMbI8,6573
|
|
21
|
+
agent/providers/__init__.py,sha256=b4tIBAaIB1V7p8V0BWipHVnMhfHH_OuVgP4OWGSHdD8,194
|
|
22
|
+
agent/providers/anthropic/__init__.py,sha256=Mj11IZnVshZ2iHkvg4Z5-jrQIaD1WvzDz2Zk_pMwqIA,149
|
|
23
|
+
agent/providers/anthropic/api/client.py,sha256=IVCntHAlkHFHPb6h4cEpb4wsBESy0wC6IPG8_Yydtqw,13258
|
|
24
|
+
agent/providers/anthropic/api/logging.py,sha256=vHpwkIyOZdkSTVIH4ycbBPd4a_rzhP7Osu1I-Ayouwc,5154
|
|
25
|
+
agent/providers/anthropic/api_handler.py,sha256=pWXcqDs0ruviDhRNRrz5Ac9ZH4yDv6ZlwpeG3a42cDg,5206
|
|
26
|
+
agent/providers/anthropic/callbacks/__init__.py,sha256=PciBb6Z6MKSwfXqDjU3pV_0FS4MOn_Np_A7_skD-6dA,104
|
|
27
|
+
agent/providers/anthropic/callbacks/manager.py,sha256=dRKN7MuBze2dLal0iHDxCKYqMdh_KShSphuwn7zC-c4,1878
|
|
28
|
+
agent/providers/anthropic/loop.py,sha256=1n0CmN7RTK85m3MSF4XuuTm9R9WYQ1_hxksD0keXJlA,20226
|
|
29
|
+
agent/providers/anthropic/messages/manager.py,sha256=6FobzAHh5-7dxaxbUdG1--1UY4w-mh3MFytX6ONrK3c,4972
|
|
30
|
+
agent/providers/anthropic/prompts.py,sha256=nHFfgPrfvnWrEdVP7EUBGUHAI85D2X9HeZirk9EwncU,1941
|
|
31
|
+
agent/providers/anthropic/response_handler.py,sha256=NvsCz3siCexU2e0aANuet83gNFIE7WCXNegBahsyfNU,8091
|
|
32
|
+
agent/providers/anthropic/tools/__init__.py,sha256=JyZwuVtPUnZwRSZBSCdQv9yxbLCsygm3l8Ywjjt9qTQ,661
|
|
33
|
+
agent/providers/anthropic/tools/base.py,sha256=WnRDbqO25tQzLpS2RU2ZXTLF5wd5IqU7SiyRAglQat4,2752
|
|
34
|
+
agent/providers/anthropic/tools/bash.py,sha256=QODuFjWuHM4GgGTqK2HizSyYqGqQwX70AdwrFiGSp2Q,2218
|
|
35
|
+
agent/providers/anthropic/tools/collection.py,sha256=RBK_6hxfHExR-EOxadiLl0OznmFj07nyIUjFgaYZ6Eo,960
|
|
36
|
+
agent/providers/anthropic/tools/computer.py,sha256=vYni1jDOOgzSSBOJxHcEKxvKUYRp5_nQ-9dmpGdLwm4,25858
|
|
37
|
+
agent/providers/anthropic/tools/edit.py,sha256=EGRP61MDA4Oue1D7Q-_vLpd6LdGbdBA1Z4HSZ66DbmI,13465
|
|
38
|
+
agent/providers/anthropic/tools/manager.py,sha256=yNvgTkfEqnOz5isDF0RxvmBMZB0uh2PipFEH-PUXpoY,2020
|
|
39
|
+
agent/providers/anthropic/tools/run.py,sha256=xhXdnBK1di9muaO44CEirL9hpGy3NmKbjfMpyeVmn8Y,1595
|
|
40
|
+
agent/providers/anthropic/types.py,sha256=SF00kOMC1ui8j9Ah56KaeiR2cL394qCHjFIsBpXxt5w,421
|
|
41
|
+
agent/providers/anthropic/utils.py,sha256=ZwMPKkietS1_1mbNHAKIKDieOQf7YPel6d0siw-3v08,14424
|
|
42
|
+
agent/providers/omni/__init__.py,sha256=59Eqpr3Nc3EE61VirUkfecAnQuGELdg0t44q5tg3SW8,172
|
|
43
|
+
agent/providers/omni/api_handler.py,sha256=7CpD43lYAqTyNKWfrD8XcM9ekbajqKCTH9p0TWtEQyg,1163
|
|
44
|
+
agent/providers/omni/clients/anthropic.py,sha256=nC_lj3UwrLqx9TIew58yxLqKwrH1_LwJD6EqVSEfp3g,3670
|
|
45
|
+
agent/providers/omni/clients/base.py,sha256=zAAgPi0jl3SWPC730R9l79E8bfYPSo39UtCSE-mrK6I,1076
|
|
46
|
+
agent/providers/omni/clients/openai.py,sha256=E4TAXMUFoYTunJETCWCNx5XAc6xutiN4rB6PlVpzC5s,5972
|
|
47
|
+
agent/providers/omni/clients/utils.py,sha256=Ani9CVVBm_J2Dl51WG6p1GVuoI6cq8scISrG0pmQ37o,688
|
|
48
|
+
agent/providers/omni/image_utils.py,sha256=wejhWb36yqedsPnLFTFwk2wth8a6txfVWSg4EaNrRdA,908
|
|
49
|
+
agent/providers/omni/loop.py,sha256=OauhnSEzDRIEi0VCOOHJGFlCsjVG64MKUH4-nHlGMWg,37459
|
|
50
|
+
agent/providers/omni/parser.py,sha256=REpQwlwvY1z_N8wbMj6GhOeTiiWVWHhVja_LOxgzbks,11734
|
|
51
|
+
agent/providers/omni/prompts.py,sha256=Mupjy0bUwBjcAeLXpE1r1jisYPSlhwsp-IXJKEKrEtw,3779
|
|
52
|
+
agent/providers/omni/tools/__init__.py,sha256=IC1cMEDoR2ljGcNNthzBRF_VtnDbRL5qvHJWErtNp98,774
|
|
53
|
+
agent/providers/omni/tools/base.py,sha256=HiQ8dp9NbFGlGopbE1wxo0ZbujA7bzCGjCg4tl2lnPE,824
|
|
54
|
+
agent/providers/omni/tools/bash.py,sha256=wocYvWwoaVjHba19CVqc3bvwj8_1qwqYjNaPBbMRlWA,2241
|
|
55
|
+
agent/providers/omni/tools/computer.py,sha256=cB5PrhPmk6acKSENIvzw4rdpjeWx4HQHfSxBLGHzGRE,6964
|
|
56
|
+
agent/providers/omni/tools/manager.py,sha256=GVLudHNpOQnl6aA_IOvqAEMDoKW62ozMZuwst6Z1Hco,2094
|
|
57
|
+
agent/providers/omni/types.py,sha256=IEZm3_EFXRJo3vz0CZTQW2mvDlYzAbH5cHhpEsumfaY,1002
|
|
58
|
+
agent/providers/omni/utils.py,sha256=Ikp6ONL1HO637o3KDtv5yv6q-4uIWAzMSQDvGetWXC8,8724
|
|
59
|
+
agent/telemetry.py,sha256=pVGxbj0ewnvq4EGj28CydN4a1iOfvZR_XKL3vIOqhOM,390
|
|
60
|
+
cua_agent-0.1.17.dist-info/METADATA,sha256=WSfFKKHA00ceKD1E76jloxtSkYwCZPeYyhhNM7UsXsM,3835
|
|
61
|
+
cua_agent-0.1.17.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
|
62
|
+
cua_agent-0.1.17.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
63
|
+
cua_agent-0.1.17.dist-info/RECORD,,
|