Skip to main content
← All use cases

The scenario

The backfill is running. Twenty seconds in you realise it is pointed at the staging table, or the date filter was wrong, or it is one job per row instead of one job per batch. Every queued chunk is an LLM call you are paying for, and it will keep going until it finishes. What this recipe shows that no other does: operational control of work already in flight — cancelling it, and tearing down the plumbing around it.

Step 1 — Cancel the job

The two numbers matter and they are not the same thing. Cancelled parts stop. Running parts finish — work already handed to a worker is not interrupted, so a large job keeps producing memories for a little while after you cancel it. Watch, do not assume.

Step 2 — Find out what landed

Step 3 — Undo the damage

If the import was file-based, deleting the document takes its memories with it:
If it was a write of loose records and the space existed only for the import, the honest cleanup is to delete the space and start again. Picking individual bad memories out of a good space is slow and error-prone — which is an argument for importing into a scratch space first.

Step 4 — Turn off what was watching it

A cancelled import usually leaves a webhook that no longer has a job to report on.
Deleting stops queued deliveries for it — worth doing before your endpoint gets a burst of events about a job you abandoned.

Evals

Practise this before you need it, on a space you do not care about:
  1. Queue a large batch, cancel it after a few seconds.
  2. Record cancelled_parts and running_parts.
  3. Poll list_memories until total stops moving. The gap between cancelling and stopping is the number worth knowing — it is what you will be asked.
  4. Confirm cleanup actually emptied it.

Guardrails

Cancelling does not refund what already ran. Extraction that has happened is billed. The saving is on the part that had not started, which is why the first twenty seconds matter more than the next twenty minutes.
  • Import into a scratch space. It converts “pick out the bad memories” into “delete the space”, and that is the whole difference between a bad afternoon and a bad minute.
  • A cancelled job is a terminal state, not a pause. There is no resume; re-import what you still want.
  • Throughput is bounded platform-side, so a large import runs for a long time. That is exactly why the kill switch is worth knowing before you need it.