The Problem
Teams building AI workflows face a gap between ad-hoc scripting and heavyweight orchestration frameworks. Prompt logic gets buried in Python, model calls are hard to swap, and outputs lack structure. Pipelex addresses this with a declarative .mthds file format where a pipeline step is a typed TOML block, not imperative code.
What This Does
Pipelex is a Python package (1288 files) that executes declarative AI workflows. A method file declares typed pipes—PipeLLM, PipeExtract, PipeSearch—that route to 60+ models via configured backends in .pipelex/inference/backends/*.toml. The system handles structured output parsing, pipeline orchestration, and validation.
The project splits into a core runtime (pipelex/core/, pipelex/pipeline/) and a CLI (pipelex/cli/). It includes 709 test files and extensive docs (145 files) covering cookbooks, configuration, and advanced injection patterns.
How It Is Wired
Execution starts at the CLI entry points: pipelex/cli/commands/build/app.py for compilation, pipelex/cli/agent_cli/commands/run/app.py for execution. The import graph shows 1259 internal modules with 5521 edges. The hub is pipelex/hub (174 modules import it, 31 it imports) and pipelex/__init__.py (187 dependents). These are the highest-blast-radius files—changes ripple across the entire codebase.
The runtime routes through pipelex/core/concepts/ for type definitions and pipelex/core/pipes/pipe_abstract.py (647 lines) for pipe behavior. The pipelex/hub module is the central registry that everything depends on, making it the bottleneck for any architectural change. Two modules sit in a circular import cycle involving pipelex/core/stuffs/stuff.py.
The system touches external services through inference backends (OpenAI, Anthropic, etc.), file I/O for documents, and optional telemetry via pipelex/telemetry.toml. Network calls happen through the configured model providers.
How To Use It
# Clone and install
git clone https://github.com/moses-y/pipelex
cd pipelex
pip install -e . # or use uv
# Configure providers in .pipelex/inference/backends/*.toml
# Set API keys per the .env.example file
# Run a method
pipelex run path/to/method.mthds
The README documents a Claude Code setup: npm install -g mthds && mthds-agent bootstrap. Configuration lives in .pipelex/pipelex.toml and backend-specific TOML files under .pipelex/inference/backends/.
Real-World Use
A content team builds a blog pipeline: PipeLLM for drafting, PipeExtract for metadata, PipeSearch for research. Each step is a typed block in a .mthds file, swapable between OpenAI and Anthropic by changing one config line. The docs/cookbook/blog-article-generator.md shows this exact pattern.
Code Health & Issues
Static analysis found 311 findings (68 high, 240 medium, 3 low). Key issues:
- High - Deep nesting in
pipelex/core/stuffs/stuff_factory.py,pipelex/core/memory/working_memory.py,pipelex/core/concepts/concept_factory.py(max depth 8) - hard to follow control flow - High - Hub modules in
pipelex/__init__.py,pipelex/hub.py,pipelex/types.py- 187 modules depend onpipelex/__init__.py; high churn risk - High - Import cycle in
pipelex/core/stuffs/stuff.py- circular dependency - Medium - Broad exception handling in
pipelex/tools/misc/string_utils.py,json_utils.py - Medium - Oversized file in
pipelex/core/pipes/pipe_abstract.py(647 lines)
SDLC gaps: no lockfile (non-reproducible builds), 8 dependencies behind major versions (including openai 2 majors behind), and 10.4MB GIF committed to the repo. CI uses GitHub Actions with 17 workflows but lacks least-privilege token permissions on 2 workflows.
The Bottom Line
Pipelex is a serious, well-documented attempt at declarative AI workflows with real typing and model abstraction. The hub architecture and deep nesting will make it painful to modify at scale, and the missing lockfile complicates deployment. Worth evaluating if you need portable, typed AI method definitions across multiple model providers.