﻿# Aider one-shot CLI edits then exits while its Python API has no compatibility guarantee

Choose Aider one-shot CLI automation with explicit files and acceptance checks, distinguishing a processed instruction from successful behavior and from the unsupported Python API.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-aider-one-shot-cli-python-api/
Language: en

## Choose the automation boundary

A maintenance job needs a narrow source edit without leaving an interactive terminal conversation open. Aider's [scripting guide](https://aider.chat/docs/scripting.html) documents a command-line message that processes an instruction, applies edits, and exits. This is a useful automation boundary, but it should not be described as an independently verified completion of the maintenance goal. Specify the files and observable result before constructing the job.

## Separate direct text from an instruction file

The [options reference](https://aider.chat/docs/config/options.html) provides `--message` and `--message-file` for a single instruction followed by exit from noninteractive processing. An instruction file can keep the request reproducible and avoid fragile shell quoting. It does not freeze the repository contents, dependency environment, or chosen configuration. Record those inputs separately when comparing two runs or preparing a result for review.

## Preserve the verification step

The [command reference](https://aider.chat/docs/usage/commands.html) documents checks and feedback in interactive use; an unattended one-shot job does not gain a human's follow-up review merely by exiting. Configure relevant checks deliberately and preserve their outcomes with the diff. A generated explanation saying that the code now works is weaker evidence than executing the changed path. Avoid using an unconditional final shell success to hide a failed validation stage in a wrapper.

## Treat Python scripting as a different stability choice

The scripting page also demonstrates constructing a coder object and invoking it from Python, but explicitly calls that API unsupported and potentially incompatible across releases. A short import example is not a stable integration contract. If the task only needs a bounded command-line edit, do not assume the internal Python interface is required. An integration choosing it should track the tested version and its own compatibility checks rather than promising future behavior from a sample.

## Deliver a reviewable repository result

Keep the task instruction, starting revision, selected configuration, final diff, and meaningful check output together. The [task-contract guide](/journal/learn-codex-task-contract/) defines the finish line; [tool observations](/journal/learn-codex-tool-observation/) distinguish process completion from established behavior. Report an incomplete validation honestly even if Aider produced edits successfully. Automation is useful when the outcome remains reviewable, including which parts of the requested result were actually verified.
