Skip to main content
Most applications configure the SDK entirely through environment variables — set SAIL_API_KEY (and optionally SAIL_MODE) and you’re done. sail.Config holds the configuration the SDK resolves from those variables, and is exported so you can inspect what the SDK is talking to.

sail.Config

Config holds the resolved SDK configuration: the API key and the API URL the SDK talks to. It is normally built from the environment with Config.from_env().
import sail

config = sail.Config.from_env()
print(config.api_url)  # https://api.sailresearch.com (prod default)

Constructors

@classmethod
def from_env() -> Config

@classmethod
def from_env_optional_api_key() -> Config
  • Config.from_env() reads the environment and requires SAIL_API_KEY, raising ValueError if it is unset. This is what Sailbox, App, and Image calls use.
  • Config.from_env_optional_api_key() is the same, but does not require an API key — used by diagnostic paths (e.g. sail.voyage no-op mode) that should not crash when no key is configured.

Attributes

AttributeDescription
api_keyThe Sail API key (sk_...).
api_urlBase URL for inference, voyages, and apps.

Modes and endpoint resolution

SAIL_MODE selects a named environment; when unset, prod defaults are used. An unrecognized value raises ValueError.
SAIL_MODEapi_url
prod (default)https://api.sailresearch.com
devhttps://dev.sailresearch.com
staginghttps://staging.sailresearch.com
localhttp://localhost:8080
The API URL can be overridden directly with the SAIL_API_URL environment variable, which takes precedence over the mode default.
For the full list of SDK environment variables, including the Voyage and agent attribution variables, see the Voyages environment table.

Retries

The SDK retries transient failures automatically. By default it makes up to 3 attempts with exponential backoff and full jitter, honoring a server Retry-After when one is present:
  • 502 / 503 / 504 are always retried.
  • 429 is retried only when the response includes a valid Retry-After.
  • 500 and other statuses are surfaced immediately, without a retry.
sail.RetryPolicy describes this policy, and sail.DEFAULT_RETRY_POLICY (the standard policy above) and sail.NO_RETRY (a single attempt) are the two built-in instances. They’re exported so you can inspect the retry behavior; the SDK manages retries for you, so there’s nothing to configure per call.