Skip to main content
You are currently viewing documentation for version 2.62.0 of the E2B SDK (Python).View the latest version of this page.

E2BClientParams

Params bound to an :class: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 marked Should-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 to E2B_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 to E2B_DOMAIN environment variable.

api_url

URL to use for the API, defaults to E2B_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 to E2B_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 to E2B_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 to E2B_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.

E2B

E2B client with an explicitly bound connection configuration. The resource classes exposed by the client (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__

Create a new client with the API params bound to it. Arguments:
  • opts: API params used as the defaults for every call made through this client’s resource classes.