All work

Predli Studio: Document Ingestion

I owned the ingestion layer of Predli Studio, Predli's enterprise RAG product: the path from a client's raw documents to searchable, citation-ready knowledge.

2025AI & ML ConsultantPredli Consulting ABMulti-quarter buildin production

Multi-tenant

Studio platform

Asset-based

Dagster orchestration

Idempotent

content-hash keyed

Stack:pythondagsterragetlmulti-tenantobservabilityasset-based-orchestration

Context

Predli Studio is Predli’s enterprise RAG product — the platform clients log into to ask questions over their own documents and get cited, grounded answers. It serves multiple enterprise tenants from one codebase.

I owned the ingestion layer, from a tenant’s raw documents to the searchable, citation-ready knowledge the Studio app reads from. The main design decision was using Dagster to model parsed documents, chunks, and embeddings as assets with explicit dependencies.

The problem with "just write a pipeline"

A script can read PDFs from a folder, chunk them, embed them, and push them to a vector store for one tenant and 50 documents. The production pipeline also needed to handle changes and failures:

  • Documents change. A document gets updated, deprecated, withdrawn for compliance. The chunks and embeddings derived from it have to follow.
  • Connectors retry. A scheduled sync can re-emit the same file. The pipeline needs to recognize those bytes and avoid duplicate chunks.
  • The chunker isn’t fixed. A change to the chunking strategy or embedding model requires reprocessing the affected stage and its downstream assets without re-fetching every PDF.
  • You’ll need to explain failures. Support needs to trace a missing document through ingestion to see which stage failed.

These requirements made asset lineage and selective reprocessing central to the orchestrator choice.

Why Dagster, specifically

Dagster’s core abstraction is the software-defined asset: a chunk of stored data — a parsed document, a chunk row, an embedding vector — declared as code, with lineage, metadata, and a function that produces it from upstream assets.

I used that model for three things:

  1. Asset lineage. Every embedding traces back through its chunk and parsed document to the source file. That chain helps locate the stage responsible for a retrieval problem.
  2. Selective reprocessing. An affected asset and the downstream assets that depend on it can be re-materialized while unchanged upstream assets stay cached.
  3. Operations visibility. Dagster’s UI shows the asset graph, run history, and materialization metadata. Support can inspect what was ingested for a tenant, when it ran, and what happened.

I evaluated Airflow and Prefect; both would have worked. Dagster’s asset model was the closer fit for the derived data I needed to inspect and reprocess.

Runtime topology

Before the asset graph, the deployment topology — how Dagster itself is wired to run in production:

scheduleslaunch jobsmanual runslogs · eventsExternal Triggerupload · schedule · sensorWeb ServerUI · GraphQL APIDaemonschedules · sensorsUser Code Containeringestion pipelines

Scroll sideways to see the full diagram. Use the arrow keys when focused.

Dagster Deployment

Three processes, with separate concerns:

  • Web Server — fronts the UI and the GraphQL API. This is what humans interact with (operations dashboard, asset graph view, run history) and what external systems integrate against. It does not, itself, execute pipeline code.
  • Daemon — long-running background process that owns time-based behavior: schedules (cron-style runs) and sensors (event-driven runs that fire when something changes upstream — a new file, a new connector record, a new tenant). When a schedule or sensor fires, the daemon asks the user-code container to launch a job.
  • User Code Container — the only process that actually runs pipeline code. Asset definitions, job definitions, the parsing/chunking/embedding logic — all live here. Code changes redeploy this container alone, without touching the web server or daemon.

External triggers (a tenant uploading a file in Studio, a scheduled connector pull, a sensor detecting a new document) come in through the web server. The daemon launches scheduled and sensor-driven runs against user code. Manual runs and ad-hoc asset materializations launch directly from the web server. Either way, runtime logs, materialization metadata, and events flow back to the web server so the UI can show what happened.

The reason this separation matters: it lets each process be deployed, scaled, and restarted independently. A web-server restart for a UI fix doesn’t interrupt running ingestion. A user-code redeploy (the most frequent change) doesn’t require restarting the scheduler. The daemon and the web server are stable infrastructure; the user-code container is where the actual work churns.

The asset graph

Source intakeTenant uploads + connector pulls
Raw document assetContent-hash keyed for idempotency
Parsed document assetType-aware: PDF, deck, spreadsheet, web
Chunk assetMetadata-rich, traceable to source region
Embedding assetBatched, written to vector store
Studio query layerCited, grounded retrieval
Source → Searchable Knowledge

The pipeline is a graph of assets, each declared as code with a clear function, an explicit dependency on the assets upstream of it, and metadata on what was produced.

Parsing branches by document type, carrying over the file-type-aware approach that drives the Studio RAG product itself: PDFs preserve headings and table boundaries, decks parse slide-by-slide with notes as metadata, spreadsheets keep header context so numerical regions survive, web pages get readability extraction. The contract downstream of parsing is uniform — a document object with typed regions that chunking can reason about.

The pattern most worth calling out — content-hash idempotency

The raw-document asset is keyed off a content hash of the source bytes.

Re-uploading the same file is a no-op. A connector retry or duplicate upload reuses the existing assets instead of adding duplicate chunks or paying for another embedding pass.

Checking the hash at intake avoids having to find and remove duplicate chunks from the vector store after a retry.

Resources, not hardcoded clients

The vector store, blob store, embedding API, and parser library are supplied as Dagster resources. Asset code asks the run for a client. Configuration selects the client for local, staging, and production environments, for tenants using different backends, and for test mocks. The asset logic stays the same across those configurations.

Reflection

Two things from this build that I’d carry forward:

Model the derived data explicitly. The asset graph gave us a way to reason about backfills, debugging, and tenant onboarding in terms of the documents, chunks, and embeddings involved.

Handle retries at the asset boundary. Checking source hashes before processing kept retry handling in one place instead of spreading duplicate checks across the application.

For future multi-tenant builds, I would also put tenant isolation at the storage boundary, using per-tenant namespaces in the index and partitioned schemas in the relational mirror. I would not rely on application-layer query filters as the only separation between tenants.

The chunking and retrieval work is documented separately in Predli Studio: Enterprise RAG.