ast env

Manage where a blueprint's agents run and the values each one uses
View as Markdown

An environment is where one agent of a blueprint runs in the active account. Each environment has its own variables and secrets, which override the account’s values with the same name. Deleting the agent keeps the environment and its values, ready for the next deploy. Aliases: ast envs, ast environment, ast environments.

ast env <subcommand> [--blueprint <name>]

Every subcommand works on one blueprint. Pass --blueprint (-b), or run the command in the blueprint’s project directory, where the CLI reads the name from astropods.yml.

Environments are available for private blueprints only.

env list

ast env list [--json]

Lists the blueprint’s environments with each one’s agent, status, and variable and secret counts. An environment with no agent shows as empty.

env create

ast env create <name>

Creates an empty environment. Deploy into it with ast deploy --env <name>.

env rename

ast env rename <name> <new-name>

A name is unique per blueprint in an account.

env delete

ast env delete <name> [--confirm <name>]

Deletes an environment and its variables and secrets. An environment that has an agent can’t be deleted: delete the agent first with ast agent delete --env <name>. Prompts for confirmation. Pass --confirm with the environment name to skip the prompt.

Deploy into an environment

ast deploy --env staging

--env names an environment with no agent. Without it, a deploy uses the blueprint’s oldest environment that has no agent, or creates a new one named main, main-2, and so on. Either way, the deploy prints the environment it used. A redeploy stays in its environment.

Environment variables and secrets

Pass --env to any ast secrets subcommand to work on an environment’s values instead of the account’s:

ast secrets create API_KEY --env staging
ast secrets list --env staging

At deploy time, a --var KEY=@NAME reference resolves from the environment first, then from the account.

Target an agent by environment

An environment holds at most one agent, so --env picks exactly one. The blueprint comes from --blueprint or astropods.yml, as above. Every ast agent command that acts on one agent accepts it in place of --name or --id:

ast agent logs --env main
ast agent redeploy --env staging --latest

Next steps