orgo 0.0.20__py3-none-any.whl → 0.0.22__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.
orgo/api/client.py CHANGED
@@ -1,4 +1,3 @@
1
- # src/orgo/api/client.py
2
1
  """API client for Orgo service"""
3
2
 
4
3
  import requests
@@ -43,7 +42,10 @@ class ApiClient:
43
42
  # Computer lifecycle methods
44
43
  def create_computer(self, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
45
44
  """Create a new project with desktop instance"""
46
- return self._request("POST", "projects", {"config": config} if config else None)
45
+ payload = {}
46
+ if config:
47
+ payload["config"] = config
48
+ return self._request("POST", "projects", payload if payload else None)
47
49
 
48
50
  def connect_computer(self, project_id: str) -> Dict[str, Any]:
49
51
  return self._request("GET", f"projects/by-name/{project_id}")
orgo/computer.py CHANGED
@@ -1,10 +1,9 @@
1
- # src/orgo/computer.py
2
1
  """Computer class for interacting with Orgo virtual environments"""
3
2
  import os
4
3
  import io
5
4
  import base64
6
5
  import logging
7
- from typing import Dict, List, Any, Optional, Callable
6
+ from typing import Dict, List, Any, Optional, Callable, Literal
8
7
  from PIL import Image
9
8
  import requests
10
9
  from requests.exceptions import RequestException
@@ -16,7 +15,14 @@ from .project import ProjectManager
16
15
  logger = logging.getLogger(__name__)
17
16
 
18
17
  class Computer:
19
- def __init__(self, project_id=None, api_key=None, config=None, base_api_url=None):
18
+ def __init__(self,
19
+ project_id: Optional[str] = None,
20
+ api_key: Optional[str] = None,
21
+ config: Optional[Dict[str, Any]] = None,
22
+ base_api_url: Optional[str] = None,
23
+ ram: Optional[Literal[2, 4]] = None,
24
+ memory: Optional[Literal[2, 4]] = None,
25
+ cpu: Optional[Literal[2, 4]] = None):
20
26
  """
21
27
  Initialize an Orgo virtual computer.
22
28
 
@@ -25,11 +31,20 @@ class Computer:
25
31
  api_key: Orgo API key (defaults to ORGO_API_KEY env var)
26
32
  config: Configuration for new computer (optional)
27
33
  base_api_url: Custom API URL (optional)
34
+ ram: RAM in GB for new computer (2 or 4) - only used when creating
35
+ memory: Alternative parameter for RAM in GB (2 or 4) - only used when creating
36
+ cpu: CPU cores for new computer (2 or 4) - only used when creating
37
+
38
+ Note: If both ram and memory are provided, ram takes precedence.
28
39
  """
29
40
  self.api_key = api_key or os.environ.get("ORGO_API_KEY")
30
41
  self.base_api_url = base_api_url
31
42
  self.api = ApiClient(self.api_key, self.base_api_url)
32
43
 
44
+ # Handle memory parameter as an alias for ram
45
+ if ram is None and memory is not None:
46
+ ram = memory
47
+
33
48
  # Look for a saved project ID if none was provided
34
49
  if project_id is None:
35
50
  project_id = ProjectManager.load_project_id()
@@ -38,14 +53,39 @@ class Computer:
38
53
  try:
39
54
  self.project_id = project_id
40
55
  self._info = self.api.connect_computer(project_id)
56
+ # Log if ram/memory/cpu were provided but ignored
57
+ if ram is not None or memory is not None or cpu is not None:
58
+ logger.info("Note: ram, memory, and cpu parameters are ignored when connecting to existing computer")
41
59
  except (RequestException, ValueError) as e:
42
60
  logger.warning(f"Could not connect to saved project {project_id}: {e}")
43
- self._create_new_computer(config)
61
+ self._create_new_computer(config, ram, cpu)
44
62
  else:
45
- self._create_new_computer(config)
63
+ self._create_new_computer(config, ram, cpu)
46
64
 
47
- def _create_new_computer(self, config=None):
65
+ def _create_new_computer(self, config: Optional[Dict[str, Any]] = None,
66
+ ram: Optional[Literal[2, 4]] = None,
67
+ cpu: Optional[Literal[2, 4]] = None):
48
68
  """Create a new computer instance and save its ID"""
69
+ # Validate ram and cpu values if provided
70
+ if ram is not None and ram not in [2, 4]:
71
+ raise ValueError("ram/memory must be either 2 or 4 GB")
72
+ if cpu is not None and cpu not in [2, 4]:
73
+ raise ValueError("cpu must be either 2 or 4 cores")
74
+
75
+ # Build the config with ram and cpu if provided
76
+ if ram is not None or cpu is not None:
77
+ if config is None:
78
+ config = {}
79
+ else:
80
+ # Make a copy to avoid modifying the original
81
+ config = config.copy()
82
+
83
+ # Add ram and cpu to config
84
+ if ram is not None:
85
+ config['ram'] = ram
86
+ if cpu is not None:
87
+ config['cpu'] = cpu
88
+
49
89
  response = self.api.create_computer(config)
50
90
  self.project_id = response.get("name")
51
91
  self._info = response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orgo
3
- Version: 0.0.20
3
+ Version: 0.0.22
4
4
  Summary: Computers for AI agents
5
5
  Author: Orgo Team
6
6
  License: MIT
@@ -1,12 +1,12 @@
1
1
  orgo/__init__.py,sha256=TlOzDJqRKotAam631MdZcz8ypAqyWrLo-Px8HWLkrD0,131
2
- orgo/computer.py,sha256=zp5cqkaSHHMIUTg04VfpUunlSPLKDrzlOPrUToxVQhw,9410
2
+ orgo/computer.py,sha256=AD9k9DijHnu-wIwu4p3nPasgsQBRqdrHCtbvUyDjUaE,11390
3
3
  orgo/project.py,sha256=F90mYJKRZAoFSFw8HVAiosMoLyzVlf0QaKJgTyXoJ4A,2267
4
4
  orgo/prompt.py,sha256=ynblwXPTDp_aF1MbGBsY0PIEr9naklDaKFcfSE_EZ6E,19781
5
5
  orgo/api/__init__.py,sha256=9Tzb_OPJ5DH7Cg7OrHzpZZUT4ip05alpa9RLDYmnId8,113
6
- orgo/api/client.py,sha256=mCm1m_8k3DCCYSM0JvY29BI6HHlH0PjVXNnENHhvMvU,5799
6
+ orgo/api/client.py,sha256=0pXH69jVwNvtmw2VdFcqkgFpkZANt8O5BjewULOcmJc,5843
7
7
  orgo/utils/__init__.py,sha256=W4G_nwGBf_7jy0w_mfcrkllurYHSRU4B5cMTVYH_uCc,123
8
8
  orgo/utils/auth.py,sha256=tPLBJY-6gdBQWLUjUbwIwxHphC3KoRT_XgP3Iykw3Mw,509
9
- orgo-0.0.20.dist-info/METADATA,sha256=3dT1Vy4T4bcQ9RxOb1fqo-dVYCFCSnMcQ8aT7wQvEgo,822
10
- orgo-0.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- orgo-0.0.20.dist-info/top_level.txt,sha256=q0rYtFji8GbYuhFW8A5Ab9e0j27761IKPhnL0E9xow4,5
12
- orgo-0.0.20.dist-info/RECORD,,
9
+ orgo-0.0.22.dist-info/METADATA,sha256=cvlBaNACC6-VaF1PPtwdyBaBRd6q52vNmUGKGlxBXfs,822
10
+ orgo-0.0.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ orgo-0.0.22.dist-info/top_level.txt,sha256=q0rYtFji8GbYuhFW8A5Ab9e0j27761IKPhnL0E9xow4,5
12
+ orgo-0.0.22.dist-info/RECORD,,
File without changes