Module 10 · advanced · 1 hour
Workflows
Production automation needs explicit inputs, bounded permissions, machine-readable output, retry semantics, and verification that distinguishes a completed run from a correct result.
Non-interactive execution
Use codex exec for scripted and CI workflows. Give the run a narrow prompt, a controlled environment, and an output format your pipeline can validate.
codex exec "Review the current diff for correctness"
# add structured output and limits for CI consumersGitHub Actions
The Codex GitHub Action can run repository tasks inside CI. Pin versions, scope token permissions, avoid exposing untrusted secrets, and make the workflow fail on validated blocking findings.
- uses: openai/codex-action@v1
with:
prompt: Review this pull request for correctness regressions.Goals and scheduled tasks
Goals keep a durable objective across turns. Scheduled tasks and heartbeat automations handle repeated work. Use the product’s scheduling surface rather than embedding raw scheduler directives into prompts.
- Goal: Durable objective
- Heartbeat: Follow up in this task
- Cron: Standalone recurring job
Verification gates
A workflow should record what ran, what passed, what remains uncertain, and which external state changed. Retries must be idempotent when possible.
Continue learning
Use the official OpenAI Codex documentation as the final reference for current commands, settings, and availability.