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().
Constructors
Config.from_env()reads the environment and requiresSAIL_API_KEY, raisingValueErrorif 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.voyageno-op mode) that should not crash when no key is configured.
Attributes
| Attribute | Description |
|---|---|
api_key | The Sail API key (sk_...). |
api_url | Base 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_MODE | api_url |
|---|---|
prod (default) | https://api.sailresearch.com |
dev | https://dev.sailresearch.com |
staging | https://staging.sailresearch.com |
local | http://localhost:8080 |
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 serverRetry-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.