Skip to main content
Codex Cloud does not currently provide an official public REST API. This callable uses undocumented ChatGPT backend endpoints that may change without notice.
codex.runCloudTask submits a task and returns a signal that materializes after Codex reaches a terminal state.
automations/run-codex-task.automation.ts
The task submission fields match codex.startCloudTask. pollInterval accepts a compact duration or milliseconds and defaults to "5m". maxPolls accepts 1 through 120 and defaults to 36, giving the default wait roughly three hours to finish. Optional second argument { account } defaults to the project binding and is reused for every status check. Automate.ax checks immediately, then runs each remaining check as a new action after a durable delay. It doesn’t keep a Lambda invocation open. One reusable delivery route handles every check, so increasing maxPolls does not enlarge the automation plan. The returned signal continues in a correlated child context when the task is no longer pending. The result is the same detailed task returned by codex.getCloudTask. Inspect status for ready, applied, error, or unknown. The signal fails when the polling budget is exhausted or a provider request exhausts its retries.
codex.runCloudTask uses a hidden invocation trigger and introduces additional context roots. The example’s issue.identifier signal anchors the starter action to the Linear event. If every task input is literal, wrap the call in withPrerequisites(initiatingSignal, () => ...).
Use codex.startCloudTask when you only need immediate task identity. Use codex.waitForCloudTask when the task was submitted separately or when you need to wait for a follow-up turn.