Skip to main content

Install and authenticate

Two official SDKs wrap the same platform with the same features. Pick the one that matches where your code runs.

PythonTypeScript / JavaScript
Backends, data pipelines, notebooks, scriptsNode.js, serverless, edge, web apps, CLIs
pip install custodian-labsnpm install @custodianlabs/sdk
Python 3.10+Node.js 18+, or any runtime with fetch

Install​

pip install custodian-labs # upgrade: pip install -U custodian-labs
from custodian_labs import Custodian # install name custodian-labs, import name custodian_labs

Authenticate​

Both SDKs read your key from CUSTODIAN_SDK_API_KEY and send it as an X-API-Key header. Get a key from the Dashboard.

export CUSTODIAN_SDK_API_KEY="custodian_labs_..."
# PowerShell: $env:CUSTODIAN_SDK_API_KEY="custodian_labs_..."

The SDKs don't load .env files. Load yours first, for example with python-dotenv or dotenv.

To pass credentials explicitly, which overrides the environment:

Custodian(model="gpt-6-luna", system_prompt="...", api_key="custodian_labs_...")
GuardianLayer(api_key="custodian_labs_...")

CustodianBuilder reads the environment only. Use the Custodian class to pass a key explicitly.

VariableDefault
CUSTODIAN_SDK_API_KEYNone. Required.
CUSTODIAN_SDK_BASE_URLhttps://platform.custodianlabs.io/v1
CUSTODIAN_MASKING_BASE_URLhttps://privacy.custodianlabs.io (Guardian Layer)

All variables: Environment variables.

Keep the key on the server

Don't put your key in browser or mobile code. Call the SDK from a backend, serverless function or edge handler. See Use API keys securely.

Class names​

The SDKs are not line-for-line ports. These names differ:

PythonTypeScript
CustodianSquadAgentTeam
DeployedApp (aliases: App, CustodianSquadApp)TeamApp
Custodian (also used for squad members)Agent (squad members)
AISDKErrorCustodianError

TypeScript also has createCustodian(), which creates and deploys in one call.

Since the unified deployment model, every deployment is a DeployedApp — a single Custodian deploys as a 1-member squad (routing_mode="single"). Use CustodianClient.deployed(id) to attach to an existing deployment by ID without re-deploying.

Reference​

PythonTypeScript
One agentCustodianCustodian
Fluent builderCustodianBuilderCustodianBuilder
Multi-agentCustodianSquadAgentTeam
Guardian LayerGuardianLayerGuardianLayer