Skip to main content

aip_sdk.create_secret

aip_sdk.create_secret(name: str, value: str, *, description: str | None = None, workspace_id: str | None = None, client: APIClient | None = None) -> WorkspaceSecret

Store a new secret in a workspace.

The name is what an op declares and reads as an environment variable, so it must start with an uppercase letter and hold only uppercase letters, digits and underscores. It must not start with AIP_, or name a variable the op runtime already sets.

Parameters

  • name str: Secret name, unique within the workspace.
  • value str: The value to store. Encrypted by the platform before storage, and never returned by a listing or lookup.
  • description str | None: What the secret is for. Readable by everyone who can see the workspace, so keep the value's own details out of it.
  • workspace_id str | None: Workspace to store it in. Defaults to the session's workspace.
  • client APIClient | None: Optional pre-configured API client.

Returns

Raises

Example:

secret = aip.create_secret(
"OPENAI_API_KEY",
os.environ["OPENAI_API_KEY"],
description="Shared evaluation key",
workspace_id="ws-abc123",
)