building a Databricks Reflection Agent: 55% → 90% execution success.
Rivi built a self-correcting agent designed to make generated Databricks code significantly more reliable while keeping execution safely read-only.
generating code isn’t enough if it doesn’t run.
generated code was failing unpredictably in Databricks, with limited visibility into why changes worked or regressed.
a failure returned an exception and nothing else - no diagnosis, no correction, no second attempt.
execute. observe. fix. retry.
the Reflection Agent runs candidate code, understands execution errors and makes focused corrections to the failing part before safely trying again.
the goal is closer to careful debugging than rewriting everything from scratch.
read-only by construction.
a self-correcting agent that retries code needs a hard boundary around what it is allowed to run. execution is constrained before a statement ever reaches the warehouse.
measurement first.
Rivi also built the evaluation foundation around the agent - repeatable benchmarking and end-to-end traces so every iteration could be measured rather than judged anecdotally.