asteroid-odyssey 1.0.2__tar.gz → 1.0.3__tar.gz

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.
Files changed (48) hide show
  1. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/PKG-INFO +1 -1
  2. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/pyproject.toml +1 -1
  3. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/client.py +29 -11
  4. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey.egg-info/PKG-INFO +1 -1
  5. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/README.md +0 -0
  6. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/setup.cfg +0 -0
  7. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/__init__.py +0 -0
  8. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/__init__.py +0 -0
  9. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api/__init__.py +0 -0
  10. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api/api_api.py +0 -0
  11. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api/execution_api.py +0 -0
  12. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api/sdk_api.py +0 -0
  13. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api_client.py +0 -0
  14. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/api_response.py +0 -0
  15. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/configuration.py +0 -0
  16. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/exceptions.py +0 -0
  17. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/__init__.py +0 -0
  18. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/browser_session_recording_response.py +0 -0
  19. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/error_response.py +0 -0
  20. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/execution_response.py +0 -0
  21. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/execution_result.py +0 -0
  22. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/execution_result_response.py +0 -0
  23. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/execution_status_response.py +0 -0
  24. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/health_check200_response.py +0 -0
  25. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/health_check500_response.py +0 -0
  26. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/status.py +0 -0
  27. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/structured_agent_execution_request.py +0 -0
  28. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/models/upload_execution_files200_response.py +0 -0
  29. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/py.typed +0 -0
  30. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey/openapi_client/rest.py +0 -0
  31. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey.egg-info/SOURCES.txt +0 -0
  32. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey.egg-info/dependency_links.txt +0 -0
  33. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey.egg-info/requires.txt +0 -0
  34. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/src/asteroid_odyssey.egg-info/top_level.txt +0 -0
  35. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_api_api.py +0 -0
  36. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_browser_session_recording_response.py +0 -0
  37. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_error_response.py +0 -0
  38. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_execution_api.py +0 -0
  39. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_execution_response.py +0 -0
  40. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_execution_result.py +0 -0
  41. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_execution_result_response.py +0 -0
  42. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_execution_status_response.py +0 -0
  43. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_health_check200_response.py +0 -0
  44. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_health_check500_response.py +0 -0
  45. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_sdk_api.py +0 -0
  46. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_status.py +0 -0
  47. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_structured_agent_execution_request.py +0 -0
  48. {asteroid_odyssey-1.0.2 → asteroid_odyssey-1.0.3}/test/test_upload_execution_files200_response.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asteroid-odyssey
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A Python SDK for browser automation using Asteroid platform.
5
5
  Author-email: David Mlcoch <founders@asteroid.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "asteroid-odyssey"
3
- version = "1.0.2"
3
+ version = "1.0.3"
4
4
  authors = [
5
5
  { name = "David Mlcoch", email = "founders@asteroid.com" },
6
6
  ]
@@ -10,6 +10,7 @@ without modifying any generated files.
10
10
 
11
11
  import time
12
12
  import os
13
+ import logging
13
14
  from typing import Dict, Any, Optional, List, Union, Tuple
14
15
  from .openapi_client import (
15
16
  Configuration,
@@ -58,14 +59,14 @@ class AsteroidClient:
58
59
  self.sdk_api = SDKApi(self.api_client)
59
60
  self.execution_api = ExecutionApi(self.api_client)
60
61
 
61
- def execute_agent(self, agent_id: str, execution_data: Dict[str, Any]) -> str:
62
+ def execute_agent(self, agent_id: str, execution_data: Dict[str, Any], agent_profile_id: Optional[str] = None) -> str:
62
63
  """
63
64
  Execute an agent with the provided parameters.
64
65
 
65
66
  Args:
66
67
  agent_id: The ID of the agent to execute
67
- agent_profile_id: The ID of the agent profile
68
68
  execution_data: The execution parameters
69
+ agent_profile_id: Optional ID of the agent profile
69
70
 
70
71
  Returns:
71
72
  The execution ID
@@ -74,9 +75,12 @@ class AsteroidClient:
74
75
  Exception: If the execution request fails
75
76
 
76
77
  Example:
77
- execution_id = client.execute_structured_agent('my-agent-id', 'agent-profile-id', {'input': 'some dynamic value'})
78
+ execution_id = client.execute_agent('my-agent-id', {'input': 'some dynamic value'}, 'agent-profile-id')
78
79
  """
79
- req = StructuredAgentExecutionRequest(dynamic_data=execution_data)
80
+ req = StructuredAgentExecutionRequest(
81
+ dynamic_data=execution_data,
82
+ agent_profile_id=agent_profile_id
83
+ )
80
84
  try:
81
85
  response = self.sdk_api.execute_agent_structured(agent_id, req)
82
86
  return response.execution_id
@@ -278,9 +282,23 @@ class AsteroidClient:
278
282
  """Context manager entry."""
279
283
  return self
280
284
 
281
- def __exit__(self, exc_type, exc_value, traceback):
282
- """Context manager exit."""
283
- pass
285
+ def __exit__(self, exc_type, exc_value, tb):
286
+ """Context manager exit: clean up API client connection pool."""
287
+ try:
288
+ # Try to grab the pool_manager; if any attr is missing, skip
289
+ try:
290
+ pool_manager = self.api_client.rest_client.pool_manager
291
+ except AttributeError:
292
+ pool_manager = None
293
+
294
+ if pool_manager:
295
+ pool_manager.clear()
296
+ except Exception as e:
297
+ # Log but don't mask the original exception (if any)
298
+ logging.warning("Failed to clear connection pool: %s", e)
299
+
300
+ # Returning False allows any exception in the 'with' block to propagate
301
+ return False
284
302
 
285
303
 
286
304
  # Convenience functions that mirror the TypeScript SDK pattern
@@ -302,23 +320,23 @@ def create_client(api_key: str, base_url: Optional[str] = None) -> AsteroidClien
302
320
  """
303
321
  return AsteroidClient(api_key, base_url)
304
322
 
305
- def execute_agent(client: AsteroidClient, agent_id: str, agent_profile_id: str, execution_data: Dict[str, Any]) -> str:
323
+ def execute_agent(client: AsteroidClient, agent_id: str, execution_data: Dict[str, Any], agent_profile_id: Optional[str] = None) -> str:
306
324
  """
307
325
  Execute an agent with the provided parameters.
308
326
 
309
327
  Args:
310
328
  client: The AsteroidClient instance
311
329
  agent_id: The ID of the agent to execute
312
- agent_profile_id: The ID of the agent profile
313
330
  execution_data: The execution parameters
331
+ agent_profile_id: Optional ID of the agent profile
314
332
 
315
333
  Returns:
316
334
  The execution ID
317
335
 
318
336
  Example:
319
- execution_id = execute_agent(client, 'my-agent-id', {'input': 'some dynamic value'})
337
+ execution_id = execute_agent(client, 'my-agent-id', {'input': 'some dynamic value'}, 'agent-profile-id')
320
338
  """
321
- return client.execute_agent(agent_id, agent_profile_id, execution_data)
339
+ return client.execute_agent(agent_id, execution_data, agent_profile_id)
322
340
 
323
341
 
324
342
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asteroid-odyssey
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A Python SDK for browser automation using Asteroid platform.
5
5
  Author-email: David Mlcoch <founders@asteroid.com>
6
6
  License-Expression: MIT