Add `--max-turns` CLI option
Resolved 💬 4 comments Opened Feb 20, 2026 by 0kenx Closed Feb 21, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor)
responded on this thread — see the highlighted reply below.
What variant of Codex are you using?
CLI
What feature would you like to see?
--max-turns
Limit the number of agentic turns. Exits with an error when the limit is reached. No limit by default.
Additional information
_No response_
4 Comments
patch
Can you explain your use case in more detail? You're proposing a solution to a problem, but it would be useful to understand the problem better.
Instead of relying on the LLM model to generate its own stop signal, I want to artificially limit the execution to a controlled length, then programmatically perform verifications and/or inject context before continuing execution with
resume.Thanks for the additional details. It sounds like our upcoming event hooks feature will address your needs. Please upvote that if you'd like to see it.
I think it's unlikely that we'd expose a
--max-turnsCLI option, so I'm going to close this feature request.