codex exec — the print-mode of Codex
codex exec is the non-interactive entry point. Prompt in (args or stdin), output to stdout, exit. The same mode every CLI ships under a different name; in Codex it's exec.
Output flags: --output-last-message (just the final answer, ideal for piping), --output-format text|json|markdown. Tool restriction: Codex inherits the active sandbox + approval mode, so a CI invocation should pin both via --sandbox and --ask-for-approval.