Skip to content

Pipelines ​

Kompile uses one unified pipeline contract for VLM, OCR, LLM, embedding, reranking, graph-extraction, and custom processing steps. The harness owns runtime startup, model loading, process reuse, cancellation, and cleanup — you describe what you want in chat (or validate existing definitions with kompile pipeline), without hand-writing large pipeline JSON files.


Managing pipelines through the harness ​

Ask the agent in plain English to inspect capabilities, test a pipeline on sample data, save a versioned definition, run it on documents, or roll back a version:

"Show me the available pipeline step catalog and templates, then test a two-step chat pipeline that extracts key facts and summarizes ./report.pdf. Once it looks good, save it as document-pipeline and promote it."

Behind the scenes, the agent manages immutable pipeline versions under data/pipelines/unified/<pipelineId>/ via the pipeline tool:

Lifecycle ActionWhat It Does
capabilitiesReturns the live step catalog, provider-neutral templates, and input/output contracts
validate / testValidates a definition or runs a read-only test on sample text/PDF without saving
create / updateSaves a new immutable version (with optimistic expectedActiveVersion checks)
run / status / cancelExecutes a saved pipeline asynchronously, tracks status, or cancels an active run
promote / rollbackAtomically switches the active-version pointer without overwriting prior versions
list / getLists managed definitions alongside active registrations in kompile.project.json (each tagged with its registrySource)

Local artifact-backed runs share the same pooled runtime: you supply pipeline definitions, model bindings, and input data — never raw worker ports, subprocess flags, or classpaths. If a model binding points to an existing localPath on disk, Kompile consumes it in place without staging or mutating kompile.project.json. Failed tests or runs return a structured diagnostic with run ID, failure stage, exception chain, and bounded stack trace.


Composed pipeline steps ​

Pipelines compose compatible catalog steps as either a SequencePipeline (steps run in order) or a GraphPipeline (directed graph of nodes with explicit upstream inputs and pipeline_input / outputNodeName boundaries):

  • text-model-text: Built-in sequence template taking text input through one caller-bound local language model.
  • vision-multimodel: Built-in graph template starting with image_preprocess, feeding independently bound visionEncoder, textEmbedding, and decoder model roles, and finishing with token decoding.
  • VLM_DOCUMENT: Convenience end-to-end PDF adapter for scanned/image-heavy PDFs (application/pdf input; renders pages locally for VLM OCR).

Built-in templates use abstract role names, never hardcoded models or providers — you bind your chosen models at runtime. In graphs, a node with one predecessor receives its upstream record directly; multiple predecessors merge in declaration order unless explicit inputDataBindings map specific slots (node.outputKey, node, or pipeline_input[.key]). Loop nodes merge inputs into loop state and update named feedbackKeys on each iteration.


Native chat compositions ​

You can compose multi-stage text, image, or PDF workflows using your configured Kompile chat providers (CHAT_MODEL stages) — with no local tensor model required:

"Build a two-stage CHAT_MODEL sequence pipeline where stage 1 extracts key facts and stage 2 summarizes them faithfully, and test it on this document."

Key rules for host chat compositions:

  • Supports 1–100 CHAT_MODEL stages in a sequence (step0, step1, …) or acyclic graph (loops, disconnected stages, and mixed tensor/chat runners are rejected).
  • Multiple upstream stages join text in declared input order; intermediate outputs are text.
  • Original inputs can be text, an image, or a PDF — a later stage that needs the original image or PDF references pipeline_input directly (file paths never come from model-generated text).
  • Every stage is preflighted before inference; credentials are always resolved from your host chat configuration and never stored in pipeline definitions.
  • Project source=chat / remote model aliases resolve to their exact descriptors (never silently reinterpreted as local artifact paths).

Acquiring, converting & optimizing local models ​

Model provisioning is cleanly separated from pipeline definitions. Ask the agent in chat — it uses model_runtime behind the scenes:

  1. Check status & acquire models: "Check local model runtime status and bootstrap the vision encoder, text embedding, and decoder models for this project." (status, bootstrap, or import from a local directory or configured repository).
  2. Convert local weights to .sdz: "Convert models/raw.onnx to models/model.sdz." Supports ONNX, TensorFlow/Keras, GGUF/GGML, and SafeTensors via Kompile's standalone staging worker.
  3. Optimize a .sdz artifact: "Optimize models/model.sdz with the BASIC profile (dead_code_elimination, algebraic, up to 3 iterations) and keep a backup." Supports profile, selectedPasses, maxIterations, quantizationType, dryRun, and createBackup.
  4. Register or point directly at a local VLM: Ask the agent to register reusable VLM metadata via vlm_model_definition, or reference an existing directory on disk directly via localPath for a self-contained run that leaves project manifests untouched.

Model selection follows a strict precedence: modelBindings.default → modelId → vlmModel (legacy alias) → modelSetId (conflicting values are rejected). model_runtime status reports artifactReady separately from runtimeStatus so file presence is never mistaken for verified runtime initialization.


Validating definitions from the CLI ​

For scripts, CI, or quick offline inspection, the CLI provides direct validation and step listing:

bash
kompile pipeline validate --file=pipeline.json
kompile pipeline list-steps --verbose

Released under the Apache-2.0 License.