Skip to content

Boat.Environment reference

Source: packages/boat/src/Environment.ts

A Boat environment: the environment variables, secret files and credential settings a sandbox starts with.

Every change mints a new version. New sandboxes start on the latest version; running ones keep the version they started with until they are upgraded on the dashboard.

An environment is personal, or shared by an organization. With an org on the stack (Boat.providers({ org }), or the profile’s), it is that organization’s: every member can use it, and owners and admins change it. Without one it is yours alone, even when your active wallet is an organization’s. Changing the stack’s org replaces it.

An environment passes a sandbox its own env and secretFiles, and nothing of your account. Your GitHub token, a Boat API key and your AI credentials are each one flag, off until you turn it on.

Variables and a secret file

export const MyEnv = Boat.Environment("MyEnv", {
env: { NODE_ENV: "production", API_TOKEN: Config.Redacted("API_TOKEN") },
secretFiles: [{ path: ".npmrc", contents: Config.Redacted("NPMRC") }],
});
export const Box = Boat.Sandbox("Box", { environment: MyEnv });

An environment for sandboxes you hand to users

export const Tenants = Boat.Environment("Tenants", { safeForThirdParties: true });
export const Mine = Boat.Environment("Mine", {
passGithub: true,
passSandboxCredentials: true,
});

Environment: Giving sandboxes AI credentials

Section titled “Environment: Giving sandboxes AI credentials”

The keys of a credential profile

export const MyProfile = Boat.CredentialProfile("MyProfile", {
anthropic: Config.Redacted("ANTHROPIC_API_KEY"),
});
export const MyEnv = Boat.Environment("MyEnv", { credentialProfile: MyProfile });

The sign-ins you made on the dashboard

export const MyEnv = Boat.Environment("MyEnv", {
credentialProfile: Boat.CredentialProfile.lookup({ name: "default" }),
});

Placeholders, for sandboxes you hand to users

export const MyProfile = Boat.CredentialProfile("MyProfile", {
anthropic: Config.Redacted("ANTHROPIC_API_KEY"),
});
// Billed: $1 a day, plus $1 per 1,000 proxied requests.
export const Proxy = Boat.AiProxy("Proxy", { enabled: true });
export const Tenants = Boat.Environment("Tenants", {
safeForThirdParties: true,
credentialProfile: MyProfile,
proxyAiCredentials: Proxy,
});
alchemy.run.ts
export default Alchemy.Stack(
"Team",
{ providers: Boat.providers({ org: "acme" }) },
Effect.gen(function* () {
const env = yield* Boat.Environment("MyEnv", { env: { MODE: "agent" } });
return { environment: env.name };
}),
);

Environment: Referencing an environment the stack doesn’t manage

Section titled “Environment: Referencing an environment the stack doesn’t manage”
export const Box = Boat.Sandbox("Box", {
environment: Boat.Environment.lookup({ name: "base" }),
});