E2BClientParams
E2B client, used as the defaults for every
call made through its resource classes. Same shape as :class:ApiParams.
request_timeout
Timeout for the request in seconds, defaults to 60 seconds.retries
Number of control-plane retries for responses markedShould-Retry: true,
or 429/502/503/504 responses without that header. Should-Retry: false is
never retried. Waits for valid Retry-After delta-seconds, otherwise
exponential backoff with jitter from 0.1 to 10 seconds. Connection failures
are retried separately; see E2B_CONNECTION_RETRIES. Network errors after
the request is sent (e.g. a dropped connection) are not retried.
A retry is skipped when its wait would exhaust the request timeout.
Retry waits use a 60-second total limit when request timeouts are disabled.
Set to 0 to disable retries. Defaults to 3 retries.
Raises:
InvalidArgumentException: if the value is negative or not an integer.
headers
Additional headers to send with the request. Deprecated, use api_headers instead.api_headers
Additional headers to send with E2B API requests.api_key
E2B API Key to use for authentication, defaults toE2B_API_KEY environment variable.
validate_api_key
Deprecated: the API key format is no longer validated on the client side; this option has no effect.domain
E2B domain to use for authentication, defaults toE2B_DOMAIN environment variable.
api_url
URL to use for the API, defaults toE2B_API_URL environment variable or https://api.<domain>. For internal use only.
:deprecated: api_url and the E2B_API_URL environment variable will be removed in the next major version.
debug
Whether to use debug mode, defaults toE2B_DEBUG environment variable.
proxy
Proxy to use for the request. In case of a sandbox it applies to all requests made to the returned sandbox.sandbox_url
URL to connect to sandbox, defaults toE2B_SANDBOX_URL environment variable.
:deprecated: sandbox_url and the E2B_SANDBOX_URL environment variable will be removed in the next major version.
http_version
HTTP version for requests to the E2B API and to sandboxes (commands, filesystem, PTY), defaults toE2B_HTTP_VERSION environment variable or
"2". "1.1" pins them to HTTP/1.1, which
uses one connection per concurrent request instead of multiplexing streams
over shared connections — for example when an intermediary on the path
retires or mishandles long-lived HTTP/2 connections. In the Python SDK,
file downloads (files.read) always use HTTP/1.1, overriding this
option, to work around an HTTP/2 empty-DATA-frame limit in the
underlying transport.
E2B
Sandbox, AsyncSandbox,
Volume, AsyncVolume, Template, AsyncTemplate, Secret,
AsyncSecret) behave exactly like the top-level exports of the same name,
except the params passed to the client are used as the defaults instead of
the environment variables.
Per-call params still take precedence over the client’s params.
Multiple clients are fully isolated from each other and from the top-level
env-configured exports.
Example:
__init__
opts: API params used as the defaults for every call made through this client’s resource classes.