Walks up from the agent directory to the root directory and loads the first
.env file found into process.env with override semantics.
When agentParentFolder is given, agentName must be a single path segment
that resolves inside it. When agentParentFolder is omitted, agentName may
be a path, but it must not be . or contain a .. segment. These checks
are lexical: they do not follow symlinks.
Parameters
agentName: string
The name of the agent, or a path to it when
agentParentFolder is omitted.
OptionalagentParentFolder: string
The directory that contains the agent. Optional.
filename: string = '.env'
The dotenv file name to search for. Must be a single path
segment. Defaults to '.env'.
Returns void
Throws
If agentName, agentParentFolder or
filename is invalid, or if agentName resolves outside
agentParentFolder.
Walks up from the agent directory to the root directory and loads the first
.envfile found intoprocess.envwith override semantics.When
agentParentFolderis given,agentNamemust be a single path segment that resolves inside it. WhenagentParentFolderis omitted,agentNamemay be a path, but it must not be.or contain a..segment. These checks are lexical: they do not follow symlinks.