Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:416rehman DeepZero Pipeline Configuration

From Leeroopedia
Knowledge Sources
Domains Pipeline_Orchestration, Configuration
Last Updated 2026-10-27 00:00 GMT

Overview

A declarative pipeline-as-YAML configuration pattern with environment variable expansion, typed processor configs, and static validation of the stage graph and prompt references.

Description

Declarative pipeline configuration separates the what (which stages, in what order, with what parameters) from the how (the execution engine). A pipeline is defined as a YAML file with:

  • name and description: human-readable metadata.
  • model: the LLM model string (e.g., "claude-code/claude-opus-5"), resolved to a backend by the registry.
  • settings: pipeline-level settings (work_dir, max_workers).
  • stages: an ordered list of stage definitions, each with a name, processor reference, config, parallelism, timeout, and failure policy.
  • report: optional presentation hints for the report generator.

Environment variable expansion runs at load time, before config parsing. The syntax ${VAR} expands to the env value or empty string; ${VAR:-default} provides a fallback. This prevents the common failure mode where an unset variable leaks as a literal string that looks truthy but resolves to nothing at runtime.

Static validation catches misconfigurations before a run starts: the first stage must be an IngestProcessor, subsequent stages must be Map/Reduce/BulkMap, each processor's validate() checks its own dependencies, and Jinja2 prompts are parsed (not rendered) to verify every variable they reference is produced by an upstream stage.

Usage

Use this configuration pattern when:

  • Pipelines need to be versioned, shared, and diffable (YAML, not code)
  • Environment-specific values (paths, API keys) need to be injected without modifying the pipeline
  • Pipeline graphs should be validated before execution to catch silent failures
  • Different corpora through the same pipeline need isolated state

Theoretical Basis

The environment expansion algorithm:

# Abstract algorithm (NOT real implementation)
def expand_string(s):
    def replace(match):
        var = match.group(1)
        if ":-" in var:
            name, default = var.split(":-", 1)
            return os.environ.get(name, default)
        return os.environ.get(var, "")  # unset -> empty, not literal

    return re.sub(r"\$\{([^}]+)\}", replace, s)

The static prompt validation parses each Jinja2 template to find its undeclared variables, then checks them against the union of all upstream provides declarations:

# Abstract validation (NOT real implementation)
available = set(ALWAYS_PROVIDED)  # sample_name, sample_path, history, config
for spec in pipeline.stage_specs:
    if has_prompt_file(spec):
        used = jinja2_find_undeclared(prompt_source)
        unknown = used - available
        if unknown:
            report_error(unknown)
    available.update(resolved[spec.name].provides)

Related Pages

Implemented By

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment