Schedule icon
Webhook icon
Assert icon
CreateCollection icon
Request icon
Script icon
Set icon
If icon
Pause icon
Delete icon
Query icon
Log icon
SlackIncomingWebhook icon

Chroma Vector Store Dangling Document and Quarantine Eviction Guard

Audit Chroma collections for tombstoned and dangling embeddings, archive quarantined docs, safely evict stale vectors with human approval, and verify state.

Categories
AIData

Production Retrieval-Augmented Generation (RAG) applications frequently suffer from vector store index drift and stale document contamination. When source documents are deleted, archived, or updated in upstream relational databases, content management systems, or cloud object storage, corresponding embedding vectors frequently remain orphaned inside vector databases like Chroma.

Over time, these dangling vectors and unresolved tombstones degrade search relevance, cause Large Language Models (LLMs) to retrieve obsolete policy information or deleted customer data, and waste vector index memory and computation bandwidth.

This blueprint implements an automated Vector Store Dangling Document and Quarantine Eviction Guard for Chroma. It queries collection count and candidate document metadata, correlates soft-deleted and tombstoned vectors against retention grace windows, evaluates cross-run accumulation trends using Kestra KV, archives quarantined document manifests before deletion, enforces operator approval gates prior to mutation, executes verified batch vector evictions via the native Chroma plugin, and dispatches incident telemetry to Slack.

How it works

  1. Pre-flight Assertion: The workflow asserts that input parameters meet sanity limits, ensuring valid collection names, non-negative retention thresholds, accessible HTTP URLs, and batch sizes >= 1.
  2. Collection Resolution: io.kestra.plugin.chroma.CreateCollection resolves the target collection name in Chroma and retrieves its internal collection UUID.
  3. Pre-Eviction Count Audit: An HTTP request queries the Chroma collection count endpoint to establish a baseline record count before any inspection or deletion activities take place.
  4. Tombstone & Dangling Vector Inspection: A Python inspection script retrieves candidate embeddings and metadata from Chroma, filters for soft-deleted (status = DELETED), tombstoned (is_tombstone = true), quarantined, or expired records beyond the configured retention grace window, and loads historical state from Kestra KV under chroma_tracker_{collection_name} to determine whether tombstone accumulation is escalating.
  5. Quarantine Archival: When enabled, the workflow archives structured records of all detected dangling vectors (including vector IDs, document previews, upstream metadata, and eviction reasons) into Kestra KV under chroma_quarantine_{collection_name}_{execution_id} so that no data is permanently lost without an audit trail.
  6. Human Approval Gate: When dry_run is disabled, the workflow pauses execution (io.kestra.plugin.core.flow.Pause) for explicit operator confirmation before mutating cluster state.
  7. Verified Vector Eviction: Once approved, io.kestra.plugin.chroma.Delete purges the identified vector IDs from the Chroma collection.
  8. Post-Remediation Verification: The flow re-queries the Chroma count API to assert the new collection size matches expectations and performs a sample query via io.kestra.plugin.chroma.Query to confirm that tombstone records are completely absent.
  9. Incident Escalation: The flow stores updated telemetry in Kestra KV and dispatches structured diagnostic notifications to Slack.

What you get

  • Automated detection and eviction of dangling, soft-deleted, and tombstoned vector embeddings.
  • Prevention of LLM hallucinations and data leakage caused by obsolete retrieval chunks.
  • Fail-safe quarantine archival in Kestra KV preserving document content prior to deletion.
  • Operator approval gates and dry-run verification preventing accidental data loss.
  • Post-remediation verification confirming that evicted vectors are completely absent from Chroma.
  • Cross-run trend tracking in Kestra KV distinguishing isolated deletions from persistent index drift.

Who it's for

  • AI Platform Engineers and Machine Learning Engineers maintaining enterprise RAG architectures.
  • Data Engineers building continuous document ingestion and synchronization pipelines.
  • Platform SREs responsible for vector database memory utilization, latency, and index hygiene.

Why orchestrate this with Kestra

Standalone cron scripts or ad-hoc cleanup jobs lack state persistence across runs, cannot enforce interactive pause-and-resume approval gates, expose raw credentials in shell history, and fail to provide end-to-end verification and quarantine trails.

Orchestrating vector store maintenance with Kestra delivers a declarative workflow with native Chroma plugin tasks, built-in state persistence in Kestra KV, human approval gates before destructive deletion, automated post-remediation verification, and real-time Slack escalation.

Prerequisites

  • An accessible Chroma instance (version 0.5.0 or higher) reachable from the Kestra worker (e.g. running locally via Docker on port 8000 or on Chroma Cloud).
  • Target Chroma vector collection created with document embeddings.
  • A Slack Incoming Webhook URL to receive eviction alerts and approval notifications.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for eviction and failure alerts.
  • CHROMA_EVICTION_GUARD_WEBHOOK_KEY: Secret authentication token protecting the on-demand webhook trigger.
  • CHROMA_AUTH_TOKEN: Optional authentication token for secured Chroma instances.

Quick start

  1. Configure SLACK_WEBHOOK_URL, CHROMA_EVICTION_GUARD_WEBHOOK_KEY, and optional CHROMA_AUTH_TOKEN in your Kestra namespace secrets.
  2. Import this blueprint and set base_url (e.g. http://localhost:8000) and collection_name to match your Chroma environment.
  3. Run a manual execution with dry_run: true to inspect the collection and review identified dangling embeddings.
  4. Once verified, run with dry_run: false to approve and execute vector eviction.
  5. Enable the periodic_eviction_sweep schedule trigger to monitor and purge stale vectors automatically every 6 hours.

How to extend

  • Multi-Collection Sweep: Wrap the inspection and eviction tasks in an io.kestra.plugin.core.flow.Loop over a list of Chroma collections across multiple tenants or databases.
  • Upstream CDC Sync Integration: Wire an event-based trigger to listen to database deletion events (e.g. from PostgreSQL or MongoDB CDC) to trigger instant targeted vector evictions.
  • Cold Storage S3 Backup: Add an io.kestra.plugin.aws.s3.Upload or io.kestra.plugin.minio.Upload task to persist large quarantine JSON manifests to durable cloud object storage.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.