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.
from anona import AnonaErrorfor job_id in job_ids: # one per record_batch call — see below try: result = client.cancel_job(space_id="import", job_id=job_id) print(job_id, result["cancelled_parts"], "cancelled,", result["running_parts"], "already running") except AnonaError as e: if e.code != "job_not_cancellable": raise print(job_id, "nothing left to stop:", e.message)
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.409 job_not_cancellable means there was nothing queued left to stop: every
part is already running or finished. A small batch is often a single part, so
once a worker has picked it up it runs to the end — the job then finishes
normally rather than reading cancelled, and the refusal is the truth.A record_batch call takes at most 100 items (422 above that), so a large
import is many jobs. Keep every job_id as you queue them; the loop above is
only as complete as that list.
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.
A cancelled import usually leaves a webhook that no longer has a job to report on.
for hook in client.list_webhooks(space_id="import"): print(hook["id"], hook["url"], hook["enabled"])client.delete_webhook(space_id="import", webhook_id=hook_id)
Deleting stops queued deliveries for it — worth doing before your endpoint gets
a burst of events about a job you abandoned.
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.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Anona Memory","description":"Managed memory for AI agents. Record, retrieve, and reason over long-lived agent memory through a single API.","colors":{"primary":"#ce3430","light":"#e7413c","dark":"#b02324"},"logo":{"light":"https://mintcdn.com/anonalabs/EbHrb6Piz6HoXns-/logo/anona-lockup-light.svg?fit=max\u0026auto=format\u0026n=EbHrb6Piz6HoXns-\u0026q=85\u0026s=e071f027f34ec6b33984a7f58dad387f","dark":"https://mintcdn.com/anonalabs/EbHrb6Piz6HoXns-/logo/anona-lockup-dark.svg?fit=max\u0026auto=format\u0026n=EbHrb6Piz6HoXns-\u0026q=85\u0026s=cda5788809f06de5dcd8cf0812fbea53"},"favicon":"https://mintcdn.com/anonalabs/EbHrb6Piz6HoXns-/favicon.svg?fit=max\u0026auto=format\u0026n=EbHrb6Piz6HoXns-\u0026q=85\u0026s=c4752464baac0ee98e78996bda962821","background":{"color":{"light":"#ffffff","dark":"#1a1d21"}},"navbar":{"links":[{"href":"mailto:support@anonalabs.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://memory.anonalabs.com"}},"footer":{"socials":{"github":"https://github.com/anonalabs"}},"search":{"prompt":"Search the Anona Memory docs"},"fonts":{"heading":{"family":"Instrument Serif","weight":400},"body":{"family":"Space Grotesk"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode","mcp",{"title":"Copy all docs for LLM","description":"Every page as one Markdown file, for pasting into an agent's context","icon":"file-lines","href":"https://docs.anonalabs.com/llms-full.txt"},{"title":"Docs index for LLM","description":"llms.txt - the page map an agent can crawl on demand","icon":"list","href":"https://docs.anonalabs.com/llms.txt"}],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/anonalabs/Anona-Memory-SDK"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"anonalabs","hasAudioNarration":false,"actualSubdomain":"anonalabs","customDomains":["docs.anonalabs.com"],"gitSource":{"type":"github","owner":"anonalabs","repo":"anona-memory","deployBranch":"main","contentDirectory":"mintlify-docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"collectionId":"60bfb882-8cd2-4fd4-be2f-449f4f31920d","liveDeploymentHistoryId":"6ae1c7a24fe4c8cc739c373a","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae1c7a24fe4c8cc739c373a"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae432fa2b01475daafa184a","clientVersion":"0.0.4021","searchFilterCounts":[{"language":"default","tag":"Use Cases","count":41},{"language":"default","tag":"Anona CLI","count":16},{"language":"default","tag":"Memory (data plane)","count":13},{"language":"default","tag":"Command reference","count":11},{"language":"default","tag":"Integrations","count":10},{"language":"default","tag":"Build","count":10},{"language":"default","tag":"Guides","count":8},{"language":"default","tag":"Research","count":8},{"language":"default","tag":"Account (control plane)","count":7},{"language":"default","tag":"Team","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxTcwhsk.woff2) format('woff2');\n unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* greek */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxPcwhsk.woff2) format('woff2');\n unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;\n}\n/* vietnamese */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx_cwhsk.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'JetBrains Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--font-mono:\"JetBrains Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas,\n monospace}[class*=font-mono],code,kbd,pre,samp{font-family:var(--font-mono)!important}#content-area pre{line-height:1.7}#content-area h3,#content-area h4,#content-area h5,#content-area h6{font-family:var(--font-body, \"Space Grotesk\"),system-ui,sans-serif;font-weight:600;letter-spacing:-.01em}#banner{background-color:#1a1816!important}html.dark #banner{background-color:#22262b!important;border-bottom:1px solid #2f343a}img.nav-logo{height:2rem!important;max-height:2rem!important;width:auto!important;object-fit:contain;align-self:center}#navbar a[href=\"/\"]{display:flex;align-items:center}#content-area table{font-size:.875rem;line-height:1.6;display:block;overflow-x:auto;max-width:100%}#content-area thead th{font-weight:600;letter-spacing:.01em;white-space:nowrap}#content-area td,#content-area th{vertical-align:top;padding-top:.6rem;padding-bottom:.6rem}#content-area td code,#content-area th code{white-space:nowrap;font-size:.8125rem}@media (min-width:1280px){[class*=max-w-8xl]{max-width:none!important}#content-container>div{justify-content:space-between}#content-area{max-width:69rem}}main .relative.grow:has(.mdx-content>span:first-child>a[href=\"/use-cases/overview\"]){--uc-gutter:4px;padding-top:2.25rem}@media (min-width:1024px){main .relative.grow:has(.mdx-content>span:first-child>a[href=\"/use-cases/overview\"]){--uc-gutter:91.2px}}main .mdx-content:has(>span:first-child>a[href=\"/use-cases/overview\"]){position:static}main .mdx-content:has(>span:first-child>a[href=\"/use-cases/overview\"])>span:first-child{position:absolute;top:0;left:var(--uc-gutter);font-size:.875rem}main .mdx-content .uc-examples{display:flex;flex-wrap:wrap;gap:.375rem;margin:0 0 1.75rem}main .mdx-content .uc-examples a{display:inline-flex;align-items:center;gap:.4rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.75rem;line-height:1.7;padding:.2rem .7rem;border:1px solid rgba(128,128,128,.45);border-bottom:1px solid rgba(128,128,128,.45);border-radius:.4rem;background:rgba(128,128,128,.12);text-decoration:none;white-space:nowrap}main .mdx-content .uc-examples a::before{content:\"\";flex:none;width:.95rem;height:.95rem;background-color:currentColor;-webkit-mask:url(data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2016%2016%27%3E%3Cpath%20d%3D%27M8%200C3.58%200%200%203.58%200%208c0%203.54%202.29%206.53%205.47%207.59.4.07.55-.17.55-.38%200-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01%201.08.58%201.23.82.72%201.21%201.87.87%202.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95%200-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12%200%200%20.67-.21%202.2.82.64-.18%201.32-.27%202-.27s1.36.09%202%20.27c1.53-1.04%202.2-.82%202.2-.82.44%201.1.16%201.92.08%202.12.51.56.82%201.27.82%202.15%200%203.07-1.87%203.75-3.65%203.95.29.25.54.73.54%201.48%200%201.07-.01%201.93-.01%202.2%200%20.21.15.46.55.38A8.012%208.012%200%200%200%2016%208c0-4.42-3.58-8-8-8z%27%2F%3E%3C%2Fsvg%3E) center/contain no-repeat;mask:url(data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2016%2016%27%3E%3Cpath%20d%3D%27M8%200C3.58%200%200%203.58%200%208c0%203.54%202.29%206.53%205.47%207.59.4.07.55-.17.55-.38%200-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01%201.08.58%201.23.82.72%201.21%201.87.87%202.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95%200-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12%200%200%20.67-.21%202.2.82.64-.18%201.32-.27%202-.27s1.36.09%202%20.27c1.53-1.04%202.2-.82%202.2-.82.44%201.1.16%201.92.08%202.12.51.56.82%201.27.82%202.15%200%203.07-1.87%203.75-3.65%203.95.29.25.54.73.54%201.48%200%201.07-.01%201.93-.01%202.2%200%20.21.15.46.55.38A8.012%208.012%200%200%200%2016%208c0-4.42-3.58-8-8-8z%27%2F%3E%3C%2Fsvg%3E) center/contain no-repeat}main .mdx-content .uc-examples a:hover{border-color:rgba(128,128,128,.8);background:rgba(128,128,128,.2)}main .mdx-content .uc-examples a.uc-api::before{display:none}"}],"page":{"pagePath":"use-cases/stop-a-runaway-import","slug":"/use-cases/stop-a-runaway-import","pageMetadata":{"title":"Stop a runaway import","description":"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.","href":"/use-cases/stop-a-runaway-import"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:_jsx(_components.a,{href:`/use-cases/overview`,children:`← All use cases`})}),`\n`,_jsx(`div`,{className:`uc-examples`,children:_jsx(_components.a,{className:`uc-api`,href:`/api-reference/memories`,children:`API reference`})}),`\n`,_jsx(Heading,{level:`2`,id:`the-scenario`,children:`The scenario`}),`\n`,_jsx(_components.p,{children:`The backfill is running. Twenty seconds in you realise it is pointed at the\nstaging table, or the date filter was wrong, or it is one job per row instead of\none job per batch.`}),`\n`,_jsx(_components.p,{children:`Every queued chunk is an LLM call you are paying for, and it will keep going\nuntil it finishes.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`What this recipe shows that no other does:`}),` operational control of work\nalready in flight — cancelling it, and tearing down the plumbing around it.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-—-cancel-the-job`,children:`Step 1 — Cancel the job`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` anona `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AnonaError`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` job_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` job_ids: `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# one per record_batch call — see below`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.cancel_job(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`space_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`job_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`job_id)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(job_id, result[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cancelled_parts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cancelled,\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, result[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"running_parts\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"already running\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` except`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AnonaError `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` e.code `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"job_not_cancellable\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` raise`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(job_id, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"nothing left to stop:\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, e.message)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The two numbers matter and they are not the same thing. `,_jsx(_components.strong,{children:`Cancelled parts stop.\nRunning parts finish`}),` — work already handed to a worker is not interrupted, so\na large job keeps producing memories for a little while after you cancel it.\nWatch, do not assume.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`409 job_not_cancellable`}),` means there was nothing queued left to stop: every\npart is already running or finished. A small batch is often a single part, so\nonce a worker has picked it up it runs to the end — the job then finishes\nnormally rather than reading `,_jsx(_components.code,{children:`cancelled`}),`, and the refusal is the truth.`]}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.code,{children:`record_batch`}),` call takes `,_jsx(_components.strong,{children:`at most 100 items`}),` (`,_jsx(_components.code,{children:`422`}),` above that), so a large\nimport is many jobs. Keep every `,_jsx(_components.code,{children:`job_id`}),` as you queue them; the loop above is\nonly as complete as that list.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-—-find-out-what-landed`,children:`Step 2 — Find out what landed`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`page `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.list_memories(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`space_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`limit`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`100`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(page[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"total\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"memories made it in\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-—-undo-the-damage`,children:`Step 3 — Undo the damage`}),`\n`,_jsx(_components.p,{children:`If the import was file-based, deleting the document takes its memories with it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client.delete_document(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`space_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`document_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`doc_id)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If it was a write of loose records and the space existed only for the import,\nthe honest cleanup is to\n`,_jsx(_components.a,{href:`/use-cases/one-space-or-many`,children:`delete the space`}),` and start again. Picking\nindividual bad memories out of a good space is slow and error-prone — which is\nan argument for importing into a scratch space first.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-—-turn-off-what-was-watching-it`,children:`Step 4 — Turn off what was watching it`}),`\n`,_jsx(_components.p,{children:`A cancelled import usually leaves a webhook that no longer has a job to report on.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hook `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.list_webhooks(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`space_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(hook[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], hook[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], hook[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"enabled\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client.delete_webhook(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`space_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"import\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`webhook_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`hook_id)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Deleting stops queued deliveries for it — worth doing before your endpoint gets\na burst of events about a job you abandoned.`}),`\n`,_jsx(Heading,{level:`2`,id:`evals`,children:`Evals`}),`\n`,_jsx(_components.p,{children:`Practise this before you need it, on a space you do not care about:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Queue several 100-item batches back to back, cancel them all after a few\nseconds.`}),`\n`,_jsxs(_components.li,{children:[`Record `,_jsx(_components.code,{children:`cancelled_parts`}),` and `,_jsx(_components.code,{children:`running_parts`}),`, and which jobs answered\n`,_jsx(_components.code,{children:`job_not_cancellable`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Poll `,_jsx(_components.code,{children:`list_memories`}),` until `,_jsx(_components.code,{children:`total`}),` stops moving. The gap between cancelling\nand stopping is the number worth knowing — it is what you will be asked.`]}),`\n`,_jsx(_components.li,{children:`Confirm cleanup actually emptied it.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`guardrails`,children:`Guardrails`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Cancelling does not refund what already ran.`}),` Extraction that has happened\nis billed. The saving is on the part that had not started, which is why the\nfirst twenty seconds matter more than the next twenty minutes.`]})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Import into a scratch space.`}),` It converts “pick out the bad memories” into\n“delete the space”, and that is the whole difference between a bad afternoon\nand a bad minute.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`A cancelled job is a terminal state`}),`, not a pause. There is no resume;\nre-import what you still want.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Throughput is bounded platform-side`}),`, so a large import runs for a long\ntime. That is exactly why the kill switch is worth knowing before you need it.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Stop a runaway import","description":"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.","href":"/use-cases/stop-a-runaway-import"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"The scenario","slug":"the-scenario","depth":2,"children":[]},{"title":"Step 1 — Cancel the job","slug":"step-1-—-cancel-the-job","depth":2,"children":[]},{"title":"Step 2 — Find out what landed","slug":"step-2-—-find-out-what-landed","depth":2,"children":[]},{"title":"Step 3 — Undo the damage","slug":"step-3-—-undo-the-damage","depth":2,"children":[]},{"title":"Step 4 — Turn off what was watching it","slug":"step-4-—-turn-off-what-was-watching-it","depth":2,"children":[]},{"title":"Evals","slug":"evals","depth":2,"children":[]},{"title":"Guardrails","slug":"guardrails","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/anonalabs/3087548d8b58fdad/apollo-tracker.js"],"subdomain":"anonalabs","siteName":"Anona Memory","title":"Stop a runaway import - Anona Memory","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-24T17:13:54.932Z","originalFileLocation":"use-cases/stop-a-runaway-import.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Anona Memory\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Stop a runaway import - Anona Memory\">\u003cmeta data-mint-head property=\"og:description\" content=\"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Anona Memory\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://anonalabs.mintlify.app/_mintlify/api/og/v2?division=Build\u0026amp;title=Stop+a+runaway+import\u0026amp;description=You+queued+fifty+thousand+rows+from+the+wrong+table.+Here+is+the+kill+switch%2C+and+the+cleanup.\u0026amp;theme=7715ad72d5e774c6ba1f3afa\u0026amp;signature=87ebfa639eeacc2c550ffdfd0d452a78c5b19fc1a3630e590a49cd31286bffb1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Stop a runaway import - Anona Memory\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://anonalabs.mintlify.app/_mintlify/api/og/v2?division=Build\u0026amp;title=Stop+a+runaway+import\u0026amp;description=You+queued+fifty+thousand+rows+from+the+wrong+table.+Here+is+the+kill+switch%2C+and+the+cleanup.\u0026amp;theme=7715ad72d5e774c6ba1f3afa\u0026amp;signature=87ebfa639eeacc2c550ffdfd0d452a78c5b19fc1a3630e590a49cd31286bffb1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/anonalabs/8SAfjiD5iTDJmcr4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Anona Memory\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ce3430\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/use-cases/stop-a-runaway-import.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.anonalabs.com/#organization\",\"name\":\"Anona Memory\",\"url\":\"https://docs.anonalabs.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/anonalabs/EbHrb6Piz6HoXns-/logo/anona-lockup-light.svg?fit=max\u0026auto=format\u0026n=EbHrb6Piz6HoXns-\u0026q=85\u0026s=e071f027f34ec6b33984a7f58dad387f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.anonalabs.com#website\",\"name\":\"Anona Memory\",\"url\":\"https://docs.anonalabs.com\",\"publisher\":{\"@id\":\"https://docs.anonalabs.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import#webpage\",\"url\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import\",\"name\":\"Stop a runaway import\",\"description\":\"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\",\"dateModified\":\"2026-10-24T17:13:54.932Z\",\"isPartOf\":{\"@id\":\"https://docs.anonalabs.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Use Cases\",\"item\":\"https://docs.anonalabs.com/use-cases/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build\",\"item\":\"https://docs.anonalabs.com/use-cases/the-three-calls\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Stop a runaway import\",\"item\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import#article\",\"headline\":\"Stop a runaway import\",\"name\":\"Stop a runaway import\",\"description\":\"You queued fifty thousand rows from the wrong table. Here is the kill switch, and the cleanup.\",\"url\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import\",\"mainEntityOfPage\":{\"@id\":\"https://docs.anonalabs.com/use-cases/stop-a-runaway-import#webpage\"},\"dateModified\":\"2026-10-24T17:13:54.932Z\",\"publisher\":{\"@id\":\"https://docs.anonalabs.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.anonalabs.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Anona Memory\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Anona Memory","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/anonalabs/Anona-Memory-SDK"}]},"groups":[{"group":"Getting Started","pages":[{"title":"Anona Memory","sidebarTitle":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"},{"title":"Core Concepts","href":"/concepts"},{"title":"Plans and billing","href":"/guides/plans-and-billing"}]},{"group":"For Agents","pages":[{"title":"Agent Self-Onboarding","sidebarTitle":"Self-Onboarding","href":"/agents/self-onboarding"},{"title":"Self-Onboarding Prompt","sidebarTitle":"Onboarding Prompt","href":"/agents/onboarding-prompt"},{"title":"Temporary profiles","sidebarTitle":"Temporary profiles","href":"/agents/temp-profiles"}]},{"group":"Anona CLI","pages":[{"title":"Anona CLI","sidebarTitle":"Overview \u0026 install","href":"/cli/overview"},{"title":"Sign in \u0026 credentials","sidebarTitle":"Sign in \u0026 credentials","href":"/cli/sign-in"},{"group":"Command reference","pages":[{"title":"record, retrieve, reason","sidebarTitle":"record, retrieve, reason","href":"/cli/memory"},{"title":"spaces","sidebarTitle":"spaces","href":"/cli/spaces"},{"title":"memories","sidebarTitle":"memories","href":"/cli/memories"},{"title":"documents","sidebarTitle":"documents","href":"/cli/documents"},{"title":"jobs","sidebarTitle":"jobs","href":"/cli/jobs"},{"title":"Space settings","sidebarTitle":"settings","href":"/cli/settings"},{"title":"llm-models and model","sidebarTitle":"models","href":"/cli/models"},{"title":"profile, user-profile, usage","sidebarTitle":"profile, user-profile, usage","href":"/cli/profiles-and-usage"},{"title":"Memory models, profile, rules, webhooks, routing","sidebarTitle":"space config","href":"/cli/space-config"},{"title":"Explore: graph, entities, receipts, chat","sidebarTitle":"explore","href":"/cli/explore"},{"title":"Account: org, keys, members, billing, exports","sidebarTitle":"account","href":"/cli/account"}]},{"title":"Scripting \u0026 automation","sidebarTitle":"Scripting \u0026 automation","href":"/cli/scripting"},{"title":"The CLI for AI agents","sidebarTitle":"For AI agents","href":"/cli/agents"},{"title":"Troubleshooting the CLI","sidebarTitle":"Troubleshooting","href":"/cli/troubleshooting"}]},{"group":"API Essentials","pages":[{"title":"API Overview","href":"/api-reference/overview"},{"title":"Authentication","href":"/api-reference/authentication"},{"title":"Errors","href":"/api-reference/errors"}]},{"group":"Memory (data plane)","pages":[{"title":"Memories","href":"/api-reference/memories"},{"title":"Documents","href":"/api-reference/documents"},{"title":"Retrieve","href":"/api-reference/retrieve"},{"title":"Context Receipts","href":"/api-reference/context-receipts"},{"title":"Reason","href":"/api-reference/reason"},{"title":"Model selection","href":"/api-reference/model-selection"},{"title":"User Profiles","href":"/api-reference/user-profiles"},{"title":"Memory models","href":"/api-reference/models"},{"title":"Graph","href":"/api-reference/graph"},{"title":"Draw","href":"/api-reference/draw"},{"title":"Artifacts","href":"/api-reference/artifacts"},{"title":"Extraction settings","href":"/api-reference/extraction-settings"},{"title":"Webhooks","href":"/api-reference/webhooks"}]},{"group":"LLM Proxy (drop-in)","pages":[{"title":"Chat","href":"/api-reference/chat"},{"title":"Responses","href":"/api-reference/responses"},{"title":"Messages","href":"/api-reference/messages"}]},{"group":"Account (control plane)","pages":[{"title":"Organization","href":"/api-reference/organization"},{"title":"Spaces","href":"/api-reference/spaces"},{"title":"API Keys","href":"/api-reference/api-keys"},{"title":"Usage","href":"/api-reference/usage"},{"title":"Billing","href":"/api-reference/billing"},{"title":"Feedback","href":"/api-reference/feedback"},{"title":"Sales enquiry","href":"/api-reference/sales-enquiry"}]},{"group":"SDKs \u0026 MCP","pages":[{"title":"Python SDK","href":"/sdk/python"},{"title":"TypeScript SDK","sidebarTitle":"TypeScript","href":"/sdk/javascript"},{"title":"MCP Integration","sidebarTitle":"MCP","href":"/mcp-integration"},{"title":"Slack","href":"/slack"},{"title":"GitHub","href":"/github"}]},{"group":"Integrations","pages":[{"title":"Integrations","href":"/integrations/overview"},{"title":"Agent Skills","sidebarTitle":"Agent Skills","href":"/integrations/skills"},{"title":"LangChain \u0026 LangGraph","href":"/integrations/langchain"},{"title":"CrewAI","href":"/integrations/crewai"},{"title":"LlamaIndex","href":"/integrations/llamaindex"},{"title":"Google ADK","href":"/integrations/google-adk"},{"title":"Microsoft Agent Framework","href":"/integrations/microsoft-agent-framework"},{"title":"AWS Strands","href":"/integrations/strands"},{"title":"Softmax","href":"/integrations/softmax"},{"title":"Examples","href":"/integrations/examples"}]},{"group":"Guides","pages":[{"title":"Charts, diagrams and artifacts","href":"/guides/charts-diagrams-artifacts"},{"title":"Scoping Memory by User, Agent, or Session","href":"/guides/scoping-multi-tenant"},{"title":"Automatic Space Routing","href":"/guides/automatic-routing"},{"title":"Searching Over Time","href":"/guides/temporal-search"},{"title":"Migrating to the Drop-in Proxy","href":"/guides/migrating-to-proxy"},{"title":"Bulk-Importing History with Webhooks","href":"/guides/bulk-import-webhooks"},{"title":"Tuning Recall Quality","href":"/guides/tuning-recall"},{"title":"Export Your Memory","href":"/guides/export"}]},{"group":"Use Cases","pages":[{"title":"Use Cases","href":"/use-cases/overview"},{"group":"Personal","pages":[{"title":"Remember the people you meet","href":"/use-cases/remember-people"},{"title":"Keep your own promises","href":"/use-cases/keep-your-promises"},{"title":"Think out loud, keep the thought","href":"/use-cases/think-out-loud"},{"title":"Stop re-solving the same bug","href":"/use-cases/stop-resolving-the-same-bug"}]},{"group":"Build","pages":[{"title":"The three calls you actually need","href":"/use-cases/the-three-calls"},{"title":"One line, keep your OpenAI SDK","href":"/use-cases/drop-in-proxy"},{"title":"Chat with your documents","href":"/use-cases/chat-with-your-documents"},{"title":"Turn a meeting recording into memory","href":"/use-cases/meeting-recording-to-memory"},{"title":"Backfill a year of history","href":"/use-cases/backfill-history"},{"title":"Know the moment ingestion finishes","href":"/use-cases/events-not-polling"},{"title":"Teach it your vocabulary","href":"/use-cases/teach-it-your-vocabulary"},{"title":"Browse what it knows","href":"/use-cases/browse-what-it-knows"},{"title":"One space or many?","description":"The decision you make once, early, and cannot cheaply undo. Here is how to make it right.","href":"/use-cases/one-space-or-many"},{"title":"Stop a runaway import","href":"/use-cases/stop-a-runaway-import"}]},{"group":"Support","pages":[{"title":"Support agent that knows each customer","description":"One space serves every customer. Scoping keeps their histories apart, so nobody is told someone else's story.","href":"/use-cases/support-agent-per-customer"},{"title":"Everything you know about one user","href":"/use-cases/one-user-profile"},{"title":"Support memory the whole team shares","href":"/use-cases/shared-team-support-memory"},{"title":"Tutor that remembers the learner","href":"/use-cases/tutor-that-remembers"}]},{"group":"Research","pages":[{"title":"Who your agent keeps meeting","href":"/use-cases/entity-graph"},{"title":"What was true back then","href":"/use-cases/what-was-true-back-then"},{"title":"Competitive intelligence that accumulates","href":"/use-cases/competitive-intelligence"},{"title":"Financial analyst across quarters","href":"/use-cases/financial-analyst"},{"title":"Contract and policy memory","href":"/use-cases/contract-and-policy-memory"},{"title":"A briefing that keeps itself current","href":"/use-cases/self-refreshing-briefing"},{"title":"Give the space a mission","href":"/use-cases/give-the-space-a-mission"},{"title":"A shelf of standing questions","href":"/use-cases/a-shelf-of-standing-questions"}]},{"group":"Team","pages":[{"title":"Two agents, one space","href":"/use-cases/two-agents-one-space"},{"title":"Memory for your coding agent","href":"/use-cases/memory-for-your-coding-agent"},{"title":"Onboarding agent for new hires","href":"/use-cases/onboarding-agent"},{"title":"Search across everything the company knows","href":"/use-cases/company-wide-search"},{"title":"Incident copilot that has read every postmortem","href":"/use-cases/incident-copilot"},{"title":"Account memory that outlives the rep","href":"/use-cases/account-memory"},{"title":"Candidate memory across interviewers","href":"/use-cases/candidate-memory"}]},{"group":"Governance","pages":[{"title":"Why the answer used what it used","href":"/use-cases/why-the-answer-used-what-it-used"},{"title":"Correct a memory without losing the record","href":"/use-cases/correct-a-memory"},{"title":"Delete a user's memories, provably","href":"/use-cases/delete-a-users-memories"},{"title":"Cut the bill without cutting recall","href":"/use-cases/cut-the-bill"},{"title":"Prove the memory is earning its place","href":"/use-cases/prove-memory-helps"},{"title":"Choose the model a space thinks with","href":"/use-cases/choose-the-model"},{"title":"Take everything with you","href":"/use-cases/take-everything-with-you"}]}]},{"group":"Legal","pages":[{"title":"Subprocessors","href":"/legal/subprocessors"}]},{"group":"Changelog","pages":[{"title":"Changelog","href":"/changelog"}]}]},"title":"Stop a runaway import - Anona Memory","buildId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","deploymentId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","dynamics":[],"chunks":[]}