Remodelador is my AI video pipeline. Each video goes through several paid steps: script, image, voice and editing.
Every call to an external service can end in three ways: it worked, it failed, or I don’t know. The third case is the dangerous one. The connection dropped after the request went out. The service may have generated and charged, and the response got lost on the way.
The wrong reflex
The reflex is to try again. With a free API that is harmless. With image or video generation, retrying in the dark pays twice for the same result. In a pipeline that runs by itself, that repeats without anyone seeing it.
The rule
Before calling the service, the step records in the database what it is about to ask for. When the response arrives, it records the result.
If the run is interrupted, the step does not ask again. It first checks what was recorded and asks the service whether that request exists. It only redoes the work when it is sure the previous one did not arrive. When it cannot be sure, the job stops and a person decides.
It applies to service agents too
The same rule prevents a duplicate message to the customer, a charge generated twice and an order recorded twice. Any action that costs money or that the customer sees needs a record before and a check after.