Examples¶
retrAI ships with ready-to-run example projects in the examples/ directory.
01 — SQL Optimization (DuckDB)¶
Optimize a slow analytical query against a DuckDB database.
cd examples/01_sql_duckdb
python seed.py # generate sample data
retrai run sql-benchmark # agent optimises the query
Goal: Reduce query execution time below the threshold defined in .retrai.yml.
02 — Fix Failing Pytest¶
A Python utility module with deliberately broken tests.
Goal: All tests in tests/test_utils.py pass.
03 — ML Model Optimization¶
Train and optimise a churn prediction model.
cd examples/03_ml_churn
python generate_data.py # create synthetic dataset
retrai run ml-optimize # agent improves model accuracy
Goal: Achieve target accuracy on the holdout set.
04 — Performance Optimization¶
A benchmark script with a deliberately slow implementation.
Goal: bench.py completes under the time threshold.
05 — Pyright Type Fixes¶
A Python module with deliberate type errors.
Goal: Zero pyright errors.
06 — Shell Script Linting¶
A Python script with style issues to be cleaned up.
Goal: Ruff reports zero violations.