AgentConfigurationEnvironment

Environment Variable Loading

How project agents combine host-provided env and project .env

Environment Variable Loading

When a project agent starts, it only combines two user-facing env layers:

  1. host-provided new Agent({ env })
  2. project-root .env

Common use cases

  • sharing common secrets from the host
  • overriding host values per project with .env
  • let the host inject shared secrets into Agent
  • keep project-local overrides in .env
  • keep downcity.json structural only; ${VAR} placeholders are no longer supported

Benefits:

  • env flow is explicit
  • config stays stable
  • there is no hidden string replacement during config loading

What to do after changes

Usually you should restart the agent:

town agent restart

The agent snapshots env at startup, so changing .env or host-injected values does not automatically refresh the current runtime process.