📚 Docs / Pipeline Loop — Improvements & Roadmap

Pipeline Loop — Improvements & Roadmap

Why: Expands queries with synonyms and related terms before embedding — directly improves retrieval recall.
What the node-based pipeline system could benefit from, organized by priority.

Current State ✅

Architecture

┌─────────────┐
│   START     │
└──────┬──────┘
       │
┌──────▼──────┐
│  Retrieval  │◄──────────────┐
└──────┬──────┘               │
       │                      │
┌──────▼──────┐          (retry)
│ Verification│               │
└──────┬──────┘          ┌────┴────┐
       │                 │ Retry   │
  (pass)│(fail)          └─────────┘
┌──────▼──────┐
│  Generation │
└──────┬──────┘
       │
┌──────▼──────┐
│ Post-Gen    │
│ Check       │
└──────┬──────┘
       │
┌──────▼──────┐
│   END       │
└─────────────┘

Components

ComponentFileStatus
Core enginebackend/legal_retrieval/pipeline_nodes.py✅ Done
RAG graph pipelinebackend/legal_retrieval/pipeline_graph.py✅ Done
Backend API wiringbackend/main.py✅ Done
Per-query visualizationfrontend/src/components/Sources/PipelineExecution.tsx✅ Done
Performance dashboardfrontend/src/components/Sources/PipelineDashboard.tsx✅ Done
Log storage per conversationfrontend/src/store/chatStore.ts✅ Done
Note: Effort estimates below are rough approximations for a single developer. Actual time depends on testing, code review, and integration complexity.

🔴 High Priority

1. Query Expansion Node

Implementation:

Estimated effort: 1–2 hours

Graph change:

query_expansion → retry_retrieval → verification → generation → post_check → success
                                                    ↓ (fail)
                                                  abstain

2. Streaming Pipeline Progress

Status: implemented. Nodes execute in real-time instead of waiting for the entire pipeline to complete.

Implementation (as shipped):


🟡 Medium Priority

3. LangGraph StateGraph Integration

Why: Lets agents use the pipeline as LangGraph tools for agentic workflows.

Implementation:

Estimated effort: 2–3 hours


4. Pipeline Caching

Why: Cache retrieval results for repeated/similar queries — saves embedding + search time.

Implementation:

Estimated effort: 2–3 hours


5. Custom Node Composition

Why: Let users define custom pipeline workflows via config (YAML/JSON).

Implementation:

yaml  pipeline:
    nodes:
      - name: expand
        type: query_expansion
      - name: retrieve
        type: retrieval
        retries: 2
      - name: verify
        type: verification
      - name: generate
        type: generation
    edges:
      expand: [retrieve]
      retrieve: [verify]
      verify:
        pass: [generate]
        fail: [abstain]

Estimated effort: 3–4 hours


🟢 Nice to Have

6. Pipeline Debug Endpoint

Why: Full execution trace for debugging pipeline behavior.

Implementation:

Estimated effort: 1–2 hours


7. Node Timeout Handling

Why: Kill stuck nodes (e.g., LLM hanging) after configurable timeout.

Implementation:

Estimated effort: 1–2 hours


8. A/B Testing Support

Why: Compare different pipeline configurations side-by-side.

Implementation:

Estimated effort: 2–3 hours


9. Pipeline Metrics Export

Why: Production monitoring with Prometheus/Grafana.

Implementation:

Estimated effort: 2–3 hours


10. Pipeline Versioning

Why: Track pipeline configuration changes over time.

Implementation:

Estimated effort: 2–3 hours


Effort Summary

PriorityFeatureEffort
🔴Query expansion node1–2h
🔴Streaming pipeline progress3–4h
🟡LangGraph integration2–3h
🟡Pipeline caching2–3h
🟡Custom node composition3–4h
🟢Debug endpoint1–2h
🟢Node timeout handling1–2h
🟢A/B testing2–3h
🟢Metrics export2–3h
🟢Pipeline versioning2–3h

Total estimated effort: ~20–28 hours


  1. Query expansion node — Highest impact on retrieval quality
  2. Node timeout handling — Quick win, prevents hung pipelines
  3. Debug endpoint — Makes development/debugging much easier
  4. Pipeline caching — Performance improvement for repeated queries
  5. Streaming progress — Best UX improvement
  6. LangGraph integration — Enables agentic workflows
  7. Custom node composition — Power user feature
  8. Metrics export — Production readiness
  9. A/B testing — Research/optimization tool
  10. Pipeline versioning — Long-term maintainability

Questions, answered

Short, self-contained answers about this guide.

What improvements are planned?

The roadmap covers query expansion, a dedicated verification node, config-driven (YAML/JSON) pipeline definitions, and more granular retrieval controls — each with an estimated effort.

When will these ship?

Items are ordered by effort and impact — the fastest wins (roughly 2–4 hours each) are planned first. The roadmap is a living document; check it before filing feature requests.

Can I request a roadmap item?

Yes — the doc invites opening an issue on the GitHub repo for missing capabilities, and links each planned feature to the docs that will change when it lands.