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:1Panel dev MaxKB Linear Pipeline Execution

From Leeroopedia
Knowledge Sources
Domains Chat_Pipeline, Design_Patterns
Last Updated 2026-10-10 00:00 GMT

Overview

A sequential execution pattern that processes chat requests through an ordered chain of steps, with each step reading from and writing to a shared context dictionary.

Description

Linear Pipeline Execution is MaxKB's original chat processing architecture (supplemented by the newer flow-based WorkflowManage). The PipelineManage class assembles step classes via a fluent builder pattern and executes them in order. Each step implements the IBaseChatPipelineStep interface with an `execute()` method and a `run()` wrapper that provides the pipeline context. The pipeline for RAG chat consists of four steps:

  1. ResetProblemStep — Optimizes the user question using an LLM
  2. SearchDatasetStep — Searches knowledge bases for relevant paragraphs
  3. GenerateHumanMessageStep — Builds the LLM message list with knowledge context
  4. ChatStep — Invokes the LLM with streaming and delivers the response

A shared `context` dict carries data between steps (question, paragraphs, message list, tokens).

Usage

Use this principle when designing:

  • Sequential chat processing pipelines
  • Builder-pattern-based pipeline assembly
  • Step-based request processing with shared context

Theoretical Basis

The pipeline pattern follows Chain of Responsibility with ordered steps:

# Abstract algorithm description (NOT real implementation)
class Pipeline:
    def __init__(self, steps):
        self.steps = [step() for step in steps]  # Instantiate classes
        self.context = {}

    def run(self, initial_context):
        self.context.update(initial_context)
        for step in self.steps:
            step.run(self)  # Step reads/writes self.context

# Builder for fluent assembly:
pipeline = (Pipeline.builder()
    .append_step(ResetProblemStep)
    .append_step(SearchDatasetStep)
    .append_step(GenerateHumanMessageStep)
    .append_step(ChatStep)
    .build())
pipeline.run(context)

Related Pages

Implemented By

Page Connections

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