Non-Interactive Mode

Use interpreter exec when you want one task to run to completion without the full-screen TUI.

interpreter exec "summarize the changes in the last commit"

The human-readable final answer prints to stdout. Progress and diagnostics use stderr unless you choose JSON output.

Input

Pass the prompt as an argument:

interpreter exec "find one bug in src/parser.rs"

Read the prompt from stdin:

cat task.md | interpreter exec -

Pipe context into a prompt:

git diff | interpreter exec "explain this diff and flag risky changes"

Attach images to the first prompt:

interpreter exec -i screenshot.png "describe the UI problem"

Common Flags

FlagPurpose
--jsonEmit newline-delimited JSON events.
--output-schema <file>Require the final answer to match a JSON Schema.
--output-last-message, -o <file>Write the final assistant message to a file.
`--color alwaysnever
--sandbox <mode>Override sandbox mode.
--ask-for-approval <mode>Override approval policy.
--profile <name>Use a config profile.
--ephemeralDo not persist a session record.
--skip-git-repo-checkAllow running outside a Git repo.
--ignore-user-configSkip user config for this run.
--ignore-rulesSkip execpolicy rules.
--verifyRun an additional completion-check turn before exiting.
--timeout <seconds>Send time remaining reminders during the run.

JSON Events

Use --json for automation:

interpreter exec --json "list the files this task would touch"

Each line is a JSON event representing progress, tool calls, file changes, reasoning summaries, or the final message.

Structured Output

Pair --output-schema with a schema file:

{
  "type": "object",
  "properties": {
    "risk": { "type": "string" },
    "recommended_fix": { "type": "string" }
  },
  "required": ["risk", "recommended_fix"]
}
interpreter exec --output-schema schema.json \
  "inspect the current diff and return the highest risk"

Resume Exec Work

Continue the most recent non-interactive session:

interpreter exec resume --last "now apply the plan"

Or resume a specific session id:

interpreter exec resume <SESSION_ID> "continue"

Add --all to search sessions outside the current working directory.

Review From Exec

Run a code-review pass without opening the TUI:

interpreter exec review --uncommitted
interpreter exec review --base main
interpreter exec review --commit abc123

For custom review instructions, pass text or - to read stdin.

CI Pattern

Use API-key authentication and keep the sandbox narrow:

- name: Review patch
  env:
    OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  run: |
    interpreter exec --json --sandbox read-only \
      "review this pull request diff for regressions" \
      < pr.diff > review.jsonl