Skip to main content
When a model calls several tools in one turn — reserve a seat, then charge a card — a failure on step two can leave step one’s side effects in place. kenpachi implements saga-style rollback: register an undo in each tool, and if a later tool in the same batch fails, undos run in reverse order.
Think of registerCompensation as “if anything after me fails, run this cleanup.”

Example