Skip to main content

Authentication

The SDK reads your API key from CUSTODIAN_SDK_API_KEY and sends it as X-API-Key.

export CUSTODIAN_SDK_API_KEY="custodian_labs_..."
# PowerShell: $env:CUSTODIAN_SDK_API_KEY="custodian_labs_..."
from custodian_labs import Custodian

# key picked up from the environment
app = Custodian(model="gpt-4o", system_prompt="You are helpful.").deploy()

The SDK doesn't load .env files — load yours (e.g. python-dotenv) before creating SDK objects.

Overrides​

VariableDefault
CUSTODIAN_SDK_API_KEY—
CUSTODIAN_SDK_BASE_URLhttps://platform.custodianlabs.io/v1

Or pass them directly (wins over the environment) — useful when one process handles multiple keys or environments:

Custodian(
model="gpt-4o",
system_prompt="You are helpful.",
api_key="custodian_labs_...",
base_url="https://platform.custodianlabs.io/v1",
)

CustodianBuilder is environment-only — no api_key / base_url arguments.

Next​

Create your first Custodian Agent