Skip to main content
Version: 0.5.0


This document describes how to authenticate with the Seaplane SDK and the built-in components such as data stores or models. In general, we recommend you store authentication secrets inside the seaplane secrets store. This allows your apps to read them from environment variables and avoids unnecessary security risks of hard-coding secrets inside your project.

General Authentication

Seaplane automatically creates environment variables and stores them inside the Seaplane secrets store for each secret defined inside your projects .env file. For example, assume you have the following .env file.


Seaplane automatically checks for an environment variable with the name SEAPLANE_API_KEY to authenticate with the Seaplane SDK.

During deployment, Seaplane creates the additional secrets as environment variables. You can load them inside your application as follows using os.getenv()
from seaplane.apps import task
import os

def my_sql_task(context):

# load API keys from environment variables
open_ai_key = os.getenv('OPEN_AI_API_KEY')
external_key = os.getenv('MY_EXTERNAL_SERVICE')

Setting API Keys Manually

Alternatively, you can set the API key manually. Import config from the Seaplane package and call the set_api_key method inside your file as follows.


For security reasons, setting API keys manually should be avoided. We always recommend using the .env file when possible.

from seaplane.config import config
import os


You can set multiple keys all at once by calling the config.set_api_keys() method with an API key object. By doing so you can set the Seaplane API key and any external service API keys at the same time.

from seaplane.config import config

api_keys = {


Using Multiple .env Files

Seaplane supports the use of multiple environment files. This enables you to deploy the same app in different environments or with different variables. For example, you can use a staging.env file for your staging environment and production.env for your production environment.

By default, Seaplane uses .env to deploy your application. You can override this behavior by setting your preferred .env file as a local environment variable by executing the following command.

export SEAPLANE_ENV_FILE=my-env-file

For example, you can tell Seaplane to use your staging.env file as follows:

export SEAPLANE_ENV_FILE=staging.env

Deploying the same app in multiple tenants can get confusing as all tasks will have the same name. Use the SEAPLANE_NAME_PREFIX environment variable inside each .env file to identify between various deployments without changing the task or app names in your Python code. For example, add the following line to your staging.env file to prepend all tasks and app names with staging_.