agentstack add command, the platform manages the runtime environment and you can’t directly control it.
The Agent Stack platform allows you to declare environment variable requirements through AgentDetail. The platform will then provide these variables to your agent at runtime, and you can access them using standard os.getenv() calls.
Quickstart
1
Import AgentDetail and EnvVar
Import the necessary components from the Agent Stack SDK.
2
Declare environment variables
Add an
EnvVar list to the variables field in your AgentDetail configuration.3
Deploy your agent to the Agent Stack
Use
agentstack add command to deploy your agent in Agent Stack4
Configure the variables via CLI
Configure environment variables for your agent using
agentstack env add "Name or ID of your Agent" KEY=VALUE.5
Access environment variables
Use
os.getenv() to access the environment variables in your agent code.Basic Environment Variables Example
Here’s how to request environment variables for your agent:Managing Environment Variables
Once your agent is deployed to Agent Stack, you need to provide the environment variables it requires. You can manage these variables using theagentstack env CLI commands.
Adding Environment Variables
To provide environment variables to your agent, use theagentstack env add command:
Listing Environment Variables
To view the environment variables configured for an agent:Removing Environment Variables
To remove an environment variable from an agent:Checking Missing Variables
When a required variable hasn’t been provided, you can see this in the agent list. Useagentstack list to view all agents - the MISSING ENV column shows which variables still need to be configured.