Set Up Codex CLI
This guide shows you how to install, authenticate, select, and check Codex for HumanLayer sessions.
To learn the basic task flow with Claude Code, use the first-session tutorial.
Install the CLI
Install the HumanLayer CLI on the machine that will run the session. For another host, first run a remote daemon.
npm install -g @humanlayer/cli@latest
humanlayer --helpAuthenticate Codex
Start Codex authentication from the HumanLayer CLI.
humanlayer agents auth codexThe command opens browser authentication when the environment supports it. In other environments, the command can use a device code.
Select Codex
Select codex as the provider when you start a HumanLayer session. Select low, medium, high, or xhigh reasoning effort.
The session launch command can change between CLI releases. Check the installed CLI before you publish a script or runbook.
humanlayer --help
humanlayer agents --helpCheck the setup
Start a HumanLayer session with codex selected. Check that the session starts with Codex and the reasoning effort that you selected.
Troubleshooting
- If authentication fails in a headless shell, use a terminal that can complete the device-code instructions.
- If the provider list does not show Codex, update the CLI with
npm install -g @humanlayer/cli@latest. - If a session uses the wrong provider, check the provider before you launch it. Then check the installed CLI version.