withruntime 0.45.0__tar.gz → 1.1.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.
- withruntime-1.1.0/PKG-INFO +143 -0
- withruntime-1.1.0/README.md +125 -0
- withruntime-1.1.0/pyproject.toml +26 -0
- withruntime-1.1.0/withruntime/__init__.py +5 -0
- withruntime-1.1.0/withruntime/_version.py +1 -0
- withruntime-1.1.0/withruntime/generated/__init__.py +214 -0
- withruntime-1.1.0/withruntime/generated/_routes.py +8 -0
- withruntime-1.1.0/withruntime/generated/_runtime.py +552 -0
- withruntime-1.1.0/withruntime/generated/agent_sessions.py +372 -0
- withruntime-1.1.0/withruntime/generated/agents.py +764 -0
- withruntime-1.1.0/withruntime/generated/apps.py +1004 -0
- withruntime-1.1.0/withruntime/generated/audit.py +109 -0
- withruntime-1.1.0/withruntime/generated/browsers.py +1004 -0
- withruntime-1.1.0/withruntime/generated/builds.py +1004 -0
- withruntime-1.1.0/withruntime/generated/ci.py +1004 -0
- withruntime-1.1.0/withruntime/generated/containers.py +1004 -0
- withruntime-1.1.0/withruntime/generated/desktops.py +1004 -0
- withruntime-1.1.0/withruntime/generated/domains.py +421 -0
- withruntime-1.1.0/withruntime/generated/egress_ips.py +108 -0
- withruntime-1.1.0/withruntime/generated/events.py +89 -0
- withruntime-1.1.0/withruntime/generated/feedback.py +128 -0
- withruntime-1.1.0/withruntime/generated/functions.py +1004 -0
- withruntime-1.1.0/withruntime/generated/identities.py +98 -0
- withruntime-1.1.0/withruntime/generated/images.py +757 -0
- withruntime-1.1.0/withruntime/generated/job_runs.py +149 -0
- withruntime-1.1.0/withruntime/generated/jobs.py +737 -0
- withruntime-1.1.0/withruntime/generated/keys.py +341 -0
- withruntime-1.1.0/withruntime/generated/me.py +97 -0
- withruntime-1.1.0/withruntime/generated/messages.py +178 -0
- withruntime-1.1.0/withruntime/generated/networks.py +96 -0
- withruntime-1.1.0/withruntime/generated/notebooks.py +1004 -0
- withruntime-1.1.0/withruntime/generated/otel.py +128 -0
- withruntime-1.1.0/withruntime/generated/ports.py +155 -0
- withruntime-1.1.0/withruntime/generated/previews.py +382 -0
- withruntime-1.1.0/withruntime/generated/projects.py +213 -0
- withruntime-1.1.0/withruntime/generated/roles.py +129 -0
- withruntime-1.1.0/withruntime/generated/sandboxes.py +3122 -0
- withruntime-1.1.0/withruntime/generated/secrets.py +581 -0
- withruntime-1.1.0/withruntime/generated/sessions.py +187 -0
- withruntime-1.1.0/withruntime/generated/signing.py +279 -0
- withruntime-1.1.0/withruntime/generated/sites.py +1004 -0
- withruntime-1.1.0/withruntime/generated/snapshots.py +322 -0
- withruntime-1.1.0/withruntime/generated/tunnels.py +210 -0
- withruntime-1.1.0/withruntime/generated/usage.py +484 -0
- withruntime-1.1.0/withruntime/generated/volumes.py +355 -0
- withruntime-1.1.0/withruntime/generated/webhooks.py +124 -0
- withruntime-1.1.0/withruntime/generated/workspaces.py +1004 -0
- withruntime-1.1.0/withruntime.egg-info/PKG-INFO +143 -0
- withruntime-1.1.0/withruntime.egg-info/SOURCES.txt +52 -0
- withruntime-1.1.0/withruntime.egg-info/requires.txt +4 -0
- withruntime-0.45.0/PKG-INFO +0 -352
- withruntime-0.45.0/README.md +0 -326
- withruntime-0.45.0/pyproject.toml +0 -42
- withruntime-0.45.0/tests/test_account_errors.py +0 -72
- withruntime-0.45.0/tests/test_agents.py +0 -628
- withruntime-0.45.0/tests/test_answer_start.py +0 -85
- withruntime-0.45.0/tests/test_apps_builds.py +0 -453
- withruntime-0.45.0/tests/test_async_stream_cleanup.py +0 -271
- withruntime-0.45.0/tests/test_audit.py +0 -70
- withruntime-0.45.0/tests/test_billing.py +0 -102
- withruntime-0.45.0/tests/test_blaxel.py +0 -1610
- withruntime-0.45.0/tests/test_blaxel_0_4_17.py +0 -204
- withruntime-0.45.0/tests/test_blaxel_0_4_18.py +0 -34
- withruntime-0.45.0/tests/test_blaxel_create_timeout.py +0 -143
- withruntime-0.45.0/tests/test_blaxel_wait_deadline.py +0 -57
- withruntime-0.45.0/tests/test_browser.py +0 -48
- withruntime-0.45.0/tests/test_browsers.py +0 -117
- withruntime-0.45.0/tests/test_capacity_wait.py +0 -233
- withruntime-0.45.0/tests/test_ci.py +0 -204
- withruntime-0.45.0/tests/test_compat_live.py +0 -101
- withruntime-0.45.0/tests/test_compat_modal_deadline_errors.py +0 -73
- withruntime-0.45.0/tests/test_compat_new_providers.py +0 -614
- withruntime-0.45.0/tests/test_compat_prime_contract.py +0 -170
- withruntime-0.45.0/tests/test_compat_prime_process_lifecycle.py +0 -106
- withruntime-0.45.0/tests/test_compat_prime_validation.py +0 -288
- withruntime-0.45.0/tests/test_compat_python_disk_snapshots.py +0 -159
- withruntime-0.45.0/tests/test_compat_python_e2b_deadline.py +0 -203
- withruntime-0.45.0/tests/test_compat_python_e2b_pty.py +0 -172
- withruntime-0.45.0/tests/test_compat_python_e2b_stream.py +0 -126
- withruntime-0.45.0/tests/test_compat_python_e2b_watch.py +0 -86
- withruntime-0.45.0/tests/test_compat_python_interpreter_deadline.py +0 -113
- withruntime-0.45.0/tests/test_compat_python_modal.py +0 -116
- withruntime-0.45.0/tests/test_compat_python_morph.py +0 -546
- withruntime-0.45.0/tests/test_compat_python_official.py +0 -676
- withruntime-0.45.0/tests/test_compat_python_pins.py +0 -91
- withruntime-0.45.0/tests/test_compat_python_processes.py +0 -282
- withruntime-0.45.0/tests/test_compat_python_request_scope.py +0 -187
- withruntime-0.45.0/tests/test_compat_python_runloop.py +0 -146
- withruntime-0.45.0/tests/test_compat_python_shell.py +0 -61
- withruntime-0.45.0/tests/test_compat_python_snapshot_capture.py +0 -139
- withruntime-0.45.0/tests/test_compat_python_sprites.py +0 -631
- withruntime-0.45.0/tests/test_compat_router.py +0 -133
- withruntime-0.45.0/tests/test_customer_usage.py +0 -121
- withruntime-0.45.0/tests/test_daytona.py +0 -381
- withruntime-0.45.0/tests/test_daytona_0_223_1.py +0 -79
- withruntime-0.45.0/tests/test_daytona_0_224_1.py +0 -76
- withruntime-0.45.0/tests/test_daytona_0_225_0.py +0 -71
- withruntime-0.45.0/tests/test_daytona_create_cleanup.py +0 -75
- withruntime-0.45.0/tests/test_daytona_create_options.py +0 -139
- withruntime-0.45.0/tests/test_daytona_download_labels.py +0 -158
- withruntime-0.45.0/tests/test_daytona_refusals_lifted.py +0 -368
- withruntime-0.45.0/tests/test_deepagents.py +0 -194
- withruntime-0.45.0/tests/test_e2b_2_55.py +0 -113
- withruntime-0.45.0/tests/test_e2b_code_interpreter.py +0 -138
- withruntime-0.45.0/tests/test_e2b_connection_cap.py +0 -233
- withruntime-0.45.0/tests/test_e2b_exports.py +0 -133
- withruntime-0.45.0/tests/test_e2b_fork_validation.py +0 -78
- withruntime-0.45.0/tests/test_e2b_sandbox.py +0 -904
- withruntime-0.45.0/tests/test_e2b_upstream.py +0 -266
- withruntime-0.45.0/tests/test_e2b_watch.py +0 -122
- withruntime-0.45.0/tests/test_embed_and_webhook_watch.py +0 -57
- withruntime-0.45.0/tests/test_eval_sandbox.py +0 -43
- withruntime-0.45.0/tests/test_exec_stream.py +0 -241
- withruntime-0.45.0/tests/test_exec_stream_names.py +0 -51
- withruntime-0.45.0/tests/test_exec_user.py +0 -92
- withruntime-0.45.0/tests/test_file_archives.py +0 -175
- withruntime-0.45.0/tests/test_files_download.py +0 -149
- withruntime-0.45.0/tests/test_files_mode.py +0 -74
- withruntime-0.45.0/tests/test_files_upload_parallel.py +0 -84
- withruntime-0.45.0/tests/test_files_write_lost_body.py +0 -86
- withruntime-0.45.0/tests/test_harbor.py +0 -609
- withruntime-0.45.0/tests/test_http_tls_close.py +0 -118
- withruntime-0.45.0/tests/test_identity_token.py +0 -152
- withruntime-0.45.0/tests/test_image_delete_by_name.py +0 -55
- withruntime-0.45.0/tests/test_images_v2.py +0 -137
- withruntime-0.45.0/tests/test_images_volumes_interpreter.py +0 -149
- withruntime-0.45.0/tests/test_inspect_ai.py +0 -235
- withruntime-0.45.0/tests/test_interface_contract.py +0 -81
- withruntime-0.45.0/tests/test_jobs.py +0 -278
- withruntime-0.45.0/tests/test_late_answer.py +0 -69
- withruntime-0.45.0/tests/test_lifecycle_settings.py +0 -252
- withruntime-0.45.0/tests/test_limits.py +0 -64
- withruntime-0.45.0/tests/test_machine_engine.py +0 -123
- withruntime-0.45.0/tests/test_modal_1_6_2.py +0 -64
- withruntime-0.45.0/tests/test_modal_dropin.py +0 -748
- withruntime-0.45.0/tests/test_modal_examples.py +0 -193
- withruntime-0.45.0/tests/test_modal_jobs.py +0 -158
- withruntime-0.45.0/tests/test_mounts.py +0 -69
- withruntime-0.45.0/tests/test_network_funding.py +0 -28
- withruntime-0.45.0/tests/test_network_products.py +0 -98
- withruntime-0.45.0/tests/test_observability.py +0 -155
- withruntime-0.45.0/tests/test_openai_agents.py +0 -457
- withruntime-0.45.0/tests/test_out_of_memory.py +0 -47
- withruntime-0.45.0/tests/test_package_typing.py +0 -155
- withruntime-0.45.0/tests/test_plans.py +0 -120
- withruntime-0.45.0/tests/test_previews_network_desktop.py +0 -108
- withruntime-0.45.0/tests/test_prime_0_4_5.py +0 -334
- withruntime-0.45.0/tests/test_prime_0_4_6.py +0 -47
- withruntime-0.45.0/tests/test_prime_0_4_7.py +0 -70
- withruntime-0.45.0/tests/test_private_network.py +0 -71
- withruntime-0.45.0/tests/test_process_deadline.py +0 -273
- withruntime-0.45.0/tests/test_process_input.py +0 -50
- withruntime-0.45.0/tests/test_process_object.py +0 -49
- withruntime-0.45.0/tests/test_process_output.py +0 -50
- withruntime-0.45.0/tests/test_process_write_backpressure.py +0 -174
- withruntime-0.45.0/tests/test_product_aliases.py +0 -118
- withruntime-0.45.0/tests/test_proxy.py +0 -267
- withruntime-0.45.0/tests/test_referrals.py +0 -64
- withruntime-0.45.0/tests/test_replayed_create_message.py +0 -55
- withruntime-0.45.0/tests/test_reservations.py +0 -117
- withruntime-0.45.0/tests/test_runloop_stream_cleanup.py +0 -167
- withruntime-0.45.0/tests/test_runloop_v2.py +0 -164
- withruntime-0.45.0/tests/test_sandbox_origin.py +0 -53
- withruntime-0.45.0/tests/test_sandbox_sessions.py +0 -149
- withruntime-0.45.0/tests/test_sandboxes_delete_all.py +0 -95
- withruntime-0.45.0/tests/test_sandboxes_stop_all.py +0 -49
- withruntime-0.45.0/tests/test_saved_connection.py +0 -37
- withruntime-0.45.0/tests/test_secrets.py +0 -437
- withruntime-0.45.0/tests/test_signed_requests.py +0 -71
- withruntime-0.45.0/tests/test_snapshot_after_fork.py +0 -108
- withruntime-0.45.0/tests/test_snapshot_recovery.py +0 -137
- withruntime-0.45.0/tests/test_sso.py +0 -29
- withruntime-0.45.0/tests/test_start_report_kept.py +0 -43
- withruntime-0.45.0/tests/test_stream_cut_short.py +0 -81
- withruntime-0.45.0/tests/test_stream_exit_close.py +0 -55
- withruntime-0.45.0/tests/test_switch_image.py +0 -88
- withruntime-0.45.0/tests/test_switching.py +0 -79
- withruntime-0.45.0/tests/test_tailscale.py +0 -80
- withruntime-0.45.0/tests/test_tools.py +0 -115
- withruntime-0.45.0/tests/test_trace_files.py +0 -72
- withruntime-0.45.0/tests/test_transport_body_recovery.py +0 -260
- withruntime-0.45.0/tests/test_transport_connection_limits.py +0 -256
- withruntime-0.45.0/tests/test_transport_never_sent.py +0 -112
- withruntime-0.45.0/tests/test_unpack.py +0 -216
- withruntime-0.45.0/tests/test_upload_deadline.py +0 -86
- withruntime-0.45.0/tests/test_usage_export.py +0 -97
- withruntime-0.45.0/tests/test_vercel.py +0 -341
- withruntime-0.45.0/tests/test_vercel_create_validation.py +0 -158
- withruntime-0.45.0/tests/test_vercel_disk_snapshot.py +0 -394
- withruntime-0.45.0/tests/test_vercel_refusals_lifted.py +0 -134
- withruntime-0.45.0/tests/test_volume_backups.py +0 -109
- withruntime-0.45.0/tests/test_volume_operations.py +0 -52
- withruntime-0.45.0/tests/test_wake_awake.py +0 -34
- withruntime-0.45.0/tests/test_wallet.py +0 -60
- withruntime-0.45.0/tests/test_watch.py +0 -144
- withruntime-0.45.0/withruntime/__init__.py +0 -162
- withruntime-0.45.0/withruntime/_agent_templates.py +0 -78
- withruntime-0.45.0/withruntime/_api_defaults.py +0 -21
- withruntime-0.45.0/withruntime/_async_client.py +0 -2240
- withruntime-0.45.0/withruntime/_async_products/__init__.py +0 -84
- withruntime-0.45.0/withruntime/_async_products/agents.py +0 -800
- withruntime-0.45.0/withruntime/_async_products/apps.py +0 -515
- withruntime-0.45.0/withruntime/_async_products/audit.py +0 -26
- withruntime-0.45.0/withruntime/_async_products/billing.py +0 -72
- withruntime-0.45.0/withruntime/_async_products/browser.py +0 -54
- withruntime-0.45.0/withruntime/_async_products/browsers.py +0 -115
- withruntime-0.45.0/withruntime/_async_products/builds.py +0 -264
- withruntime-0.45.0/withruntime/_async_products/ci.py +0 -228
- withruntime-0.45.0/withruntime/_async_products/containers.py +0 -125
- withruntime-0.45.0/withruntime/_async_products/desktop.py +0 -159
- withruntime-0.45.0/withruntime/_async_products/images.py +0 -391
- withruntime-0.45.0/withruntime/_async_products/interpreter.py +0 -116
- withruntime-0.45.0/withruntime/_async_products/jobs.py +0 -347
- withruntime-0.45.0/withruntime/_async_products/limits.py +0 -32
- withruntime-0.45.0/withruntime/_async_products/mcp.py +0 -68
- withruntime-0.45.0/withruntime/_async_products/mounts.py +0 -39
- withruntime-0.45.0/withruntime/_async_products/network.py +0 -42
- withruntime-0.45.0/withruntime/_async_products/network_products.py +0 -207
- withruntime-0.45.0/withruntime/_async_products/observability.py +0 -134
- withruntime-0.45.0/withruntime/_async_products/plans.py +0 -76
- withruntime-0.45.0/withruntime/_async_products/previews.py +0 -64
- withruntime-0.45.0/withruntime/_async_products/private_network.py +0 -31
- withruntime-0.45.0/withruntime/_async_products/referrals.py +0 -22
- withruntime-0.45.0/withruntime/_async_products/reservations.py +0 -107
- withruntime-0.45.0/withruntime/_async_products/secrets.py +0 -422
- withruntime-0.45.0/withruntime/_async_products/signed_requests.py +0 -30
- withruntime-0.45.0/withruntime/_async_products/sso.py +0 -20
- withruntime-0.45.0/withruntime/_async_products/switching.py +0 -38
- withruntime-0.45.0/withruntime/_async_products/tailscale.py +0 -37
- withruntime-0.45.0/withruntime/_async_products/volumes.py +0 -120
- withruntime-0.45.0/withruntime/_async_products/watch.py +0 -112
- withruntime-0.45.0/withruntime/_clock.py +0 -155
- withruntime-0.45.0/withruntime/_compat.py +0 -127
- withruntime-0.45.0/withruntime/_compat_lease.py +0 -45
- withruntime-0.45.0/withruntime/_compat_lifecycle.py +0 -24
- withruntime-0.45.0/withruntime/_compat_shell.py +0 -166
- withruntime-0.45.0/withruntime/_connection.py +0 -56
- withruntime-0.45.0/withruntime/_errors.py +0 -161
- withruntime-0.45.0/withruntime/_eval_sandbox.py +0 -380
- withruntime-0.45.0/withruntime/_http.py +0 -728
- withruntime-0.45.0/withruntime/_proxy.py +0 -189
- withruntime-0.45.0/withruntime/_renamed.py +0 -51
- withruntime-0.45.0/withruntime/_request_scope.py +0 -92
- withruntime-0.45.0/withruntime/_sync_client.py +0 -2239
- withruntime-0.45.0/withruntime/_sync_products/__init__.py +0 -70
- withruntime-0.45.0/withruntime/_sync_products/agents.py +0 -801
- withruntime-0.45.0/withruntime/_sync_products/apps.py +0 -516
- withruntime-0.45.0/withruntime/_sync_products/audit.py +0 -27
- withruntime-0.45.0/withruntime/_sync_products/billing.py +0 -73
- withruntime-0.45.0/withruntime/_sync_products/browser.py +0 -55
- withruntime-0.45.0/withruntime/_sync_products/browsers.py +0 -116
- withruntime-0.45.0/withruntime/_sync_products/builds.py +0 -265
- withruntime-0.45.0/withruntime/_sync_products/ci.py +0 -229
- withruntime-0.45.0/withruntime/_sync_products/containers.py +0 -126
- withruntime-0.45.0/withruntime/_sync_products/desktop.py +0 -160
- withruntime-0.45.0/withruntime/_sync_products/images.py +0 -392
- withruntime-0.45.0/withruntime/_sync_products/interpreter.py +0 -117
- withruntime-0.45.0/withruntime/_sync_products/jobs.py +0 -348
- withruntime-0.45.0/withruntime/_sync_products/limits.py +0 -33
- withruntime-0.45.0/withruntime/_sync_products/mcp.py +0 -69
- withruntime-0.45.0/withruntime/_sync_products/mounts.py +0 -40
- withruntime-0.45.0/withruntime/_sync_products/network.py +0 -43
- withruntime-0.45.0/withruntime/_sync_products/network_products.py +0 -208
- withruntime-0.45.0/withruntime/_sync_products/observability.py +0 -135
- withruntime-0.45.0/withruntime/_sync_products/plans.py +0 -77
- withruntime-0.45.0/withruntime/_sync_products/previews.py +0 -65
- withruntime-0.45.0/withruntime/_sync_products/private_network.py +0 -21
- withruntime-0.45.0/withruntime/_sync_products/referrals.py +0 -23
- withruntime-0.45.0/withruntime/_sync_products/reservations.py +0 -108
- withruntime-0.45.0/withruntime/_sync_products/secrets.py +0 -423
- withruntime-0.45.0/withruntime/_sync_products/signed_requests.py +0 -21
- withruntime-0.45.0/withruntime/_sync_products/sso.py +0 -21
- withruntime-0.45.0/withruntime/_sync_products/switching.py +0 -39
- withruntime-0.45.0/withruntime/_sync_products/tailscale.py +0 -38
- withruntime-0.45.0/withruntime/_sync_products/volumes.py +0 -121
- withruntime-0.45.0/withruntime/_sync_products/watch.py +0 -113
- withruntime-0.45.0/withruntime/_trace.py +0 -32
- withruntime-0.45.0/withruntime/_tunnel.py +0 -330
- withruntime-0.45.0/withruntime/_unpack.py +0 -355
- withruntime-0.45.0/withruntime/_version.py +0 -1
- withruntime-0.45.0/withruntime/_ws.py +0 -403
- withruntime-0.45.0/withruntime/blaxel/__init__.py +0 -186
- withruntime-0.45.0/withruntime/blaxel/_async_io.py +0 -56
- withruntime-0.45.0/withruntime/blaxel/_async_sandbox.py +0 -1878
- withruntime-0.45.0/withruntime/blaxel/_core.py +0 -1945
- withruntime-0.45.0/withruntime/blaxel/_sync_io.py +0 -70
- withruntime-0.45.0/withruntime/blaxel/_sync_sandbox.py +0 -1876
- withruntime-0.45.0/withruntime/blaxel/core/__init__.py +0 -4
- withruntime-0.45.0/withruntime/blaxel/core/agents.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/__init__.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/api/__init__.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/api/applications/__init__.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/api/applications/list_application_revisions.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/core/client/api/compute/__init__.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/api/compute/get_sandbox.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/core/client/api/compute/update_sandbox.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/core/client/api/functions/__init__.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/api/functions/create_function.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/core/client/api/images.py +0 -6
- withruntime-0.45.0/withruntime/blaxel/core/client/api/workspaces.py +0 -6
- withruntime-0.45.0/withruntime/blaxel/core/client/client.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/__init__.py +0 -17
- withruntime-0.45.0/withruntime/blaxel/core/client/models/create_job_execution_request.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/create_job_execution_request_env.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/env.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/function.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/function_runtime.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/function_spec.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/metadata.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/models/pagination_meta.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/models/workspace.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/client/pagination.py +0 -2
- withruntime-0.45.0/withruntime/blaxel/core/client/types.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/common.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/core/drive.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/core/errors.py +0 -16
- withruntime-0.45.0/withruntime/blaxel/core/jobs.py +0 -6
- withruntime-0.45.0/withruntime/blaxel/core/sandbox/__init__.py +0 -14
- withruntime-0.45.0/withruntime/blaxel/core/sandbox/types.py +0 -7
- withruntime-0.45.0/withruntime/blaxel/core/secret.py +0 -5
- withruntime-0.45.0/withruntime/blaxel/crewai.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/googleadk.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/langgraph.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/livekit.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/llamaindex.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/openai.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/pydantic.py +0 -3
- withruntime-0.45.0/withruntime/blaxel/telemetry.py +0 -2
- withruntime-0.45.0/withruntime/daytona/__init__.py +0 -83
- withruntime-0.45.0/withruntime/daytona/_async_daytona.py +0 -1529
- withruntime-0.45.0/withruntime/daytona/_async_io.py +0 -127
- withruntime-0.45.0/withruntime/daytona/_core.py +0 -1422
- withruntime-0.45.0/withruntime/daytona/_sync_daytona.py +0 -1527
- withruntime-0.45.0/withruntime/daytona/_sync_io.py +0 -150
- withruntime-0.45.0/withruntime/deepagents.py +0 -140
- withruntime-0.45.0/withruntime/e2b/__init__.py +0 -188
- withruntime-0.45.0/withruntime/e2b/_async_io.py +0 -354
- withruntime-0.45.0/withruntime/e2b/_async_sandbox.py +0 -1083
- withruntime-0.45.0/withruntime/e2b/_core.py +0 -1066
- withruntime-0.45.0/withruntime/e2b/_sync_io.py +0 -291
- withruntime-0.45.0/withruntime/e2b/_sync_sandbox.py +0 -1061
- withruntime-0.45.0/withruntime/e2b/code_interpreter/__init__.py +0 -28
- withruntime-0.45.0/withruntime/e2b/code_interpreter/_async_ci.py +0 -124
- withruntime-0.45.0/withruntime/e2b/code_interpreter/_models.py +0 -156
- withruntime-0.45.0/withruntime/e2b/code_interpreter/_sync_ci.py +0 -123
- withruntime-0.45.0/withruntime/e2b/code_interpreter/charts.py +0 -120
- withruntime-0.45.0/withruntime/e2b/code_interpreter/code_interpreter_async.py +0 -2
- withruntime-0.45.0/withruntime/e2b/code_interpreter/code_interpreter_sync.py +0 -2
- withruntime-0.45.0/withruntime/e2b/code_interpreter/models.py +0 -37
- withruntime-0.45.0/withruntime/e2b/connection_config.py +0 -2
- withruntime-0.45.0/withruntime/e2b/exceptions.py +0 -34
- withruntime-0.45.0/withruntime/e2b/sandbox/__init__.py +0 -1
- withruntime-0.45.0/withruntime/e2b/sandbox/commands/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/commands/command_handle.py +0 -5
- withruntime-0.45.0/withruntime/e2b/sandbox/commands/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/filesystem/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/filesystem/filesystem.py +0 -4
- withruntime-0.45.0/withruntime/e2b/sandbox/filesystem/watch_handle.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/network.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/sandbox_api.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox/signature.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/commands/__init__.py +0 -4
- withruntime-0.45.0/withruntime/e2b/sandbox_async/commands/command.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/commands/command_handle.py +0 -6
- withruntime-0.45.0/withruntime/e2b/sandbox_async/commands/pty.py +0 -3
- withruntime-0.45.0/withruntime/e2b/sandbox_async/filesystem/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/filesystem/filesystem.py +0 -4
- withruntime-0.45.0/withruntime/e2b/sandbox_async/filesystem/watch_handle.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/paginator.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_async/utils.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/commands/__init__.py +0 -4
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/commands/command.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/commands/command_handle.py +0 -6
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/commands/pty.py +0 -3
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/filesystem/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/filesystem/filesystem.py +0 -4
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/filesystem/watch_handle.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/git.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/sandbox_sync/paginator.py +0 -2
- withruntime-0.45.0/withruntime/e2b/secret/__init__.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template/__init__.py +0 -1
- withruntime-0.45.0/withruntime/e2b/template/dockerfile_parser.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template/logger.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template/readycmd.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template/types.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template_async/__init__.py +0 -1
- withruntime-0.45.0/withruntime/e2b/template_async/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/template_sync/__init__.py +0 -1
- withruntime-0.45.0/withruntime/e2b/template_sync/main.py +0 -2
- withruntime-0.45.0/withruntime/e2b/volume/__init__.py +0 -1
- withruntime-0.45.0/withruntime/e2b/volume/connection_config.py +0 -2
- withruntime-0.45.0/withruntime/e2b/volume/types.py +0 -2
- withruntime-0.45.0/withruntime/e2b/volume/volume_async.py +0 -2
- withruntime-0.45.0/withruntime/e2b/volume/volume_sync.py +0 -2
- withruntime-0.45.0/withruntime/harbor.py +0 -277
- withruntime-0.45.0/withruntime/inspect_ai.py +0 -463
- withruntime-0.45.0/withruntime/modal/__init__.py +0 -818
- withruntime-0.45.0/withruntime/modal/__main__.py +0 -35
- withruntime-0.45.0/withruntime/modal/_async.py +0 -413
- withruntime-0.45.0/withruntime/modal/_dual.py +0 -53
- withruntime-0.45.0/withruntime/modal/_fs_async.py +0 -118
- withruntime-0.45.0/withruntime/modal/_fs_common.py +0 -49
- withruntime-0.45.0/withruntime/modal/_fs_sync.py +0 -118
- withruntime-0.45.0/withruntime/modal/_functions.py +0 -331
- withruntime-0.45.0/withruntime/modal/_job_runner.py +0 -20
- withruntime-0.45.0/withruntime/modal/_lookup.py +0 -18
- withruntime-0.45.0/withruntime/modal/_object.py +0 -55
- withruntime-0.45.0/withruntime/modal/_probe.py +0 -60
- withruntime-0.45.0/withruntime/modal/_snapshot.py +0 -33
- withruntime-0.45.0/withruntime/modal/_tunnel.py +0 -31
- withruntime-0.45.0/withruntime/modal/app.py +0 -114
- withruntime-0.45.0/withruntime/modal/cloud_bucket_mount.py +0 -67
- withruntime-0.45.0/withruntime/modal/container_process.py +0 -4
- withruntime-0.45.0/withruntime/modal/exception.py +0 -136
- withruntime-0.45.0/withruntime/modal/file_pattern_matcher.py +0 -122
- withruntime-0.45.0/withruntime/modal/image.py +0 -734
- withruntime-0.45.0/withruntime/modal/io_streams.py +0 -4
- withruntime-0.45.0/withruntime/modal/output.py +0 -28
- withruntime-0.45.0/withruntime/modal/proxy.py +0 -29
- withruntime-0.45.0/withruntime/modal/sandbox/__init__.py +0 -5
- withruntime-0.45.0/withruntime/modal/sandbox/sandbox.py +0 -8
- withruntime-0.45.0/withruntime/modal/sandbox_fs.py +0 -46
- withruntime-0.45.0/withruntime/modal/secret.py +0 -115
- withruntime-0.45.0/withruntime/modal/snapshot.py +0 -39
- withruntime-0.45.0/withruntime/modal/stream_type.py +0 -22
- withruntime-0.45.0/withruntime/modal/types.py +0 -37
- withruntime-0.45.0/withruntime/modal/volume.py +0 -128
- withruntime-0.45.0/withruntime/morph/__init__.py +0 -8
- withruntime-0.45.0/withruntime/morph/api.py +0 -1440
- withruntime-0.45.0/withruntime/openai_agents.py +0 -847
- withruntime-0.45.0/withruntime/prime/__init__.py +0 -134
- withruntime-0.45.0/withruntime/prime/_async.py +0 -596
- withruntime-0.45.0/withruntime/prime/_sync.py +0 -596
- withruntime-0.45.0/withruntime/prime/core/__init__.py +0 -4
- withruntime-0.45.0/withruntime/prime/core/client.py +0 -4
- withruntime-0.45.0/withruntime/prime/exceptions.py +0 -98
- withruntime-0.45.0/withruntime/prime/models.py +0 -415
- withruntime-0.45.0/withruntime/prime/process.py +0 -163
- withruntime-0.45.0/withruntime/prime/sandbox.py +0 -3
- withruntime-0.45.0/withruntime/py.typed +0 -0
- withruntime-0.45.0/withruntime/runloop/__init__.py +0 -6
- withruntime-0.45.0/withruntime/runloop/_async.py +0 -688
- withruntime-0.45.0/withruntime/runloop/_exceptions.py +0 -2
- withruntime-0.45.0/withruntime/runloop/_snapshots.py +0 -48
- withruntime-0.45.0/withruntime/runloop/_sync.py +0 -688
- withruntime-0.45.0/withruntime/runloop/_v2.py +0 -35
- withruntime-0.45.0/withruntime/runloop/lib/__init__.py +0 -1
- withruntime-0.45.0/withruntime/runloop/lib/polling.py +0 -15
- withruntime-0.45.0/withruntime/runloop/sdk/__init__.py +0 -3
- withruntime-0.45.0/withruntime/sprites/__init__.py +0 -494
- withruntime-0.45.0/withruntime/sprites/_capture.py +0 -56
- withruntime-0.45.0/withruntime/sprites/_capture_async.py +0 -56
- withruntime-0.45.0/withruntime/sprites/_features.py +0 -194
- withruntime-0.45.0/withruntime/sprites/_metadata.py +0 -64
- withruntime-0.45.0/withruntime/sprites/_stream.py +0 -68
- withruntime-0.45.0/withruntime/sprites/_stream_async.py +0 -67
- withruntime-0.45.0/withruntime/sprites/_translate.py +0 -117
- withruntime-0.45.0/withruntime/sprites/async_client.py +0 -340
- withruntime-0.45.0/withruntime/sprites/async_exec.py +0 -50
- withruntime-0.45.0/withruntime/sprites/client.py +0 -2
- withruntime-0.45.0/withruntime/sprites/control.py +0 -65
- withruntime-0.45.0/withruntime/sprites/exceptions.py +0 -80
- withruntime-0.45.0/withruntime/sprites/exec.py +0 -80
- withruntime-0.45.0/withruntime/sprites/filesystem.py +0 -2
- withruntime-0.45.0/withruntime/sprites/sprite.py +0 -2
- withruntime-0.45.0/withruntime/sprites/types.py +0 -187
- withruntime-0.45.0/withruntime/tools.py +0 -202
- withruntime-0.45.0/withruntime/vercel/__init__.py +0 -12
- withruntime-0.45.0/withruntime/vercel/_async_io.py +0 -65
- withruntime-0.45.0/withruntime/vercel/_async_sandbox.py +0 -1029
- withruntime-0.45.0/withruntime/vercel/_core.py +0 -592
- withruntime-0.45.0/withruntime/vercel/_sync_io.py +0 -61
- withruntime-0.45.0/withruntime/vercel/_sync_sandbox.py +0 -1027
- withruntime-0.45.0/withruntime/vercel/api.py +0 -32
- withruntime-0.45.0/withruntime/vercel/sandbox/__init__.py +0 -50
- withruntime-0.45.0/withruntime/vercel/sandbox/sync.py +0 -36
- withruntime-0.45.0/withruntime/wallet.py +0 -72
- withruntime-0.45.0/withruntime/webhooks.py +0 -56
- withruntime-0.45.0/withruntime.egg-info/PKG-INFO +0 -352
- withruntime-0.45.0/withruntime.egg-info/SOURCES.txt +0 -439
- withruntime-0.45.0/withruntime.egg-info/entry_points.txt +0 -2
- withruntime-0.45.0/withruntime.egg-info/requires.txt +0 -18
- {withruntime-0.45.0 → withruntime-1.1.0}/LICENSE +0 -0
- {withruntime-0.45.0 → withruntime-1.1.0}/setup.cfg +0 -0
- {withruntime-0.45.0 → withruntime-1.1.0}/withruntime.egg-info/dependency_links.txt +0 -0
- {withruntime-0.45.0 → withruntime-1.1.0}/withruntime.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: withruntime
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Runtime Cloud: Linux sandboxes for agents. The typed client for every verb of the API.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://withruntime.com
|
|
7
|
+
Project-URL: Documentation, https://withruntime.com/docs
|
|
8
|
+
Project-URL: Source, https://github.com/withruntime/runtime/tree/main/sdks/python
|
|
9
|
+
Project-URL: Changelog, https://github.com/withruntime/runtime/blob/main/sdks/python/CHANGELOG.md
|
|
10
|
+
Keywords: sandbox,cloud,agents,microvm,firecracker,code-execution,mcp,browser,desktop,jupyter
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: httpx<1,>=0.27
|
|
15
|
+
Provides-Extra: keypair
|
|
16
|
+
Requires-Dist: cryptography>=42; extra == "keypair"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# withruntime
|
|
20
|
+
|
|
21
|
+
The official client for [Runtime Cloud](https://withruntime.com): Linux machines for AI agents and apps, each a
|
|
22
|
+
microVM with its own kernel, disk and network, created in milliseconds and billed for the CPU it uses and the memory
|
|
23
|
+
it holds. The client is generated from the API's OpenAPI description, so every product and every operation of
|
|
24
|
+
`https://api.withruntime.com/v2` is here, typed.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install withruntime
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Python 3.9 or later. The one dependency is httpx; `pip install withruntime[keypair]` adds signing with a key pair.
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
The client reads your API key from `RUNTIME_API_KEY`. Create a key at https://withruntime.com/account/keys and keep it
|
|
37
|
+
in a secret manager, never in source code or a URL. A key pair's `rtsk_` secret also works: the client signs each
|
|
38
|
+
request with it and never sends it.
|
|
39
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from withruntime import Sandbox
|
|
44
|
+
|
|
45
|
+
with Sandbox.create() as sbx:
|
|
46
|
+
sbx.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n")
|
|
47
|
+
result = sbx.exec("python3 /workspace/invoice.py")
|
|
48
|
+
print(result.exit_code, result.stdout) # 0 750
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Leaving the `with` block deletes the sandbox. `AsyncRuntime`, `AsyncSandbox` and the other `Async` classes are the
|
|
52
|
+
same for asyncio, with `async with` and `await`.
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import os
|
|
58
|
+
from withruntime import Runtime
|
|
59
|
+
|
|
60
|
+
runtime = Runtime(
|
|
61
|
+
api_key=os.environ["RUNTIME_API_KEY"], # the default
|
|
62
|
+
project="prj_...", # default: RUNTIME_PROJECT
|
|
63
|
+
base_url="https://api.withruntime.com", # default: RUNTIME_API_URL
|
|
64
|
+
max_retries=3,
|
|
65
|
+
)
|
|
66
|
+
sbx = runtime.sandboxes.create(vcpu=4, memory_gb=8)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Products
|
|
70
|
+
|
|
71
|
+
| Class | Create one | What it is |
|
|
72
|
+
| --- | --- | --- |
|
|
73
|
+
| `Sandbox` | `Sandbox.create()` | A Linux machine with its own kernel, made in milliseconds, paused with its memory kept when idle and resumed where it was. |
|
|
74
|
+
| `FunctionMachine` | `FunctionMachine.create()` | A machine that answers HTTP with a handler in /app/index.ts (`export default { fetch(request) }`, as Cloudflare Workers and Vercel take one) on port 8080, reached at its preview. |
|
|
75
|
+
| `App` | `App.create()` | A machine that keeps a web app in /app running on port 8080 (its Procfile's `web:`, else `npm start`, else `python3 app.py`, as Render and Heroku start one), reached at its preview. |
|
|
76
|
+
| `Site` | `Site.create()` | A machine that serves the static files in /site on port 8080 (as Netlify and Vercel serve a build's output), reached at its preview. |
|
|
77
|
+
| `CiMachine` | `CiMachine.create()` | A machine that runs a repository's checks to their end (its `run`) with git, Docker, Node, Bun, Python and a compiler, and is stopped then. |
|
|
78
|
+
| `Browser` | `Browser.create()` | A machine running headless Chromium, driven over the Chrome DevTools Protocol at its preview on port 9222: one WebSocket address for Playwright's `connectOverCDP` and Puppeteer's `connect`, as Browserbase gives one. |
|
|
79
|
+
| `Desktop` | `Desktop.create()` | A machine running a Linux desktop with Chromium, for agents that use a computer: screenshot returns what its screen shows and act moves and clicks its mouse and types on its keyboard. |
|
|
80
|
+
| `Notebook` | `Notebook.create()` | A machine running JupyterLab on port 8888 over /workspace, with NumPy, pandas and matplotlib, reached at its private preview. |
|
|
81
|
+
| `Workspace` | `Workspace.create()` | A development environment: a machine running VS Code in the browser (code-server) on port 8080 over /workspace, reached at its private preview, as Codespaces and Gitpod give one. |
|
|
82
|
+
| `Container` | `Container.create()` | A machine that runs one OCI image from any registry under Docker on its own network (`start` `runtime-container <image>`), the port it listens on reached at its preview, as Cloud Run and Fly Machines run one. |
|
|
83
|
+
| `Build` | `Build.create()` | The machine an image's build runs on: Docker's own builder (BuildKit), its run `runtime-image-build`, deleted once its image is made. |
|
|
84
|
+
| `Job` | `Job.create()` | A command run in a fresh machine, once or on a cron schedule in a timezone. |
|
|
85
|
+
| `Image` | `Image.create()` | What a machine boots: a root filesystem, its environment and its start. |
|
|
86
|
+
| `Volume` | `Volume.create()` | A disk that outlives the machines it is attached to. |
|
|
87
|
+
| `Domain` | `Domain.create()` | Your own hostname serving a machine's port, with HTTPS. |
|
|
88
|
+
|
|
89
|
+
Every machine (each class above with `files`) has `refresh`, `delete`, `pause`, `resume`, `exec`, `metrics`, `fork`, `snapshot`, `update`, `screenshot`, `act`, `run_code`, `spawn`, `files.read`, `files.write`, `files.remove`, `files.stat`, `files.list`, `files.download_folder`, `files.upload_folder`, `files.begin_folder_upload`, `files.write_folder_upload`, `files.commit_folder_upload`, `files.abort_folder_upload`, `files.mkdir`, `files.rename`, `files.link`, `files.revoke_links`, `processes.output`, `processes.write`, `processes.signal`, `processes.resize`, `processes.list`, `network.get`, `network.set`.
|
|
90
|
+
|
|
91
|
+
- `Sandbox` also has `exec_stream`, `previews.create`.
|
|
92
|
+
- `Job` also has `run`.
|
|
93
|
+
- `Image` also has `logs`.
|
|
94
|
+
- `Domain` also has `verify`.
|
|
95
|
+
|
|
96
|
+
The API's other resources (keys, projects, roles, secrets, snapshots, webhooks, usage and more) are clients on the
|
|
97
|
+
runtime object. The [API reference](https://withruntime.com/docs/reference) lists every operation.
|
|
98
|
+
|
|
99
|
+
## Errors
|
|
100
|
+
|
|
101
|
+
Every error the API returns is raised as a `RuntimeApiError` with `code`, `message`, `status`, `request_id`,
|
|
102
|
+
`hint`, `param` and `retryable`. Each error family has its own subclass, such as `NotFoundError`,
|
|
103
|
+
`InvalidRequestError`, `RateLimitedError` and `CapacityUnavailableError`:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from withruntime import NotFoundError
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
runtime.sandboxes.get("sbx_missing")
|
|
110
|
+
except NotFoundError as err:
|
|
111
|
+
print(err.code, err.request_id)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Retries and idempotency
|
|
115
|
+
|
|
116
|
+
The client retries a rate-limited (429) or unavailable (503) answer, and a lost connection on a call that is safe to send again, up to `max_retries` times (default 3). Every write sends an `Idempotency-Key` header, generated when you do not pass `idempotency_key`, so a retry never runs a write twice.
|
|
117
|
+
|
|
118
|
+
## Lists
|
|
119
|
+
|
|
120
|
+
A `list` call returns a page; iterating it yields every item across pages:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
for s in runtime.sandboxes.list(state="running"):
|
|
124
|
+
print(s.id)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Versioning
|
|
128
|
+
|
|
129
|
+
The package follows [Semantic Versioning](https://semver.org): a minor or patch release never breaks code written
|
|
130
|
+
for an earlier release of the same major version. Each request sends the API version the client was generated for in
|
|
131
|
+
the `Runtime-Version` header. Every release is listed in [CHANGELOG.md](CHANGELOG.md).
|
|
132
|
+
|
|
133
|
+
## Resources
|
|
134
|
+
|
|
135
|
+
- Guides: https://withruntime.com/docs
|
|
136
|
+
- API reference: https://withruntime.com/docs/reference
|
|
137
|
+
- Pricing: https://withruntime.com/pricing
|
|
138
|
+
- Status: https://status.withruntime.com
|
|
139
|
+
- Support: support@withruntime.com
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
Apache-2.0
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# withruntime
|
|
2
|
+
|
|
3
|
+
The official client for [Runtime Cloud](https://withruntime.com): Linux machines for AI agents and apps, each a
|
|
4
|
+
microVM with its own kernel, disk and network, created in milliseconds and billed for the CPU it uses and the memory
|
|
5
|
+
it holds. The client is generated from the API's OpenAPI description, so every product and every operation of
|
|
6
|
+
`https://api.withruntime.com/v2` is here, typed.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install withruntime
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Python 3.9 or later. The one dependency is httpx; `pip install withruntime[keypair]` adds signing with a key pair.
|
|
15
|
+
|
|
16
|
+
## Authentication
|
|
17
|
+
|
|
18
|
+
The client reads your API key from `RUNTIME_API_KEY`. Create a key at https://withruntime.com/account/keys and keep it
|
|
19
|
+
in a secret manager, never in source code or a URL. A key pair's `rtsk_` secret also works: the client signs each
|
|
20
|
+
request with it and never sends it.
|
|
21
|
+
|
|
22
|
+
## Quickstart
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from withruntime import Sandbox
|
|
26
|
+
|
|
27
|
+
with Sandbox.create() as sbx:
|
|
28
|
+
sbx.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n")
|
|
29
|
+
result = sbx.exec("python3 /workspace/invoice.py")
|
|
30
|
+
print(result.exit_code, result.stdout) # 0 750
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Leaving the `with` block deletes the sandbox. `AsyncRuntime`, `AsyncSandbox` and the other `Async` classes are the
|
|
34
|
+
same for asyncio, with `async with` and `await`.
|
|
35
|
+
|
|
36
|
+
## Configuration
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import os
|
|
40
|
+
from withruntime import Runtime
|
|
41
|
+
|
|
42
|
+
runtime = Runtime(
|
|
43
|
+
api_key=os.environ["RUNTIME_API_KEY"], # the default
|
|
44
|
+
project="prj_...", # default: RUNTIME_PROJECT
|
|
45
|
+
base_url="https://api.withruntime.com", # default: RUNTIME_API_URL
|
|
46
|
+
max_retries=3,
|
|
47
|
+
)
|
|
48
|
+
sbx = runtime.sandboxes.create(vcpu=4, memory_gb=8)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Products
|
|
52
|
+
|
|
53
|
+
| Class | Create one | What it is |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| `Sandbox` | `Sandbox.create()` | A Linux machine with its own kernel, made in milliseconds, paused with its memory kept when idle and resumed where it was. |
|
|
56
|
+
| `FunctionMachine` | `FunctionMachine.create()` | A machine that answers HTTP with a handler in /app/index.ts (`export default { fetch(request) }`, as Cloudflare Workers and Vercel take one) on port 8080, reached at its preview. |
|
|
57
|
+
| `App` | `App.create()` | A machine that keeps a web app in /app running on port 8080 (its Procfile's `web:`, else `npm start`, else `python3 app.py`, as Render and Heroku start one), reached at its preview. |
|
|
58
|
+
| `Site` | `Site.create()` | A machine that serves the static files in /site on port 8080 (as Netlify and Vercel serve a build's output), reached at its preview. |
|
|
59
|
+
| `CiMachine` | `CiMachine.create()` | A machine that runs a repository's checks to their end (its `run`) with git, Docker, Node, Bun, Python and a compiler, and is stopped then. |
|
|
60
|
+
| `Browser` | `Browser.create()` | A machine running headless Chromium, driven over the Chrome DevTools Protocol at its preview on port 9222: one WebSocket address for Playwright's `connectOverCDP` and Puppeteer's `connect`, as Browserbase gives one. |
|
|
61
|
+
| `Desktop` | `Desktop.create()` | A machine running a Linux desktop with Chromium, for agents that use a computer: screenshot returns what its screen shows and act moves and clicks its mouse and types on its keyboard. |
|
|
62
|
+
| `Notebook` | `Notebook.create()` | A machine running JupyterLab on port 8888 over /workspace, with NumPy, pandas and matplotlib, reached at its private preview. |
|
|
63
|
+
| `Workspace` | `Workspace.create()` | A development environment: a machine running VS Code in the browser (code-server) on port 8080 over /workspace, reached at its private preview, as Codespaces and Gitpod give one. |
|
|
64
|
+
| `Container` | `Container.create()` | A machine that runs one OCI image from any registry under Docker on its own network (`start` `runtime-container <image>`), the port it listens on reached at its preview, as Cloud Run and Fly Machines run one. |
|
|
65
|
+
| `Build` | `Build.create()` | The machine an image's build runs on: Docker's own builder (BuildKit), its run `runtime-image-build`, deleted once its image is made. |
|
|
66
|
+
| `Job` | `Job.create()` | A command run in a fresh machine, once or on a cron schedule in a timezone. |
|
|
67
|
+
| `Image` | `Image.create()` | What a machine boots: a root filesystem, its environment and its start. |
|
|
68
|
+
| `Volume` | `Volume.create()` | A disk that outlives the machines it is attached to. |
|
|
69
|
+
| `Domain` | `Domain.create()` | Your own hostname serving a machine's port, with HTTPS. |
|
|
70
|
+
|
|
71
|
+
Every machine (each class above with `files`) has `refresh`, `delete`, `pause`, `resume`, `exec`, `metrics`, `fork`, `snapshot`, `update`, `screenshot`, `act`, `run_code`, `spawn`, `files.read`, `files.write`, `files.remove`, `files.stat`, `files.list`, `files.download_folder`, `files.upload_folder`, `files.begin_folder_upload`, `files.write_folder_upload`, `files.commit_folder_upload`, `files.abort_folder_upload`, `files.mkdir`, `files.rename`, `files.link`, `files.revoke_links`, `processes.output`, `processes.write`, `processes.signal`, `processes.resize`, `processes.list`, `network.get`, `network.set`.
|
|
72
|
+
|
|
73
|
+
- `Sandbox` also has `exec_stream`, `previews.create`.
|
|
74
|
+
- `Job` also has `run`.
|
|
75
|
+
- `Image` also has `logs`.
|
|
76
|
+
- `Domain` also has `verify`.
|
|
77
|
+
|
|
78
|
+
The API's other resources (keys, projects, roles, secrets, snapshots, webhooks, usage and more) are clients on the
|
|
79
|
+
runtime object. The [API reference](https://withruntime.com/docs/reference) lists every operation.
|
|
80
|
+
|
|
81
|
+
## Errors
|
|
82
|
+
|
|
83
|
+
Every error the API returns is raised as a `RuntimeApiError` with `code`, `message`, `status`, `request_id`,
|
|
84
|
+
`hint`, `param` and `retryable`. Each error family has its own subclass, such as `NotFoundError`,
|
|
85
|
+
`InvalidRequestError`, `RateLimitedError` and `CapacityUnavailableError`:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from withruntime import NotFoundError
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
runtime.sandboxes.get("sbx_missing")
|
|
92
|
+
except NotFoundError as err:
|
|
93
|
+
print(err.code, err.request_id)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Retries and idempotency
|
|
97
|
+
|
|
98
|
+
The client retries a rate-limited (429) or unavailable (503) answer, and a lost connection on a call that is safe to send again, up to `max_retries` times (default 3). Every write sends an `Idempotency-Key` header, generated when you do not pass `idempotency_key`, so a retry never runs a write twice.
|
|
99
|
+
|
|
100
|
+
## Lists
|
|
101
|
+
|
|
102
|
+
A `list` call returns a page; iterating it yields every item across pages:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
for s in runtime.sandboxes.list(state="running"):
|
|
106
|
+
print(s.id)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Versioning
|
|
110
|
+
|
|
111
|
+
The package follows [Semantic Versioning](https://semver.org): a minor or patch release never breaks code written
|
|
112
|
+
for an earlier release of the same major version. Each request sends the API version the client was generated for in
|
|
113
|
+
the `Runtime-Version` header. Every release is listed in [CHANGELOG.md](CHANGELOG.md).
|
|
114
|
+
|
|
115
|
+
## Resources
|
|
116
|
+
|
|
117
|
+
- Guides: https://withruntime.com/docs
|
|
118
|
+
- API reference: https://withruntime.com/docs/reference
|
|
119
|
+
- Pricing: https://withruntime.com/pricing
|
|
120
|
+
- Status: https://status.withruntime.com
|
|
121
|
+
- Support: support@withruntime.com
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
Apache-2.0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "withruntime"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "Runtime Cloud: Linux sandboxes for agents. The typed client for every verb of the API."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
keywords = ["sandbox", "cloud", "agents", "microvm", "firecracker", "code-execution", "mcp", "browser", "desktop", "jupyter"]
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
dependencies = ["httpx>=0.27,<1"]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
keypair = ["cryptography>=42"]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://withruntime.com"
|
|
20
|
+
Documentation = "https://withruntime.com/docs"
|
|
21
|
+
Source = "https://github.com/withruntime/runtime/tree/main/sdks/python"
|
|
22
|
+
Changelog = "https://github.com/withruntime/runtime/blob/main/sdks/python/CHANGELOG.md"
|
|
23
|
+
|
|
24
|
+
[tool.setuptools.packages.find]
|
|
25
|
+
where = ["."]
|
|
26
|
+
include = ["withruntime*"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "1.1.0"
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
|
+
# change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
|
+
|
|
4
|
+
"""Runtime: every product's client over one transport. ``Runtime()`` reads
|
|
5
|
+
RUNTIME_API_KEY; ``runtime.sandboxes.create()`` is a sandbox to work in.
|
|
6
|
+
``AsyncRuntime()`` is the same for asyncio."""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict, List, Optional, Union
|
|
11
|
+
|
|
12
|
+
from ._runtime import (API_VERSION, MAX_RETRIES, AsyncPage, AsyncStream, AsyncTransport, Page, RuntimeApiError, Stream,
|
|
13
|
+
Transport, route_call, routes_of)
|
|
14
|
+
from ._runtime import InvalidRequestError, UnauthorizedError, PaymentRequiredError, CardRequiredError, ForbiddenError, LimitExceededError, NotFoundError, MethodNotAllowedError, AlreadyExistsError, ConflictError, TooLargeError, RateLimitedError, InternalError, ApiNotImplementedError, UnavailableError, CapacityUnavailableError, ApiTimeoutError
|
|
15
|
+
from ._routes import ROUTES
|
|
16
|
+
from .sandboxes import MachineStart, VolumeMount, SandboxRun, NetworkRules, SandboxSettings, SandboxCreate, MachineReady, SandboxInfo, Terminal, ExecRequest, Process, ExecEventError, ExecEvent, FileWritten, OutputChunk, ProcessOutput, ProcessInput, ProcessWritten, ProcessSignal, ProcessList, FileRemove, FileRemoved, FileInfo, FileList, FolderUnpacked, FolderUploadBegin, FolderUpload, FolderUploadReceived, FolderUploadAborted, FileMkdir, FileMade, FileRename, FileRenamed, FileLinkCreate, FileLink, FileLinksRevoked, SandboxNetwork, MetricPoint, MetricsBase, SandboxMetrics, ForkRequest, Forked, SnapshotRequest, Stored, MachineUpdate, Action, ActRequest, Point, ScreenSize, Acted, RunCode, CodeResult, CodeError, CodeRun, Sandboxes, Sandbox, AsyncSandboxes, AsyncSandbox
|
|
17
|
+
from .functions import Functions, FunctionMachine, AsyncFunctions, AsyncFunctionMachine
|
|
18
|
+
from .secrets import SecretScope, SecretRule, SecretGit, SecretGraphql, SecretApi, SecretPolicies, SecretSettings, SecretInfo, SecretSet, Secrets, Secret, AsyncSecrets, AsyncSecret
|
|
19
|
+
from .apps import Apps, App, AsyncApps, AsyncApp
|
|
20
|
+
from .sites import Sites, Site, AsyncSites, AsyncSite
|
|
21
|
+
from .ci import Ci, CiMachine, AsyncCi, AsyncCiMachine
|
|
22
|
+
from .browsers import Browsers, Browser, AsyncBrowsers, AsyncBrowser
|
|
23
|
+
from .desktops import Desktops, Desktop, AsyncDesktops, AsyncDesktop
|
|
24
|
+
from .notebooks import Notebooks, Notebook, AsyncNotebooks, AsyncNotebook
|
|
25
|
+
from .workspaces import Workspaces, Workspace, AsyncWorkspaces, AsyncWorkspace
|
|
26
|
+
from .containers import Containers, Container, AsyncContainers, AsyncContainer
|
|
27
|
+
from .builds import Builds, Build, AsyncBuilds, AsyncBuild
|
|
28
|
+
from .jobs import JobSchedule, JobRetry, JobSecrets, JobSettings, JobCreate, JobError, JobInfo, Jobs, Job, AsyncJobs, AsyncJob
|
|
29
|
+
from .job_runs import JobRun, JobRunOutput, JobRuns, AsyncJobRuns
|
|
30
|
+
from .agents import AgentTool, McpServer, AgentSettings, AgentCreate, AgentInfo, AgentStart, Agents, Agent, AsyncAgents, AsyncAgent
|
|
31
|
+
from .agent_sessions import AgentSessions, AsyncAgentSessions
|
|
32
|
+
from .messages import Message, SessionMessages, AskAnswer, MessageSend, Messages, AsyncMessages
|
|
33
|
+
from .snapshots import StoredUpdate, Snapshots, Snapshot, AsyncSnapshots, AsyncSnapshot
|
|
34
|
+
from .images import ContextAsked, ContextMissing, ChunkStored, ImageFile, ImageRecipe, ImageArchive, ImageContextFile, ImageContext, ImageBuild, ImageCreate, ImageLogLine, ImageLogs, Images, Image, AsyncImages, AsyncImage
|
|
35
|
+
from .volumes import VolumeCreate, Volumes, Volume, AsyncVolumes, AsyncVolume
|
|
36
|
+
from .sessions import SessionCreate, Session, SessionCreated, Sessions, AsyncSessions
|
|
37
|
+
from .keys import Key, KeyAuthorization, KeyCreate, KeyCreated, KeyUpdate, Keys, AsyncKeys
|
|
38
|
+
from .projects import ProjectLimits, Project, ProjectCreate, ProjectLimitsSet, Rename, Projects, AsyncProjects
|
|
39
|
+
from .identities import Identity, Identities, AsyncIdentities
|
|
40
|
+
from .roles import Role, RoleActionsChange, Roles, AsyncRoles
|
|
41
|
+
from .audit import AuditLine, Audit, AsyncAudit
|
|
42
|
+
from .me import Me, MeClient, AsyncMeClient
|
|
43
|
+
from .usage import MeterUse, Limit, KeyUsage, KeySpendCap, UsageHour, ProductLine, KeySpend, Usage, UsageLine, UsageExport, UsageClient, AsyncUsageClient
|
|
44
|
+
from .previews import PreviewCreate, PreviewInfo, Previews, Preview, AsyncPreviews, AsyncPreview
|
|
45
|
+
from .domains import DomainCreate, DomainSettings, DomainInfo, Domains, Domain, AsyncDomains, AsyncDomain
|
|
46
|
+
from .ports import PortCreate, PortSettings, Port, Ports, AsyncPorts
|
|
47
|
+
from .egress_ips import EgressIpSettings, EgressIp, EgressIps, AsyncEgressIps
|
|
48
|
+
from .tunnels import TunnelPeer, TunnelMember, TunnelSettings, Tunnel, Tunnels, AsyncTunnels
|
|
49
|
+
from .networks import NetworkSettings, Network, Networks, AsyncNetworks
|
|
50
|
+
from .webhooks import WebhookCreate, Webhook, Webhooks, AsyncWebhooks
|
|
51
|
+
from .events import Event, Events, AsyncEvents
|
|
52
|
+
from .otel import ExportCreate, Export, Otel, AsyncOtel
|
|
53
|
+
from .feedback import FeedbackCreate, Feedback, FeedbackClient, AsyncFeedbackClient
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Runtime:
|
|
57
|
+
"""Every product's client over one transport."""
|
|
58
|
+
|
|
59
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None, max_retries: int = MAX_RETRIES, project: Optional[str] = None) -> None:
|
|
60
|
+
self.transport = Transport(api_key=api_key, base_url=base_url, max_retries=max_retries, project=project)
|
|
61
|
+
self.sandboxes = Sandboxes(self.transport)
|
|
62
|
+
self.functions = Functions(self.transport)
|
|
63
|
+
self.secrets = Secrets(self.transport)
|
|
64
|
+
self.apps = Apps(self.transport)
|
|
65
|
+
self.sites = Sites(self.transport)
|
|
66
|
+
self.ci = Ci(self.transport)
|
|
67
|
+
self.browsers = Browsers(self.transport)
|
|
68
|
+
self.desktops = Desktops(self.transport)
|
|
69
|
+
self.notebooks = Notebooks(self.transport)
|
|
70
|
+
self.workspaces = Workspaces(self.transport)
|
|
71
|
+
self.containers = Containers(self.transport)
|
|
72
|
+
self.builds = Builds(self.transport)
|
|
73
|
+
self.jobs = Jobs(self.transport)
|
|
74
|
+
self.job_runs = JobRuns(self.transport)
|
|
75
|
+
self.agents = Agents(self.transport)
|
|
76
|
+
self.agent_sessions = AgentSessions(self.transport)
|
|
77
|
+
self.messages = Messages(self.transport)
|
|
78
|
+
self.snapshots = Snapshots(self.transport)
|
|
79
|
+
self.images = Images(self.transport)
|
|
80
|
+
self.volumes = Volumes(self.transport)
|
|
81
|
+
self.sessions = Sessions(self.transport)
|
|
82
|
+
self.keys = Keys(self.transport)
|
|
83
|
+
self.projects = Projects(self.transport)
|
|
84
|
+
self.identities = Identities(self.transport)
|
|
85
|
+
self.roles = Roles(self.transport)
|
|
86
|
+
self.audit = Audit(self.transport)
|
|
87
|
+
self.me = MeClient(self.transport)
|
|
88
|
+
self.usage = UsageClient(self.transport)
|
|
89
|
+
self.previews = Previews(self.transport)
|
|
90
|
+
self.domains = Domains(self.transport)
|
|
91
|
+
self.ports = Ports(self.transport)
|
|
92
|
+
self.egress_ips = EgressIps(self.transport)
|
|
93
|
+
self.tunnels = Tunnels(self.transport)
|
|
94
|
+
self.networks = Networks(self.transport)
|
|
95
|
+
self.webhooks = Webhooks(self.transport)
|
|
96
|
+
self.events = Events(self.transport)
|
|
97
|
+
self.otel = Otel(self.transport)
|
|
98
|
+
self.feedback = FeedbackClient(self.transport)
|
|
99
|
+
self._served: Optional[Dict[str, Dict[str, Any]]] = None
|
|
100
|
+
|
|
101
|
+
def close(self) -> None:
|
|
102
|
+
self.transport.close()
|
|
103
|
+
|
|
104
|
+
def __enter__(self) -> "Runtime":
|
|
105
|
+
return self
|
|
106
|
+
|
|
107
|
+
def __exit__(self, *exc: Any) -> None:
|
|
108
|
+
self.close()
|
|
109
|
+
|
|
110
|
+
def call(self, name: str, args: Optional[Dict[str, Any]] = None, idempotency_key: Optional[str] = None) -> Any:
|
|
111
|
+
"""Calls any verb by its name, `product.verb` (`sandboxes.create`), with
|
|
112
|
+
its arguments by name: its path's parts, its query's fields and its
|
|
113
|
+
body's. A verb newer than this SDK is found in the API's own served
|
|
114
|
+
description, so it is callable before the SDK is updated."""
|
|
115
|
+
route = ROUTES.get(name)
|
|
116
|
+
if route is None:
|
|
117
|
+
if self._served is None:
|
|
118
|
+
self._served = routes_of(self.transport.request("GET", "/v2/openapi.json", idempotent=True))
|
|
119
|
+
route = self._served.get(name)
|
|
120
|
+
if route is None:
|
|
121
|
+
raise TypeError(f"No verb {name}: GET /v2/openapi.json names each.")
|
|
122
|
+
path, how = route_call(route, args or {})
|
|
123
|
+
return self.transport.request(route["method"], path, idempotency_key=idempotency_key, **how)
|
|
124
|
+
|
|
125
|
+
def run(self, *, cmd: Union[str, List[str]], image: Optional[str] = None, vcpu: Optional[int] = None, memory_gb: Optional[float] = None, cwd: Optional[str] = None, env: Optional[Dict[str, str]] = None, stdin: Optional[str] = None, timeout_seconds: Optional[float] = None) -> Any:
|
|
126
|
+
"""Runs a command in a new sandbox and deletes the sandbox after, whether the command succeeded or not. Returns the command's result."""
|
|
127
|
+
a0 = self.call("sandboxes.create", {"image": image, "vcpu": vcpu, "memoryGB": memory_gb})
|
|
128
|
+
try:
|
|
129
|
+
a1 = self.call("sandboxes.exec", {"id": a0["id"], "cmd": cmd, "cwd": cwd, "env": env, "stdin": stdin, "timeoutSeconds": timeout_seconds})
|
|
130
|
+
return a1
|
|
131
|
+
finally:
|
|
132
|
+
self.call("sandboxes.delete", {"id": a0["id"]})
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class AsyncRuntime:
|
|
136
|
+
"""Every product's client over one transport."""
|
|
137
|
+
|
|
138
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None, max_retries: int = MAX_RETRIES, project: Optional[str] = None) -> None:
|
|
139
|
+
self.transport = AsyncTransport(api_key=api_key, base_url=base_url, max_retries=max_retries, project=project)
|
|
140
|
+
self.sandboxes = AsyncSandboxes(self.transport)
|
|
141
|
+
self.functions = AsyncFunctions(self.transport)
|
|
142
|
+
self.secrets = AsyncSecrets(self.transport)
|
|
143
|
+
self.apps = AsyncApps(self.transport)
|
|
144
|
+
self.sites = AsyncSites(self.transport)
|
|
145
|
+
self.ci = AsyncCi(self.transport)
|
|
146
|
+
self.browsers = AsyncBrowsers(self.transport)
|
|
147
|
+
self.desktops = AsyncDesktops(self.transport)
|
|
148
|
+
self.notebooks = AsyncNotebooks(self.transport)
|
|
149
|
+
self.workspaces = AsyncWorkspaces(self.transport)
|
|
150
|
+
self.containers = AsyncContainers(self.transport)
|
|
151
|
+
self.builds = AsyncBuilds(self.transport)
|
|
152
|
+
self.jobs = AsyncJobs(self.transport)
|
|
153
|
+
self.job_runs = AsyncJobRuns(self.transport)
|
|
154
|
+
self.agents = AsyncAgents(self.transport)
|
|
155
|
+
self.agent_sessions = AsyncAgentSessions(self.transport)
|
|
156
|
+
self.messages = AsyncMessages(self.transport)
|
|
157
|
+
self.snapshots = AsyncSnapshots(self.transport)
|
|
158
|
+
self.images = AsyncImages(self.transport)
|
|
159
|
+
self.volumes = AsyncVolumes(self.transport)
|
|
160
|
+
self.sessions = AsyncSessions(self.transport)
|
|
161
|
+
self.keys = AsyncKeys(self.transport)
|
|
162
|
+
self.projects = AsyncProjects(self.transport)
|
|
163
|
+
self.identities = AsyncIdentities(self.transport)
|
|
164
|
+
self.roles = AsyncRoles(self.transport)
|
|
165
|
+
self.audit = AsyncAudit(self.transport)
|
|
166
|
+
self.me = AsyncMeClient(self.transport)
|
|
167
|
+
self.usage = AsyncUsageClient(self.transport)
|
|
168
|
+
self.previews = AsyncPreviews(self.transport)
|
|
169
|
+
self.domains = AsyncDomains(self.transport)
|
|
170
|
+
self.ports = AsyncPorts(self.transport)
|
|
171
|
+
self.egress_ips = AsyncEgressIps(self.transport)
|
|
172
|
+
self.tunnels = AsyncTunnels(self.transport)
|
|
173
|
+
self.networks = AsyncNetworks(self.transport)
|
|
174
|
+
self.webhooks = AsyncWebhooks(self.transport)
|
|
175
|
+
self.events = AsyncEvents(self.transport)
|
|
176
|
+
self.otel = AsyncOtel(self.transport)
|
|
177
|
+
self.feedback = AsyncFeedbackClient(self.transport)
|
|
178
|
+
self._served: Optional[Dict[str, Dict[str, Any]]] = None
|
|
179
|
+
|
|
180
|
+
async def close(self) -> None:
|
|
181
|
+
await self.transport.close()
|
|
182
|
+
|
|
183
|
+
async def __aenter__(self) -> "AsyncRuntime":
|
|
184
|
+
return self
|
|
185
|
+
|
|
186
|
+
async def __aexit__(self, *exc: Any) -> None:
|
|
187
|
+
await self.close()
|
|
188
|
+
|
|
189
|
+
async def call(self, name: str, args: Optional[Dict[str, Any]] = None, idempotency_key: Optional[str] = None) -> Any:
|
|
190
|
+
"""Calls any verb by its name, `product.verb` (`sandboxes.create`), with
|
|
191
|
+
its arguments by name: its path's parts, its query's fields and its
|
|
192
|
+
body's. A verb newer than this SDK is found in the API's own served
|
|
193
|
+
description, so it is callable before the SDK is updated."""
|
|
194
|
+
route = ROUTES.get(name)
|
|
195
|
+
if route is None:
|
|
196
|
+
if self._served is None:
|
|
197
|
+
self._served = routes_of(await self.transport.request("GET", "/v2/openapi.json", idempotent=True))
|
|
198
|
+
route = self._served.get(name)
|
|
199
|
+
if route is None:
|
|
200
|
+
raise TypeError(f"No verb {name}: GET /v2/openapi.json names each.")
|
|
201
|
+
path, how = route_call(route, args or {})
|
|
202
|
+
return await self.transport.request(route["method"], path, idempotency_key=idempotency_key, **how)
|
|
203
|
+
|
|
204
|
+
async def run(self, *, cmd: Union[str, List[str]], image: Optional[str] = None, vcpu: Optional[int] = None, memory_gb: Optional[float] = None, cwd: Optional[str] = None, env: Optional[Dict[str, str]] = None, stdin: Optional[str] = None, timeout_seconds: Optional[float] = None) -> Any:
|
|
205
|
+
"""Runs a command in a new sandbox and deletes the sandbox after, whether the command succeeded or not. Returns the command's result."""
|
|
206
|
+
a0 = await self.call("sandboxes.create", {"image": image, "vcpu": vcpu, "memoryGB": memory_gb})
|
|
207
|
+
try:
|
|
208
|
+
a1 = await self.call("sandboxes.exec", {"id": a0["id"], "cmd": cmd, "cwd": cwd, "env": env, "stdin": stdin, "timeoutSeconds": timeout_seconds})
|
|
209
|
+
return a1
|
|
210
|
+
finally:
|
|
211
|
+
await self.call("sandboxes.delete", {"id": a0["id"]})
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
__all__ = ["API_VERSION", "AsyncPage", "AsyncRuntime", "AsyncStream", "Page", "Runtime", "RuntimeApiError", "Stream", "Transport", "AsyncTransport", "InvalidRequestError", "UnauthorizedError", "PaymentRequiredError", "CardRequiredError", "ForbiddenError", "LimitExceededError", "NotFoundError", "MethodNotAllowedError", "AlreadyExistsError", "ConflictError", "TooLargeError", "RateLimitedError", "InternalError", "ApiNotImplementedError", "UnavailableError", "CapacityUnavailableError", "ApiTimeoutError", "MachineStart", "VolumeMount", "SandboxRun", "NetworkRules", "SandboxSettings", "SandboxCreate", "MachineReady", "SandboxInfo", "Terminal", "ExecRequest", "Process", "ExecEventError", "ExecEvent", "FileWritten", "OutputChunk", "ProcessOutput", "ProcessInput", "ProcessWritten", "ProcessSignal", "ProcessList", "FileRemove", "FileRemoved", "FileInfo", "FileList", "FolderUnpacked", "FolderUploadBegin", "FolderUpload", "FolderUploadReceived", "FolderUploadAborted", "FileMkdir", "FileMade", "FileRename", "FileRenamed", "FileLinkCreate", "FileLink", "FileLinksRevoked", "SandboxNetwork", "MetricPoint", "MetricsBase", "SandboxMetrics", "ForkRequest", "Forked", "SnapshotRequest", "Stored", "MachineUpdate", "Action", "ActRequest", "Point", "ScreenSize", "Acted", "RunCode", "CodeResult", "CodeError", "CodeRun", "Sandboxes", "Sandbox", "AsyncSandboxes", "AsyncSandbox", "Functions", "FunctionMachine", "AsyncFunctions", "AsyncFunctionMachine", "SecretScope", "SecretRule", "SecretGit", "SecretGraphql", "SecretApi", "SecretPolicies", "SecretSettings", "SecretInfo", "SecretSet", "Secrets", "Secret", "AsyncSecrets", "AsyncSecret", "Apps", "App", "AsyncApps", "AsyncApp", "Sites", "Site", "AsyncSites", "AsyncSite", "Ci", "CiMachine", "AsyncCi", "AsyncCiMachine", "Browsers", "Browser", "AsyncBrowsers", "AsyncBrowser", "Desktops", "Desktop", "AsyncDesktops", "AsyncDesktop", "Notebooks", "Notebook", "AsyncNotebooks", "AsyncNotebook", "Workspaces", "Workspace", "AsyncWorkspaces", "AsyncWorkspace", "Containers", "Container", "AsyncContainers", "AsyncContainer", "Builds", "Build", "AsyncBuilds", "AsyncBuild", "JobSchedule", "JobRetry", "JobSecrets", "JobSettings", "JobCreate", "JobError", "JobInfo", "Jobs", "Job", "AsyncJobs", "AsyncJob", "JobRun", "JobRunOutput", "JobRuns", "AsyncJobRuns", "AgentTool", "McpServer", "AgentSettings", "AgentCreate", "AgentInfo", "AgentStart", "Agents", "Agent", "AsyncAgents", "AsyncAgent", "AgentSessions", "AsyncAgentSessions", "Message", "SessionMessages", "AskAnswer", "MessageSend", "Messages", "AsyncMessages", "StoredUpdate", "Snapshots", "Snapshot", "AsyncSnapshots", "AsyncSnapshot", "ContextAsked", "ContextMissing", "ChunkStored", "ImageFile", "ImageRecipe", "ImageArchive", "ImageContextFile", "ImageContext", "ImageBuild", "ImageCreate", "ImageLogLine", "ImageLogs", "Images", "Image", "AsyncImages", "AsyncImage", "VolumeCreate", "Volumes", "Volume", "AsyncVolumes", "AsyncVolume", "SessionCreate", "Session", "SessionCreated", "Sessions", "AsyncSessions", "Key", "KeyAuthorization", "KeyCreate", "KeyCreated", "KeyUpdate", "Keys", "AsyncKeys", "ProjectLimits", "Project", "ProjectCreate", "ProjectLimitsSet", "Rename", "Projects", "AsyncProjects", "Identity", "Identities", "AsyncIdentities", "Role", "RoleActionsChange", "Roles", "AsyncRoles", "AuditLine", "Audit", "AsyncAudit", "Me", "MeClient", "AsyncMeClient", "MeterUse", "Limit", "KeyUsage", "KeySpendCap", "UsageHour", "ProductLine", "KeySpend", "Usage", "UsageLine", "UsageExport", "UsageClient", "AsyncUsageClient", "PreviewCreate", "PreviewInfo", "Previews", "Preview", "AsyncPreviews", "AsyncPreview", "DomainCreate", "DomainSettings", "DomainInfo", "Domains", "Domain", "AsyncDomains", "AsyncDomain", "PortCreate", "PortSettings", "Port", "Ports", "AsyncPorts", "EgressIpSettings", "EgressIp", "EgressIps", "AsyncEgressIps", "TunnelPeer", "TunnelMember", "TunnelSettings", "Tunnel", "Tunnels", "AsyncTunnels", "NetworkSettings", "Network", "Networks", "AsyncNetworks", "WebhookCreate", "Webhook", "Webhooks", "AsyncWebhooks", "Event", "Events", "AsyncEvents", "ExportCreate", "Export", "Otel", "AsyncOtel", "FeedbackCreate", "Feedback", "FeedbackClient", "AsyncFeedbackClient"]
|