Codex CLI

swaleio/codex

Category: Coding assistants Latest version 0.173.0 · 2026-12-03 View versions

Codex CLI

Runs Codex CLI, OpenAI's coding agent, once and unattended in directory, with the instructions in prompt. Its final answer becomes the result output, and a file at result_path when you give one. The image's entrypoint is the wrapper, so there are no args: every setting is an input.

Codex CLI is a product of OpenAI. This task definition is built by Swale; OpenAI does not build, endorse or support it. The agent's answers and changes can be wrong: review them before you rely on them.

Inputs

Input Required Default Description
prompt yes — The instructions for the agent.
directory yes — Absolute path the agent works in, such as a repository an earlier task cloned (e.g. ${{env.WORKFLOW_STORAGE}}/repo).
model yes — The model, such as gpt-6.2-sol. With base_url, the name that server gives the model.
api_key no — Your OpenAI API key, or the key for base_url's server (pass a secret).
base_url no OpenAI A server that speaks OpenAI's Responses API, used instead of OpenAI's.
permission no edit read, edit or full. See Permissions.
result_path no — Path of a file to also write the final answer to.
max_minutes no 60 Minutes after which the run stops and the task fails.

Outputs

Output Description
result The agent's final answer, as a JSON string. Read it with fromJSON(tasks.<id>.outputs.result).

Permissions

Nobody is there to approve what the agent wants to do, so permission says up front what it may do. Anything else it asks for is refused.

permission What the agent can do
read Read files. No edits, no commands.
edit Also edit files, and run commands inside Codex's own sandbox, which keeps them to directory and offline. Codex has no level that edits without running commands.
full Everything Codex can do, with no sandbox and no approval.

Signing in

Sign in with your own OpenAI API key, which OpenAI bills directly. A ChatGPT plan cannot be used: the task takes an API key, which is what OpenAI recommends for automation. The agent sends your prompt and what it reads to OpenAI, or to base_url's server, under your own account there.

Security

The task holds only what the workflow passes it. The agent acts on everything it reads, though: the files in directory, the pages and command output it sees, and the repository's own instruction files (AGENTS.md). An instruction planted in any of them can steer it. With full, that can mean a command that sends your key or your code somewhere else. Give it the lowest level the job needs, run it on repositories you trust, and put a spending limit on the key.

Compute

CPU. The model runs at the provider or at base_url; this task only runs the agent, so a GPU compute type wastes money.

Example

name: Codex CLI example
compute_type: cpu-4
entry_point: main

blocks:
  main:
    tasks:
      checkout:
        name: Checkout
        uses: swaleio/git-clone
        args:
          repository_url: https://github.com/acme/app.git
          dest: ${{env.WORKFLOW_STORAGE}}/repo
      review:
        name: Review the code
        uses: swaleio/codex
        start_on:
          - checkout
        args:
          prompt: Review this repository for bugs. List each one with its file and line.
          directory: ${{env.WORKFLOW_STORAGE}}/repo
          model: gpt-6.2-sol
          api_key: ${{secrets.openai_api_key}}
          permission: read
          result_path: ${{env.WORKFLOW_STORAGE}}/review.md

The review is in ${{env.WORKFLOW_STORAGE}}/review.md for later tasks, and in ${{tasks.review.outputs.result}}.


For the workflow syntax these examples use, see the workflow definition reference in the Swale documentation.

Licensed under the MIT License.