Skip to main content
Version: 0.1.22
Last Verified: 2025-01-27
Package: @hopx-ai/sdk on npm

Overview

The EnvironmentVariables resource (accessed via sandbox.env) provides methods for managing environment variables in sandboxes.

Methods

getAll

Get all environment variables.
async env.getAll(): Promise<Record<string, string>>
Returns: Promise<Record<string, string>> - Dictionary of all environment variables

get

Get specific environment variable.
async env.get(key: string): Promise<string | undefined>
Returns: Promise<string | undefined> - Variable value or undefined

set

Set a single environment variable.
async env.set(key: string, value: string): Promise<void>

setAll

Replace all environment variables (destructive).
async env.setAll(envVars: Record<string, string>): Promise<Record<string, string>>
This replaces ALL existing environment variables. Use update() to merge instead.

update

Update environment variables (merge with existing).
async env.update(envVars: Record<string, string>): Promise<Record<string, string>>

delete

Delete a single environment variable.
async env.delete(key: string): Promise<void>

See Also

Next Steps