agentlaneagentlane

4.4ReferenceMarkdown

Environment variables

Inside a lane, every service, hook and exec command gets the lane's variables: its id, its device, each service's port, the web app's URL, the resources' values, and the log and evidence folders. A few variables you set yourself change where agentlane keeps its state and which tools it uses.

What a lane exports

up and claim print these as shell exports, and every service, hook and exec command gets them:

VariableWhat it holds
AGENTLANE_LANEThe lane's id, such as 4b5850b6. Name per-lane things after it, such as a database.
AGENTLANE_LANE_TOKENThe lane's secret. agentlane's commands use it to act for the lane, and maestro under exec binds its iOS runner to it. Resource commands don't get it.
AGENTLANE_WORKTREEThe folder the lane belongs to.
AGENTLANE_PLATFORMios, android or web.
AGENTLANE_DEVICEThe simulator's UDID or the emulator's serial, such as emulator-5584.
AGENTLANE_<NAME>_PORTEach service's port: AGENTLANE_API_PORT, AGENTLANE_METRO_PORT, AGENTLANE_WEB_PORT, and AGENTLANE_BROWSER_PORT for the browser's debugging port. A name with dashes uses underscores.
AGENTLANE_WEB_URLThe web app's URL on the lane's port, such as http://localhost:41300/.
AGENTLANE_VARIANTThe mobile build variant, Debug by default.
AGENTLANE_LOGSThe lane's log folder.
AGENTLANE_EVIDENCEThe lane's evidence folder, which outlives the lane by seven days.
Your resources' exportsEach value a resource's create wrote, such as DATABASE_URL.

A lane's commands never take a variable a resource exports from the caller's environment, so a DATABASE_URL left in your shell can't point an agent at the wrong database. Commands also run with LANG and LC_ALL set to en_US.UTF-8 on macOS and C.UTF-8 on Linux.

Only in some commands

VariableWho gets itWhat it holds
AGENTLANE_EXPORTSA resource's createThe file to write NAME=value lines to.
AGENTLANE_STORAGE_STATEThe signin hook, and exec on a browser laneThe file of the lane's saved login, in Playwright's storage-state format.
AGENTLANE_LAUNCH_ARGSThe launch hookThe launch arguments that dial the lane's services, such as -apiBaseUrl http://localhost:41201.

On a browser lane

exec on a lane with a browser also sets:

VariableWhat it holds
AGENTLANE_BROWSER_DRIVERplaywright or agent-browser.
AGENTLANE_BROWSER_SESSIONThe driver session, such as agentlane-4b5850b6.
AGENTLANE_BROWSER_PROFILEThe lane's profile folder.
AGENTLANE_BROWSER_CDPThe browser's debugging URL, such as http://127.0.0.1:41400.
PLAYWRIGHT_TEST_BASE_URLThe web app's URL, which Playwright Test uses as baseURL.
PLAYWRIGHT_BROWSERS_PATHagentlane's pinned browsers.
PATHThe lane's driver wrapper first, so playwright-cli or agent-browser is agentlane's pinned build.

It also sets the driver's own variables that bind it to the lane: PLAYWRIGHT_CLI_SESSION and Playwright's MCP settings for Playwright, or AGENT_BROWSER_SESSION, AGENT_BROWSER_PROFILE and the others for agent-browser.

Settings you can set

VariableWhat it changes
AGENTLANE_STATE_DIRWhere the registry and the lanes' folders live. Default ~/.local/state/agentlane (or under $XDG_STATE_HOME).
AGENTLANE_OWNER_PIDThe pid of the process that owns the lanes a command claims, for scripts that run outside an agent.
AGENTLANE_JAVA_HOMEThe JDK 17 for Maestro and the Android build, ahead of JAVA_HOME.
AGENTLANE_MAESTROA Maestro binary to use instead of the pinned build, such as a local build. doctor flags it as not the release.
AGENTLANE_PLAYWRIGHT_BROWSERSA Playwright browsers folder to use instead of the pinned builds, for a host they aren't pinned for.
AGENTLANE_INIT_PACKAGEWhat init adds as the dev dependency instead of agentlane@<its own version>, such as a local tarball when you try out a build.

AGENTLANE_STATE_DIR, AGENTLANE_OWNER_PID and AGENTLANE_JAVA_HOME pass through to a lane's hooks, services and exec commands. Every other AGENTLANE_ variable in the caller's environment is dropped there, so one lane's values never leak into another's. agentlane also reads XDG_STATE_HOME and XDG_DATA_HOME for its folders, JAVA_HOME for the JDK, and ANDROID_HOME or ANDROID_SDK_ROOT for the Android SDK.