Scripting and Automation

Scripting and Automation

Programmatic Usage

Automation Capabilities

Command Line Scripting:

# Apply same instruction to multiple files
for FILE in *.py ; do
    aider --message "add descriptive docstrings" $FILE
done

Python API:

from aider.coders import Coder
from aider.models import Model

# Files to edit
fnames = ["app.py"]
model = Model("o3-mini")

# Create coder and run instructions
coder = Coder.create(main_model=model, fnames=fnames)
coder.run("add error handling")
coder.run("/tokens")  # Run slash commands too

This programmatic access enables integration with CI/CD pipelines, batch processing of files, and other automated workflows.

10 | 10