e2b 2.52.1__tar.gz → 2.55.0__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 (247) hide show
  1. {e2b-2.52.1 → e2b-2.55.0}/PKG-INFO +2 -2
  2. {e2b-2.52.1 → e2b-2.55.0}/e2b/__init__.py +8 -0
  3. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/__init__.py +15 -41
  4. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates.py +8 -4
  5. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_v2_templates.py +8 -4
  6. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/error.py +1 -1
  7. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_snapshot_request.py +12 -0
  8. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_request_v3.py +1 -1
  9. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client_async/__init__.py +36 -12
  10. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client_sync/__init__.py +36 -12
  11. {e2b-2.52.1 → e2b-2.55.0}/e2b/connection_config.py +2 -14
  12. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/api.py +72 -38
  13. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/filesystem/filesystem_pb.py +11 -3
  14. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/rpc.py +70 -17
  15. {e2b-2.52.1 → e2b-2.55.0}/e2b/exceptions.py +75 -3
  16. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/filesystem/filesystem.py +3 -1
  17. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/sandbox_api.py +99 -43
  18. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/commands/command.py +28 -29
  19. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/commands/command_handle.py +3 -3
  20. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/commands/pty.py +9 -1
  21. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/filesystem/filesystem.py +24 -17
  22. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/main.py +35 -5
  23. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/sandbox_api.py +15 -61
  24. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/commands/command.py +31 -25
  25. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/commands/command_handle.py +3 -3
  26. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/commands/pty.py +9 -1
  27. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/filesystem/filesystem.py +32 -17
  28. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/main.py +35 -5
  29. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/sandbox_api.py +15 -61
  30. e2b-2.55.0/e2b/template/dockerfile_parser.py +634 -0
  31. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/main.py +2 -2
  32. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/utils.py +9 -5
  33. {e2b-2.52.1 → e2b-2.55.0}/pyproject.toml +5 -2
  34. e2b-2.52.1/e2b/template/dockerfile_parser.py +0 -286
  35. e2b-2.52.1/e2b/template/dockerignore.py +0 -206
  36. {e2b-2.52.1 → e2b-2.55.0}/README.md +0 -0
  37. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/__init__.py +0 -0
  38. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/__init__.py +0 -0
  39. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/__init__.py +0 -0
  40. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +0 -0
  41. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_sandboxes.py +0 -0
  42. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py +0 -0
  43. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +0 -0
  44. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +0 -0
  45. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +0 -0
  46. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_v2_sandboxes.py +0 -0
  47. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/get_v_2_sandboxes_sandbox_id_logs.py +0 -0
  48. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes.py +0 -0
  49. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +0 -0
  50. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_fork.py +0 -0
  51. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +0 -0
  52. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +0 -0
  53. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +0 -0
  54. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_snapshots.py +0 -0
  55. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +0 -0
  56. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_v2_sandboxes.py +0 -0
  57. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/post_v_2_sandboxes_sandbox_id_connect.py +0 -0
  58. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/sandboxes/put_sandboxes_sandbox_id_network.py +0 -0
  59. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/__init__.py +0 -0
  60. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/delete_secrets_secret_id.py +0 -0
  61. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/get_secrets.py +0 -0
  62. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/get_secrets_secret_id.py +0 -0
  63. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/post_secrets.py +0 -0
  64. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/secrets/post_secrets_secret_id.py +0 -0
  65. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/snapshots/__init__.py +0 -0
  66. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/snapshots/get_snapshots.py +0 -0
  67. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/tags/__init__.py +0 -0
  68. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/tags/delete_templates_tags.py +0 -0
  69. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/tags/get_templates_template_id_tags.py +0 -0
  70. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/tags/post_templates_tags.py +0 -0
  71. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/__init__.py +0 -0
  72. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/delete_templates_template_id.py +0 -0
  73. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates_aliases_alias.py +0 -0
  74. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates_template_id.py +0 -0
  75. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +0 -0
  76. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +0 -0
  77. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/get_templates_template_id_files_hash.py +0 -0
  78. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/patch_templates_template_id.py +0 -0
  79. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/patch_v_2_templates_template_id.py +0 -0
  80. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/post_v3_templates.py +0 -0
  81. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +0 -0
  82. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/volumes/__init__.py +0 -0
  83. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/volumes/delete_volumes_volume_id.py +0 -0
  84. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/volumes/get_volumes.py +0 -0
  85. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/volumes/get_volumes_volume_id.py +0 -0
  86. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/api/volumes/post_volumes.py +0 -0
  87. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/client.py +0 -0
  88. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/errors.py +0 -0
  89. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/__init__.py +0 -0
  90. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/assign_template_tags_request.py +0 -0
  91. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/assigned_template_tags.py +0 -0
  92. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/aws_registry.py +0 -0
  93. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/aws_registry_type.py +0 -0
  94. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/build_log_entry.py +0 -0
  95. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/build_status_reason.py +0 -0
  96. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/connect_sandbox.py +0 -0
  97. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/connect_sandbox_v2.py +0 -0
  98. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/delete_template_tags_request.py +0 -0
  99. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/gcp_registry.py +0 -0
  100. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/gcp_registry_type.py +0 -0
  101. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/general_registry.py +0 -0
  102. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/general_registry_type.py +0 -0
  103. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/listed_sandbox.py +0 -0
  104. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/log_level.py +0 -0
  105. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/logs_direction.py +0 -0
  106. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/logs_source.py +0 -0
  107. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/mcp_type_0.py +0 -0
  108. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/new_sandbox.py +0 -0
  109. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/new_sandbox_v2.py +0 -0
  110. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/new_secret.py +0 -0
  111. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/new_volume.py +0 -0
  112. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/order_direction.py +0 -0
  113. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/resumed_sandbox.py +0 -0
  114. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox.py +0 -0
  115. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_auto_resume_config.py +0 -0
  116. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_detail.py +0 -0
  117. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_egress_proxy_config_type_0.py +0 -0
  118. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_fork_request.py +0 -0
  119. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_fork_result.py +0 -0
  120. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_iam.py +0 -0
  121. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_iam_token.py +0 -0
  122. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_iam_tokens.py +0 -0
  123. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_lifecycle.py +0 -0
  124. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_log.py +0 -0
  125. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_log_entry.py +0 -0
  126. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_log_entry_fields.py +0 -0
  127. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_logs.py +0 -0
  128. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_logs_v2_response.py +0 -0
  129. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_metric.py +0 -0
  130. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_config.py +0 -0
  131. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_config_rules.py +0 -0
  132. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_rule.py +0 -0
  133. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_transform.py +0 -0
  134. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_transform_headers.py +0 -0
  135. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_update_config.py +0 -0
  136. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_network_update_config_rules.py +0 -0
  137. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_on_timeout.py +0 -0
  138. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_pause_request.py +0 -0
  139. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_refresh_request.py +0 -0
  140. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_state.py +0 -0
  141. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_timeout_request.py +0 -0
  142. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandbox_volume_mount.py +0 -0
  143. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/sandboxes_with_metrics.py +0 -0
  144. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/secret.py +0 -0
  145. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/secret_metadata.py +0 -0
  146. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/secret_update.py +0 -0
  147. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/snapshot_info.py +0 -0
  148. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/team_user.py +0 -0
  149. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template.py +0 -0
  150. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_alias_response.py +0 -0
  151. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build.py +0 -0
  152. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_file_upload.py +0 -0
  153. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_file_upload_headers.py +0 -0
  154. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_info.py +0 -0
  155. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_logs_response.py +0 -0
  156. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_start_v2.py +0 -0
  157. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_build_status.py +0 -0
  158. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_request_response_v3.py +0 -0
  159. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_step.py +0 -0
  160. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_tag.py +0 -0
  161. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_update_request.py +0 -0
  162. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_update_response.py +0 -0
  163. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/template_with_builds.py +0 -0
  164. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/volume.py +0 -0
  165. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/models/volume_and_token.py +0 -0
  166. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/py.typed +0 -0
  167. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/client/types.py +0 -0
  168. {e2b-2.52.1 → e2b-2.55.0}/e2b/api/metadata.py +0 -0
  169. {e2b-2.52.1 → e2b-2.55.0}/e2b/client.py +0 -0
  170. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/__init__.py +0 -0
  171. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/client_async/__init__.py +0 -0
  172. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/client_shared.py +0 -0
  173. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/client_sync/__init__.py +0 -0
  174. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/filesystem/__init__.py +0 -0
  175. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/filesystem/filesystem_connect.py +0 -0
  176. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/interceptors.py +0 -0
  177. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/process/__init__.py +0 -0
  178. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/process/process_connect.py +0 -0
  179. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/process/process_pb.py +0 -0
  180. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/utils.py +0 -0
  181. {e2b-2.52.1 → e2b-2.55.0}/e2b/envd/versions.py +0 -0
  182. {e2b-2.52.1 → e2b-2.55.0}/e2b/io_utils.py +0 -0
  183. {e2b-2.52.1 → e2b-2.55.0}/e2b/paginator.py +0 -0
  184. {e2b-2.52.1 → e2b-2.55.0}/e2b/py.typed +0 -0
  185. {e2b-2.52.1 → e2b-2.55.0}/e2b/retry.py +0 -0
  186. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/__init__.py +0 -0
  187. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/args.py +0 -0
  188. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/auth.py +0 -0
  189. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/config.py +0 -0
  190. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/parse.py +0 -0
  191. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/_git/types.py +0 -0
  192. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/commands/command_handle.py +0 -0
  193. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/commands/main.py +0 -0
  194. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/filesystem/watch_handle.py +0 -0
  195. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/iam.py +0 -0
  196. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/main.py +0 -0
  197. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/mcp.py +0 -0
  198. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/network.py +0 -0
  199. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/signature.py +0 -0
  200. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox/utils.py +0 -0
  201. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/filesystem/watch_handle.py +0 -0
  202. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/git.py +0 -0
  203. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/paginator.py +0 -0
  204. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_async/utils.py +0 -0
  205. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_domains.py +0 -0
  206. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/filesystem/watch_handle.py +0 -0
  207. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/git.py +0 -0
  208. {e2b-2.52.1 → e2b-2.55.0}/e2b/sandbox_sync/paginator.py +0 -0
  209. {e2b-2.52.1 → e2b-2.55.0}/e2b/secret/__init__.py +0 -0
  210. {e2b-2.52.1 → e2b-2.55.0}/e2b/secret/base.py +0 -0
  211. {e2b-2.52.1 → e2b-2.55.0}/e2b/secret/secret_async.py +0 -0
  212. {e2b-2.52.1 → e2b-2.55.0}/e2b/secret/secret_sync.py +0 -0
  213. {e2b-2.52.1 → e2b-2.55.0}/e2b/secret/types.py +0 -0
  214. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/consts.py +0 -0
  215. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/logger.py +0 -0
  216. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/readycmd.py +0 -0
  217. {e2b-2.52.1 → e2b-2.55.0}/e2b/template/types.py +0 -0
  218. {e2b-2.52.1 → e2b-2.55.0}/e2b/template_async/build_api.py +0 -0
  219. {e2b-2.52.1 → e2b-2.55.0}/e2b/template_async/main.py +0 -0
  220. {e2b-2.52.1 → e2b-2.55.0}/e2b/template_sync/build_api.py +0 -0
  221. {e2b-2.52.1 → e2b-2.55.0}/e2b/template_sync/main.py +0 -0
  222. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/__init__.py +0 -0
  223. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/__init__.py +0 -0
  224. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/__init__.py +0 -0
  225. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/delete_volumecontent_volume_id_path.py +0 -0
  226. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_dir.py +0 -0
  227. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_file.py +0 -0
  228. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/get_volumecontent_volume_id_path.py +0 -0
  229. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/patch_volumecontent_volume_id_path.py +0 -0
  230. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/post_volumecontent_volume_id_dir.py +0 -0
  231. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/api/volumes/put_volumecontent_volume_id_file.py +0 -0
  232. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/client.py +0 -0
  233. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/errors.py +0 -0
  234. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/models/__init__.py +0 -0
  235. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/models/error.py +0 -0
  236. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/models/patch_volumecontent_volume_id_path_body.py +0 -0
  237. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/models/volume_entry_stat.py +0 -0
  238. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/models/volume_entry_stat_type.py +0 -0
  239. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/py.typed +0 -0
  240. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client/types.py +0 -0
  241. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client_async/__init__.py +0 -0
  242. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/client_sync/__init__.py +0 -0
  243. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/connection_config.py +0 -0
  244. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/types.py +0 -0
  245. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/utils.py +0 -0
  246. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/volume_async.py +0 -0
  247. {e2b-2.52.1 → e2b-2.55.0}/e2b/volume/volume_sync.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: e2b
3
- Version: 2.52.1
3
+ Version: 2.55.0
4
4
  Summary: E2B SDK that give agents cloud environments
5
5
  Author: e2b
6
6
  Author-email: e2b <hello@e2b.dev>
@@ -13,10 +13,10 @@ Requires-Dist: h2>=4.4.1,<5
13
13
  Requires-Dist: attrs>=23.2.0
14
14
  Requires-Dist: packaging>=24.1
15
15
  Requires-Dist: typing-extensions>=4.10.0
16
- Requires-Dist: dockerfile-parse>=2.0.1,<3
17
16
  Requires-Dist: rich>=14.0.0
18
17
  Requires-Dist: connectrpc>=0.11.1,<0.12
19
18
  Requires-Dist: pyqwest>=0.10.0,<0.11
19
+ Requires-Dist: e2b-dockerfile-utils>=0.1.0,<0.2
20
20
  Requires-Python: >=3.10
21
21
  Project-URL: Homepage, https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=package_homepage&utm_content=e2b
22
22
  Project-URL: Repository, https://github.com/e2b-dev/e2b/tree/main/packages/python-sdk
@@ -51,6 +51,8 @@ from .exceptions import (
51
51
  ServiceBusyException,
52
52
  SandboxException,
53
53
  SandboxNotFoundException,
54
+ SandboxNotRunningException,
55
+ SandboxUnreachableException,
54
56
  TemplateException,
55
57
  TimeoutException,
56
58
  VolumeException,
@@ -107,6 +109,7 @@ from .sandbox.sandbox_api import (
107
109
  SandboxQuery,
108
110
  SandboxState,
109
111
  SnapshotInfo,
112
+ SnapshotMode,
110
113
  )
111
114
  from .sandbox_async.commands.command_handle import AsyncCommandHandle
112
115
  from .sandbox_async.filesystem.watch_handle import AsyncWatchHandle
@@ -131,6 +134,7 @@ from .template.logger import (
131
134
  LogEntryStart,
132
135
  default_build_logger,
133
136
  )
137
+ from .template.dockerfile_parser import DockerfileSyntaxError
134
138
  from .template.main import TemplateBase, TemplateClass
135
139
  from .template.readycmd import (
136
140
  ReadyCmd,
@@ -184,12 +188,15 @@ __all__ = [
184
188
  "NotFoundException",
185
189
  "FileNotFoundException",
186
190
  "SandboxNotFoundException",
191
+ "SandboxNotRunningException",
192
+ "SandboxUnreachableException",
187
193
  "AuthenticationException",
188
194
  "GitAuthException",
189
195
  "GitUpstreamException",
190
196
  "InvalidArgumentException",
191
197
  "NotEnoughSpaceException",
192
198
  "TemplateException",
199
+ "DockerfileSyntaxError",
193
200
  "BuildException",
194
201
  "FileUploadException",
195
202
  "RateLimitException",
@@ -253,6 +260,7 @@ __all__ = [
253
260
  "SecretNotFoundException",
254
261
  # Snapshot
255
262
  "SnapshotInfo",
263
+ "SnapshotMode",
256
264
  "SnapshotPaginator",
257
265
  "AsyncSnapshotPaginator",
258
266
  # Signature
@@ -47,58 +47,40 @@ def encode_path_param(value: str) -> str:
47
47
  return quote(value, safe="")
48
48
 
49
49
 
50
- def make_logging_event_hooks(
51
- log: Optional[logging.Logger], include_diagnostics: bool = False
52
- ) -> dict:
50
+ def make_logging_event_hooks(log: Optional[logging.Logger]) -> dict:
53
51
  """Build synchronous httpx ``event_hooks`` that log requests and responses
54
52
  to the given ``logging.Logger``. Requests log at ``INFO``, successful
55
53
  responses at ``INFO`` and responses with status >= 400 at ``ERROR``.
56
54
 
57
- Returns no hooks when ``log`` is ``None`` unless CI diagnostics are enabled;
58
- that mode logs failed responses only."""
59
- if log is None and not include_diagnostics:
55
+ Returns no hooks when ``log`` is ``None`` so that nothing is logged unless a
56
+ logger was explicitly supplied."""
57
+ if log is None:
60
58
  return {}
61
59
 
62
- response_log = log or logging.getLogger("e2b.ci")
63
-
64
60
  def on_request(request) -> None:
65
- if log is not None:
66
- log.info(f"Request {request.method} {request.url}")
61
+ log.info(f"Request {request.method} {request.url}")
67
62
 
68
63
  def on_response(response: Response) -> None:
69
64
  if response.status_code >= 400:
70
- trace_id = (
71
- response.headers.get("X-E2B-Trace-ID") if include_diagnostics else None
72
- )
73
- trace_suffix = f" trace_id={trace_id}" if trace_id else ""
74
- response_log.error(f"Response {response.status_code}{trace_suffix}")
75
- elif log is not None:
65
+ log.error(f"Response {response.status_code}")
66
+ else:
76
67
  log.info(f"Response {response.status_code}")
77
68
 
78
69
  return {"request": [on_request], "response": [on_response]}
79
70
 
80
71
 
81
- def make_async_logging_event_hooks(
82
- log: Optional[logging.Logger], include_diagnostics: bool = False
83
- ) -> dict:
72
+ def make_async_logging_event_hooks(log: Optional[logging.Logger]) -> dict:
84
73
  """Asynchronous counterpart of :func:`make_logging_event_hooks`."""
85
- if log is None and not include_diagnostics:
74
+ if log is None:
86
75
  return {}
87
76
 
88
- response_log = log or logging.getLogger("e2b.ci")
89
-
90
77
  async def on_request(request) -> None:
91
- if log is not None:
92
- log.info(f"Request {request.method} {request.url}")
78
+ log.info(f"Request {request.method} {request.url}")
93
79
 
94
80
  async def on_response(response: Response) -> None:
95
81
  if response.status_code >= 400:
96
- trace_id = (
97
- response.headers.get("X-E2B-Trace-ID") if include_diagnostics else None
98
- )
99
- trace_suffix = f" trace_id={trace_id}" if trace_id else ""
100
- response_log.error(f"Response {response.status_code}{trace_suffix}")
101
- elif log is not None:
82
+ log.error(f"Response {response.status_code}")
83
+ else:
102
84
  log.info(f"Response {response.status_code}")
103
85
 
104
86
  return {"request": [on_request], "response": [on_response]}
@@ -297,10 +279,7 @@ def handle_api_exception(
297
279
  return err
298
280
 
299
281
  return api_exception_from_code(
300
- e.status_code,
301
- message,
302
- default_exception_class,
303
- stack_trace,
282
+ e.status_code, message, default_exception_class, stack_trace
304
283
  )
305
284
 
306
285
 
@@ -343,7 +322,6 @@ class ApiClient(AuthenticatedClient):
343
322
  prefix = ""
344
323
 
345
324
  self._logger = config.logger
346
- self._include_diagnostics = config.request_source == "ci"
347
325
 
348
326
  headers = {
349
327
  **default_headers,
@@ -384,14 +362,10 @@ class ApiClient(AuthenticatedClient):
384
362
  )
385
363
 
386
364
  def _logging_event_hooks(self) -> dict:
387
- return make_logging_event_hooks(
388
- self._logger, include_diagnostics=self._include_diagnostics
389
- )
365
+ return make_logging_event_hooks(self._logger)
390
366
 
391
367
 
392
368
  # We need to override the logging hooks for the async usage
393
369
  class AsyncApiClient(ApiClient):
394
370
  def _logging_event_hooks(self) -> dict:
395
- return make_async_logging_event_hooks(
396
- self._logger, include_diagnostics=self._include_diagnostics
397
- )
371
+ return make_async_logging_event_hooks(self._logger)
@@ -80,7 +80,8 @@ def sync_detailed(
80
80
  List all templates
81
81
 
82
82
  Args:
83
- team_id (Union[Unset, str]): Identifier of the team
83
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
84
+ (prj_)
84
85
 
85
86
  Raises:
86
87
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -111,7 +112,8 @@ def sync(
111
112
  List all templates
112
113
 
113
114
  Args:
114
- team_id (Union[Unset, str]): Identifier of the team
115
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
116
+ (prj_)
115
117
 
116
118
  Raises:
117
119
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -137,7 +139,8 @@ async def asyncio_detailed(
137
139
  List all templates
138
140
 
139
141
  Args:
140
- team_id (Union[Unset, str]): Identifier of the team
142
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
143
+ (prj_)
141
144
 
142
145
  Raises:
143
146
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -166,7 +169,8 @@ async def asyncio(
166
169
  List all templates
167
170
 
168
171
  Args:
169
- team_id (Union[Unset, str]): Identifier of the team
172
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
173
+ (prj_)
170
174
 
171
175
  Raises:
172
176
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -96,7 +96,8 @@ def sync_detailed(
96
96
  List all templates
97
97
 
98
98
  Args:
99
- team_id (Union[Unset, str]): Identifier of the team
99
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
100
+ (prj_)
100
101
  next_token (Union[Unset, str]):
101
102
  limit (Union[Unset, int]): Default: 100.
102
103
 
@@ -133,7 +134,8 @@ def sync(
133
134
  List all templates
134
135
 
135
136
  Args:
136
- team_id (Union[Unset, str]): Identifier of the team
137
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
138
+ (prj_)
137
139
  next_token (Union[Unset, str]):
138
140
  limit (Union[Unset, int]): Default: 100.
139
141
 
@@ -165,7 +167,8 @@ async def asyncio_detailed(
165
167
  List all templates
166
168
 
167
169
  Args:
168
- team_id (Union[Unset, str]): Identifier of the team
170
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
171
+ (prj_)
169
172
  next_token (Union[Unset, str]):
170
173
  limit (Union[Unset, int]): Default: 100.
171
174
 
@@ -200,7 +203,8 @@ async def asyncio(
200
203
  List all templates
201
204
 
202
205
  Args:
203
- team_id (Union[Unset, str]): Identifier of the team
206
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID
207
+ (prj_)
204
208
  next_token (Union[Unset, str]):
205
209
  limit (Union[Unset, int]): Default: 100.
206
210
 
@@ -17,7 +17,7 @@ class Error:
17
17
  message (str): Error
18
18
  error_code (Union[Unset, str]): Machine-readable semantic error code. Not a closed set; initial values:
19
19
  sandbox_capacity_unavailable, sandbox_placement_timeout, sandbox_no_compatible_node, sandbox_create_failed,
20
- internal_server_error.
20
+ internal_server_error, secret_limit_reached.
21
21
  """
22
22
 
23
23
  code: int
@@ -15,19 +15,28 @@ class SandboxSnapshotRequest:
15
15
  Attributes:
16
16
  name (Union[Unset, str]): Optional name for the snapshot template. If a snapshot template with this name already
17
17
  exists, a new build will be assigned to the existing template instead of creating a new one.
18
+ memory (Union[Unset, bool]): Whether to capture a full memory snapshot. When false, only the filesystem is
19
+ persisted: the snapshot is smaller and faster to take, and sandboxes created from it cold-boot (start fresh from
20
+ disk) instead of restoring memory, so they begin without the source sandbox's running processes, in-memory
21
+ state, and open connections. The source sandbox keeps running in both cases. Defaults to true.
18
22
  """
19
23
 
20
24
  name: Union[Unset, str] = UNSET
25
+ memory: Union[Unset, bool] = UNSET
21
26
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
22
27
 
23
28
  def to_dict(self) -> dict[str, Any]:
24
29
  name = self.name
25
30
 
31
+ memory = self.memory
32
+
26
33
  field_dict: dict[str, Any] = {}
27
34
  field_dict.update(self.additional_properties)
28
35
  field_dict.update({})
29
36
  if name is not UNSET:
30
37
  field_dict["name"] = name
38
+ if memory is not UNSET:
39
+ field_dict["memory"] = memory
31
40
 
32
41
  return field_dict
33
42
 
@@ -36,8 +45,11 @@ class SandboxSnapshotRequest:
36
45
  d = dict(src_dict)
37
46
  name = d.pop("name", UNSET)
38
47
 
48
+ memory = d.pop("memory", UNSET)
49
+
39
50
  sandbox_snapshot_request = cls(
40
51
  name=name,
52
+ memory=memory,
41
53
  )
42
54
 
43
55
  sandbox_snapshot_request.additional_properties = d
@@ -17,7 +17,7 @@ class TemplateBuildRequestV3:
17
17
  "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array.
18
18
  tags (Union[Unset, list[str]]): Tags to assign to the template build
19
19
  alias (Union[Unset, str]): Alias of the template. Deprecated, use name instead.
20
- team_id (Union[Unset, str]): Identifier of the team
20
+ team_id (Union[Unset, str]): Identifier of the team, as its UUID or its public project ID (prj_)
21
21
  cpu_count (Union[Unset, int]): CPU cores for the sandbox
22
22
  memory_mb (Union[Unset, int]): Memory for the sandbox in MiB
23
23
  min_free_disk_mb (Union[Unset, int]): Requested minimum free space after the template's build steps, in MiB.
@@ -153,8 +153,11 @@ _transport_lock = threading.Lock()
153
153
  # they replaced, the transports are not bound to an event loop and the caches
154
154
  # are process-global rather than per-loop.
155
155
  _transports: Dict[_TransportKey, ConnectionRetryTransport] = {}
156
+ # The balancing transport under each retrying one, for callers that must not
157
+ # retry connecting (the health probe run after a request failed).
158
+ _pools: Dict[_TransportKey, BalancingTransport] = {}
156
159
  # The httpx adapter over each transport, shared by every httpx client on it.
157
- _httpx_transports: Dict[_TransportKey, AsyncPyqwestTransport] = {}
160
+ _httpx_transports: Dict[Tuple[_TransportKey, bool], AsyncPyqwestTransport] = {}
158
161
 
159
162
 
160
163
  def get_pyqwest_transport(
@@ -162,7 +165,8 @@ def get_pyqwest_transport(
162
165
  read_timeout: Optional[float] = None,
163
166
  *,
164
167
  http_version: HttpVersion = DEFAULT_HTTP_VERSION,
165
- ) -> ConnectionRetryTransport:
168
+ retry_connect: bool = True,
169
+ ) -> Transport:
166
170
  """The shared pyqwest transport with the SDK's tuning — system CA certs
167
171
  (without which TLS through an intercepting proxy fails) and the
168
172
  httpx-equivalent pool limits — behind connect-only retries. It balances
@@ -187,7 +191,10 @@ def get_pyqwest_transport(
187
191
  Requests are logged by pyqwest itself on the ``pyqwest.access`` and
188
192
  ``pyqwest`` loggers at ``DEBUG`` (off unless enabled) — the transport-level
189
193
  diagnostics httpcore used to provide. The SDK's own ``logger`` option is
190
- separate and sits above this, on the httpx client."""
194
+ separate and sits above this, on the httpx client.
195
+
196
+ ``retry_connect=False`` returns the balancing transport under the retrying
197
+ one — the same pools, without the connection retries."""
191
198
  key = (proxy, read_timeout, http_version)
192
199
 
193
200
  def build() -> HTTPTransport:
@@ -209,11 +216,11 @@ def get_pyqwest_transport(
209
216
  with _transport_lock:
210
217
  transport = _transports.get(key)
211
218
  if transport is None:
212
- transport = ConnectionRetryTransport(
213
- BalancingTransport(build), max_retries=connection_retries
214
- )
219
+ pool = BalancingTransport(build)
220
+ transport = ConnectionRetryTransport(pool, max_retries=connection_retries)
221
+ _pools[key] = pool
215
222
  _transports[key] = transport
216
- return transport
223
+ return transport if retry_connect else _pools[key]
217
224
 
218
225
 
219
226
  def get_httpx_transport(
@@ -221,15 +228,19 @@ def get_httpx_transport(
221
228
  read_timeout: Optional[float] = None,
222
229
  *,
223
230
  http_version: HttpVersion = DEFAULT_HTTP_VERSION,
231
+ retry_connect: bool = True,
224
232
  ) -> AsyncPyqwestTransport:
225
233
  """The httpx adapter over the shared transport of
226
234
  :func:`get_pyqwest_transport`, for the generated httpx clients (control
227
235
  plane, envd HTTP API, volume content). The adapter holds no state of its
228
236
  own and does not close the pools, so closing an httpx client leaves them
229
- intact for the other clients on it."""
230
- key = (proxy, read_timeout, http_version)
237
+ intact for the other clients on it. ``retry_connect=False`` adapts the
238
+ same pools without the connection retries."""
239
+ key = ((proxy, read_timeout, http_version), retry_connect)
231
240
  # Resolve the pool before taking the lock: it takes the same one.
232
- pool = get_pyqwest_transport(proxy, read_timeout, http_version=http_version)
241
+ pool = get_pyqwest_transport(
242
+ proxy, read_timeout, http_version=http_version, retry_connect=retry_connect
243
+ )
233
244
  with _transport_lock:
234
245
  transport = _httpx_transports.get(key)
235
246
  if transport is None:
@@ -243,6 +254,7 @@ def get_transport(
243
254
  *,
244
255
  http_version: Optional[HttpVersion] = None,
245
256
  for_streaming: bool = False,
257
+ retry_connect: bool = True,
246
258
  ) -> AsyncPyqwestTransport:
247
259
  """The shared httpx transport factory for the control-plane REST API and
248
260
  envd HTTP API (file transfers, health checks). For TLS connections ALPN
@@ -264,16 +276,26 @@ def get_transport(
264
276
  whole-request deadlines rather than idle bounds — so only streamed
265
277
  downloads take it, and they get their own pool
266
278
  (see :func:`get_pyqwest_transport`).
279
+
280
+ ``retry_connect=False`` returns the adapter over the same pool without the
281
+ connection retries (``E2B_CONNECTION_RETRIES``): for the health probe run
282
+ after a request failed, so a sandbox that cannot be reached is not tried
283
+ all over again.
267
284
  """
268
285
  return get_httpx_transport(
269
286
  proxy_to_config(config.proxy),
270
287
  READ_TIMEOUT if for_streaming else None,
271
288
  http_version=(config.http_version if http_version is None else http_version),
289
+ retry_connect=retry_connect,
272
290
  )
273
291
 
274
292
 
275
293
  def get_envd_api(
276
- config: ConnectionConfig, base_url: str, *, for_streaming: bool = False
294
+ config: ConnectionConfig,
295
+ base_url: str,
296
+ *,
297
+ for_streaming: bool = False,
298
+ retry_connect: bool = True,
277
299
  ) -> httpx.AsyncClient:
278
300
  """An httpx client for a sandbox's envd HTTP API (file transfers, health
279
301
  checks) on the shared transports. The client itself is a cheap stateless
@@ -281,7 +303,9 @@ def get_envd_api(
281
303
  is shared and loop-independent."""
282
304
  return httpx.AsyncClient(
283
305
  base_url=base_url,
284
- transport=get_transport(config, for_streaming=for_streaming),
306
+ transport=get_transport(
307
+ config, for_streaming=for_streaming, retry_connect=retry_connect
308
+ ),
285
309
  headers=config.sandbox_headers,
286
310
  event_hooks=make_async_logging_event_hooks(config.logger),
287
311
  )
@@ -158,8 +158,11 @@ _transport_lock = threading.Lock()
158
158
  # pyqwest transports are thread-safe, so unlike the httpx transports they
159
159
  # replaced, the caches are process-global rather than per-thread.
160
160
  _transports: Dict[_TransportKey, ConnectionRetryTransport] = {}
161
+ # The balancing transport under each retrying one, for callers that must not
162
+ # retry connecting (the health probe run after a request failed).
163
+ _pools: Dict[_TransportKey, BalancingTransport] = {}
161
164
  # The httpx adapter over each transport, shared by every httpx client on it.
162
- _httpx_transports: Dict[_TransportKey, PyqwestTransport] = {}
165
+ _httpx_transports: Dict[Tuple[_TransportKey, bool], PyqwestTransport] = {}
163
166
 
164
167
 
165
168
  def get_pyqwest_transport(
@@ -167,7 +170,8 @@ def get_pyqwest_transport(
167
170
  read_timeout: Optional[float] = None,
168
171
  *,
169
172
  http_version: HttpVersion = DEFAULT_HTTP_VERSION,
170
- ) -> ConnectionRetryTransport:
173
+ retry_connect: bool = True,
174
+ ) -> SyncTransport:
171
175
  """The shared pyqwest transport with the SDK's tuning — system CA certs
172
176
  (without which TLS through an intercepting proxy fails) and the
173
177
  httpx-equivalent pool limits — behind connect-only retries. It balances
@@ -192,7 +196,10 @@ def get_pyqwest_transport(
192
196
  Requests are logged by pyqwest itself on the ``pyqwest.access`` and
193
197
  ``pyqwest`` loggers at ``DEBUG`` (off unless enabled) — the transport-level
194
198
  diagnostics httpcore used to provide. The SDK's own ``logger`` option is
195
- separate and sits above this, on the httpx client."""
199
+ separate and sits above this, on the httpx client.
200
+
201
+ ``retry_connect=False`` returns the balancing transport under the retrying
202
+ one — the same pools, without the connection retries."""
196
203
  key = (proxy, read_timeout, http_version)
197
204
 
198
205
  def build() -> SyncHTTPTransport:
@@ -214,11 +221,11 @@ def get_pyqwest_transport(
214
221
  with _transport_lock:
215
222
  transport = _transports.get(key)
216
223
  if transport is None:
217
- transport = ConnectionRetryTransport(
218
- BalancingTransport(build), max_retries=connection_retries
219
- )
224
+ pool = BalancingTransport(build)
225
+ transport = ConnectionRetryTransport(pool, max_retries=connection_retries)
226
+ _pools[key] = pool
220
227
  _transports[key] = transport
221
- return transport
228
+ return transport if retry_connect else _pools[key]
222
229
 
223
230
 
224
231
  def get_httpx_transport(
@@ -226,15 +233,19 @@ def get_httpx_transport(
226
233
  read_timeout: Optional[float] = None,
227
234
  *,
228
235
  http_version: HttpVersion = DEFAULT_HTTP_VERSION,
236
+ retry_connect: bool = True,
229
237
  ) -> PyqwestTransport:
230
238
  """The httpx adapter over the shared transport of
231
239
  :func:`get_pyqwest_transport`, for the generated httpx clients (control
232
240
  plane, envd HTTP API, volume content). The adapter holds no state of its
233
241
  own and does not close the pools, so closing an httpx client leaves them
234
- intact for the other clients on it."""
235
- key = (proxy, read_timeout, http_version)
242
+ intact for the other clients on it. ``retry_connect=False`` adapts the
243
+ same pools without the connection retries."""
244
+ key = ((proxy, read_timeout, http_version), retry_connect)
236
245
  # Resolve the pool before taking the lock: it takes the same one.
237
- pool = get_pyqwest_transport(proxy, read_timeout, http_version=http_version)
246
+ pool = get_pyqwest_transport(
247
+ proxy, read_timeout, http_version=http_version, retry_connect=retry_connect
248
+ )
238
249
  with _transport_lock:
239
250
  transport = _httpx_transports.get(key)
240
251
  if transport is None:
@@ -248,6 +259,7 @@ def get_transport(
248
259
  *,
249
260
  http_version: Optional[HttpVersion] = None,
250
261
  for_streaming: bool = False,
262
+ retry_connect: bool = True,
251
263
  ) -> PyqwestTransport:
252
264
  """The shared httpx transport factory for the control-plane REST API and
253
265
  envd HTTP API (file transfers, health checks). For TLS connections ALPN
@@ -269,16 +281,26 @@ def get_transport(
269
281
  whole-request deadlines rather than idle bounds — so only streamed
270
282
  downloads take it, and they get their own pool
271
283
  (see :func:`get_pyqwest_transport`).
284
+
285
+ ``retry_connect=False`` returns the adapter over the same pool without the
286
+ connection retries (``E2B_CONNECTION_RETRIES``): for the health probe run
287
+ after a request failed, so a sandbox that cannot be reached is not tried
288
+ all over again.
272
289
  """
273
290
  return get_httpx_transport(
274
291
  proxy_to_config(config.proxy),
275
292
  READ_TIMEOUT if for_streaming else None,
276
293
  http_version=(config.http_version if http_version is None else http_version),
294
+ retry_connect=retry_connect,
277
295
  )
278
296
 
279
297
 
280
298
  def get_envd_api(
281
- config: ConnectionConfig, base_url: str, *, for_streaming: bool = False
299
+ config: ConnectionConfig,
300
+ base_url: str,
301
+ *,
302
+ for_streaming: bool = False,
303
+ retry_connect: bool = True,
282
304
  ) -> httpx.Client:
283
305
  """An httpx client for a sandbox's envd HTTP API (file transfers, health
284
306
  checks) on the shared transports. The client itself is a cheap stateless
@@ -286,7 +308,9 @@ def get_envd_api(
286
308
  is shared and thread-safe."""
287
309
  return httpx.Client(
288
310
  base_url=base_url,
289
- transport=get_transport(config, for_streaming=for_streaming),
311
+ transport=get_transport(
312
+ config, for_streaming=for_streaming, retry_connect=retry_connect
313
+ ),
290
314
  headers=config.sandbox_headers,
291
315
  event_hooks=make_logging_event_hooks(config.logger),
292
316
  )
@@ -1,6 +1,5 @@
1
1
  import logging
2
2
  import os
3
- import re
4
3
 
5
4
  from typing import cast, Literal, Mapping, Optional, Dict, Tuple, TypedDict, Union
6
5
 
@@ -233,22 +232,12 @@ class ConnectionConfig:
233
232
  return os.getenv("E2B_SANDBOX_URL")
234
233
 
235
234
  @staticmethod
236
- def _get_request_source() -> Optional[str]:
237
- source = os.getenv("E2B_USER_AGENT_SOURCE")
238
- if source and re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9._-]{0,31}", source):
239
- return source
240
- return None
241
-
242
- @staticmethod
243
- def _build_user_agent(request_source: Optional[str] = None) -> str:
235
+ def _build_user_agent() -> str:
244
236
  user_agent_parts = [f"e2b-python-sdk/{package_version}"]
245
237
 
246
238
  if ConnectionConfig._integration:
247
239
  user_agent_parts.append(ConnectionConfig._integration)
248
240
 
249
- if request_source:
250
- user_agent_parts.append(f"source/{request_source}")
251
-
252
241
  return " ".join(user_agent_parts)
253
242
 
254
243
  def _apply_user_agent(
@@ -268,7 +257,7 @@ class ConnectionConfig:
268
257
  headers["User-Agent"] = user_agent_override
269
258
  return False
270
259
 
271
- headers["User-Agent"] = self._build_user_agent(self.request_source)
260
+ headers["User-Agent"] = self._build_user_agent()
272
261
  return True
273
262
 
274
263
  def __init__(
@@ -294,7 +283,6 @@ class ConnectionConfig:
294
283
  self.debug = debug if debug is not None else ConnectionConfig._debug()
295
284
  self.api_key = api_key or ConnectionConfig._api_key()
296
285
  self.validate_api_key = validate_api_key
297
- self.request_source = ConnectionConfig._get_request_source()
298
286
  self.headers = {**(headers or {}), **(api_headers or {})}
299
287
  self._user_agent_is_sdk_built = self._apply_user_agent(
300
288
  self.headers,