Back to library
AI
tutorial

Automate Long-Running Tasks with Codex Goal Mode

Define success criteria and let Codex handle the execution loop.

Use 'Goal Mode' in the Codex app or CLI to set a final objective and specific success criteria, allowing the AI to iterate autonomously until the task is complete.

ChatGPT

The Scenario

You need to build a multi-step automation or script that usually requires constant babysitting of the AI to ensure it doesn't drift off track.

Before & after

The old way

Previously, you had to manually prompt the AI for every incremental step, fixing small errors and re-running code, which could take 45–60 minutes for complex scripts.

With AI

With Goal Mode in Codex, you define the 'Done' state once, and the AI autonomously iterates until the criteria are met, typically in 5–10 minutes of background processing.

The Prompt

I want to use Goal Mode. 
Objective: [DESCRIBE YOUR ULTIMATE END GOAL, E.G., CREATE A PYTHON SCRIPT THAT SCRAPES DATA AND SAVES TO SQL]
Success Criteria:
1. [CRITERIA 1, E.G., MUST HANDLE PAGINATION]
2. [CRITERIA 2, E.G., MUST LOG ERRORS TO A TEXT FILE]
Keep working until these criteria are met.

Goal Mode allows you to specify a clear objective and success criteria. The AI then manages the execution path, handling multiple steps without requiring individual prompts for every sub-task.

Source

ChatGPT Business - Release Notes | OpenAI Help Center
"users can define an outcome and success criteria and let Codex keep working toward it."