# Pipelex — Executable AI Methods ## TL;DR - Pipelex is an open-source runtime (MIT) for executing AI methods defined in declarative `.mthds` files. - Methods are TOML-based, typed, versionable, and readable by both humans and AI agents. - One `.mthds` file runs from CLI, Python, REST API, MCP, or n8n — no code changes needed. - Built for repeatable business automation: invoice processing, document analysis, compliance review, and more. - Agents can author, edit, and compose methods autonomously — the format is designed for machine generation. - Works with any LLM provider: OpenAI, Anthropic, Google, xAI, DeepSeek, Mistral, or local models via Ollama. - Install with `pip install pipelex --pre` and run your first method in minutes. ## Key Links - **Homepage**: https://pipelex.com - **Documentation**: https://docs.pipelex.com/latest/ - **GitHub**: https://github.com/Pipelex/pipelex - **Discord**: https://go.pipelex.com/discord - **Contact**: contact@pipelex.com - **PyPI**: https://pypi.org/project/pipelex/ - **This file**: https://pipelex.com/agent.md ## What is Pipelex Pipelex is the runtime for Methods — a new category between writing code and writing agent skills. When agents automate business tasks, they're stuck between code (total control, weeks of work) and agent skills (minutes to set up, no guarantees). Methods are the sweet spot: declarative `.mthds` files that are readable like instructions, reliable like code, and ready in hours instead of weeks. Define reusable AI methods in `.mthds` files — declarative, testable, and versionable. Pipelex runs them from CLI, API, or MCP so your automation works every time. The format is designed so that AI agents can write, edit, and compose methods autonomously, while humans can review and understand them at a glance. ## The MTHDS Format MTHDS is an open standard defining a portable format for reusable AI methods. It specifies how methods are authored, composed, and executed — so any agent platform can adopt it. The format uses TOML-based syntax that reads like documentation. Methods define typed concepts (data schemas with full type safety), pipes (execution steps), and composable sequences. Pipelex is the reference runtime and primary maintainer of the MTHDS spec. Here is a complete example — an HR screening method that analyzes a job offer, builds a scorecard, and batch-processes CVs with conditional routing: ```toml domain = "hr_screening" description = "Analyze a job offer to build a scorecard, batch process CVs" main_pipe = "screen_candidates" # ── Concepts ────────────────────────────────────────────── [concept.Criterion] description = "A single evaluation criterion for scoring candidates" [concept.Criterion.structure] name = {type = "text", required = true} description = {type = "text", required = true} weight = {type = "number", description = "Importance 1-10", required = true} [concept.Scorecard] description = "Evaluation scorecard built from a job offer" [concept.Scorecard.structure] job_title = {type = "text", required = true} company = {type = "text"} required_skills = {type = "list", item_type = "text"} criteria = {type = "list", item_type = "concept", item_concept_ref = "hr_screening.Criterion"} [concept.CvEvaluation] description = "Complete evaluation of a candidate CV" [concept.CvEvaluation.structure] candidate_name = {type = "text", required = true} overall_score = {type = "number", required = true} fit = {type = "text", required = true, choices = ["yes", "no"]} strengths = {type = "list", item_type = "text"} weaknesses = {type = "list", item_type = "text"} # ── Main Pipe ───────────────────────────────────────────── [pipe.screen_candidates] type = "PipeSequence" inputs = {job_offer = "Document", cvs = "Document[]"} output = "CvResult[]" steps = [ {pipe = "extract_job_offer", result = "job_pages"}, {pipe = "build_scorecard", result = "scorecard"}, {pipe = "evaluate_cv", batch_over = "cvs", result = "results"}, ] [pipe.build_scorecard] type = "PipeLLM" inputs = {job_pages = "Page[]"} output = "Scorecard" model = "$writing-factual" prompt = """Analyze this job offer and build a scorecard...""" [pipe.evaluate_cv] type = "PipeSequence" inputs = {cv = "Document", scorecard = "Scorecard"} output = "CvResult" steps = [ {pipe = "extract_cv", result = "cv_pages"}, {pipe = "score_cv", result = "evaluation"}, {pipe = "route_by_fit", result = "cv_result"}, ] [pipe.score_cv] type = "PipeLLM" inputs = {cv_pages = "Page[]", scorecard = "Scorecard"} output = "CvEvaluation" prompt = """Score the candidate on EACH criterion...""" # ── Conditional Routing ─────────────────────────────────── [pipe.route_by_fit] type = "PipeCondition" inputs = {evaluation = "CvEvaluation", scorecard = "Scorecard"} output = "CvResult" expression = "evaluation.fit" [pipe.route_by_fit.outcomes] yes = "handle_fit" no = "handle_rejection" ``` ## How It Works Pipelex follows a Build → Run → Observe workflow. Author methods in declarative `.mthds` files that are readable by engineers and domain experts alike. The same `.mthds` file runs from your terminal, inside Python, via REST API, through MCP, or as an n8n node. Full visibility into what your methods actually do — debug and optimize with confidence. ### Build Author methods in the MTHDS open standard. Readable by engineers and domain experts alike. **Features:** - **Declarative .mthds language**: Concepts for typed data, pipes for transformations — 5 operator types and 4 controllers built into the language - **Typed concepts with refinement**: Data schemas with full type safety, structured outputs, and concept refinement hierarchies - **Agent-authored**: Agents can write, edit, compose, and discover methods via typed signatures autonomously **Combine the perfect model for each task:** LLMs, OCR, Image Generation, Voice, Small Models, Local Models ### Package Version, share, and compose methods across teams. A real package system for AI methods. **Features:** - **Versioned packages**: Semantic versioning, lock files with SHA-256 integrity, and Git-native distribution - **Cross-package composition**: Depend on other packages and reference their methods with the -> syntax - **Know-How Graph**: Discover methods by typed signature — "I have X, I need Y" — and auto-compose multi-step chains **Ecosystem:** Git, Semantic Versioning, Registry, Lock Files, Know-How Graph ### Run Same .mthds file runs from your terminal, inside Python, via REST API, through MCP, or as an n8n node. **Features:** - **Batch processing**: Parallel execution with automatic batching and rate limiting - **Branch logic**: Conditional paths based on intermediate results - **Composable steps**: Build complex methods from simple, reusable components **Run anywhere:** CLI, Python, REST API, MCP, n8n ### Observe Full visibility into what your methods actually do. Debug and optimize with confidence. **Features:** - **Visual execution**: We generate a visual flowchart for full observability on every execution - **Cost & performance**: Token usage, timing, and cost tracking for every execution *(coming soon)* - **Latency breakdown**: Trace every step to find bottlenecks and optimize *(coming soon)* **Integrations:** OpenTelemetry, Langfuse, PostHog ## Use Cases ### Invoice Processing Extract structured data from invoices, validate against schemas, and push to your systems. *(3 weeks to production)* ### Document Analysis Analyze contracts, reports, and documents with consistent extraction methods. *(Targeting 99% accuracy)* ### Email Automation Classify, route, and respond to emails with repeatable AI methods. *(Minutes to set up)* ### Content Generation Generate marketing copy, product descriptions, and reports at scale. *(1 day to onboard)* ### Compliance Review Automated compliance checking with audit trails and version control. *(Every step traced)* ## Installation ``` /plugin marketplace add mthds-ai/skills /plugin install mthds@mthds-ai-skills ``` ## FAQ ### Why a new format instead of Python? Agents need a format they can reliably generate and execute — not free-form code. .mthds files are declarative, deterministic, and portable: agents write them, humans review them, Pipelex runs them. Python stays in the runtime; the method definition stays agent-readable. ### What is the MTHDS standard? MTHDS is an open standard for defining, packaging, and distributing AI methods. It has two pillars: the Language (typed concepts, pipes, and domains in .mthds files) and the Package System (versioned dependencies, lock files, cross-package references, and a federated registry at [mthds.sh](https://mthds.sh)). The standard is maintained at [mthds.ai](https://mthds.ai) and anyone can implement a runtime. Pipelex is the reference implementation. ### Can other runtimes implement MTHDS? Yes. MTHDS is an open standard with a public specification, not a proprietary format. Any platform can parse .mthds files, validate typed signatures, and execute methods. Pipelex is the reference runtime, but the standard is designed for broad adoption — your methods are never locked to a single tool. ### How does Pipelex compare to LangGraph, Mastra, Pydantic AI? Those are code-first frameworks with proprietary formats — humans write Python or TypeScript. Pipelex implements the MTHDS open standard: a portable, typed language with a real package system. Your methods aren't locked to any runtime. ### How does Pipelex compare to n8n, Make, Workato? GUI-based platforms lock methods in their ecosystem. MTHDS methods are plain-text files — version them in Git with semantic versioning, compose them across packages with cross-package references, deploy them anywhere. ### Is Pipelex an agent framework? No. Pipelex provides deterministic methods that agents call as tools via MCP or API. We make agents reliable at repeatable business tasks — we don't replace your agent stack. ### When is Pipelex the right choice? Repeatable, deterministic AI tasks: invoice processing, contract analysis, report generation, compliance review. If it needs consistent results at scale, Pipelex fits. Not designed for creative exploration or open-ended tasks. ### Is it really open-source? Fully. The MTHDS standard and Pipelex runtime are MIT-licensed. The open-core model means enterprise features (managed cloud, advanced observability, certification) are commercial, but the runtime and the standard stay open. ## License and Pricing The core Pipelex runtime and MTHDS language are fully open-source under the MIT license at github.com/Pipelex. The open-core model means enterprise features (managed cloud, advanced observability, certification) are commercial, but the runtime stays open. --- *Generated from the Pipelex website source.*