pipelex-api 0.71.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. pipelex_api-0.71.0/.gitignore +60 -0
  2. pipelex_api-0.71.0/LICENSE +95 -0
  3. pipelex_api-0.71.0/PKG-INFO +188 -0
  4. pipelex_api-0.71.0/README.md +142 -0
  5. pipelex_api-0.71.0/hatch_build.py +48 -0
  6. pipelex_api-0.71.0/pipelex_api/__init__.py +0 -0
  7. pipelex_api-0.71.0/pipelex_api/api.toml +21 -0
  8. pipelex_api-0.71.0/pipelex_api/api_config.py +144 -0
  9. pipelex_api-0.71.0/pipelex_api/bundle.py +243 -0
  10. pipelex_api-0.71.0/pipelex_api/disclosure.py +43 -0
  11. pipelex_api-0.71.0/pipelex_api/error_types.py +80 -0
  12. pipelex_api-0.71.0/pipelex_api/error_uri.py +45 -0
  13. pipelex_api-0.71.0/pipelex_api/errors.py +130 -0
  14. pipelex_api-0.71.0/pipelex_api/exception_handlers.py +693 -0
  15. pipelex_api-0.71.0/pipelex_api/json_body.py +182 -0
  16. pipelex_api-0.71.0/pipelex_api/limits.py +67 -0
  17. pipelex_api-0.71.0/pipelex_api/main.py +221 -0
  18. pipelex_api-0.71.0/pipelex_api/method_cache.py +241 -0
  19. pipelex_api-0.71.0/pipelex_api/method_source.py +215 -0
  20. pipelex_api-0.71.0/pipelex_api/middleware.py +209 -0
  21. pipelex_api-0.71.0/pipelex_api/openapi_responses.py +186 -0
  22. pipelex_api-0.71.0/pipelex_api/openapi_schema.py +83 -0
  23. pipelex_api-0.71.0/pipelex_api/problem_document.py +134 -0
  24. pipelex_api-0.71.0/pipelex_api/py.typed +0 -0
  25. pipelex_api-0.71.0/pipelex_api/routes/__init__.py +23 -0
  26. pipelex_api-0.71.0/pipelex_api/routes/health.py +24 -0
  27. pipelex_api-0.71.0/pipelex_api/routes/pipelex/__init__.py +21 -0
  28. pipelex_api-0.71.0/pipelex_api/routes/pipelex/agent/__init__.py +11 -0
  29. pipelex_api-0.71.0/pipelex_api/routes/pipelex/agent/concept.py +60 -0
  30. pipelex_api-0.71.0/pipelex_api/routes/pipelex/agent/models.py +49 -0
  31. pipelex_api-0.71.0/pipelex_api/routes/pipelex/agent/pipe_spec.py +59 -0
  32. pipelex_api-0.71.0/pipelex_api/routes/pipelex/build/__init__.py +11 -0
  33. pipelex_api-0.71.0/pipelex_api/routes/pipelex/build/inputs.py +192 -0
  34. pipelex_api-0.71.0/pipelex_api/routes/pipelex/build/output.py +163 -0
  35. pipelex_api-0.71.0/pipelex_api/routes/pipelex/build/runner.py +236 -0
  36. pipelex_api-0.71.0/pipelex_api/routes/pipelex/codegen.py +164 -0
  37. pipelex_api-0.71.0/pipelex_api/routes/pipelex/crate_ops.py +331 -0
  38. pipelex_api-0.71.0/pipelex_api/routes/pipelex/pipe_io.py +186 -0
  39. pipelex_api-0.71.0/pipelex_api/routes/pipelex/pipeline.py +938 -0
  40. pipelex_api-0.71.0/pipelex_api/routes/pipelex/resolve.py +81 -0
  41. pipelex_api-0.71.0/pipelex_api/routes/pipelex/tools.py +111 -0
  42. pipelex_api-0.71.0/pipelex_api/routes/pipelex/utils.py +6 -0
  43. pipelex_api-0.71.0/pipelex_api/routes/pipelex/validate.py +473 -0
  44. pipelex_api-0.71.0/pipelex_api/routes/version.py +51 -0
  45. pipelex_api-0.71.0/pipelex_api/schemas/__init__.py +0 -0
  46. pipelex_api-0.71.0/pipelex_api/schemas/models.py +653 -0
  47. pipelex_api-0.71.0/pipelex_api/security.py +284 -0
  48. pipelex_api-0.71.0/pyproject.toml +399 -0
@@ -0,0 +1,60 @@
1
+
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+
8
+ # Distribution / packaging
9
+ dist/
10
+ *.egg-info/
11
+
12
+ # Unit test / coverage reports
13
+ htmlcov/
14
+ .pytest_cache/
15
+ .coverage
16
+ coverage.xml
17
+
18
+ # Environments
19
+ .env
20
+ .venv
21
+ env/
22
+ venv/
23
+ ENV/
24
+ env.bak/
25
+ venv.bak/
26
+
27
+ # mypy
28
+ .mypy_cache/
29
+
30
+ # Ruff
31
+ .ruff_cache/
32
+
33
+ # General System Files
34
+ *.log
35
+ .DS_Store
36
+ Thumbs.db
37
+
38
+ # Files generated by unit tests
39
+ reports/
40
+ results/
41
+
42
+ # temporary files
43
+ temp/
44
+
45
+ # editor/tool backup artifacts
46
+ *.bak
47
+ *.bak.*
48
+
49
+ gcp_credentials.json
50
+
51
+ .pipelex/storage
52
+
53
+ # personnal pipelex config files that overrides the default one
54
+ pipelex_super.toml
55
+ pipelex_override.toml
56
+ telemetry_override.toml
57
+ # local-only env override (boots the runner as the hosted runner; needs a plugin CI lacks)
58
+ .pipelex/pipelex_dev.toml
59
+
60
+ .gstack/
@@ -0,0 +1,95 @@
1
+ Copyright (c) 2025-2026 Evotis S.A.S.
2
+
3
+ Elastic License 2.0
4
+
5
+ URL: https://www.elastic.co/licensing/elastic-license
6
+
7
+ ## Acceptance
8
+
9
+ By using the software, you agree to all of the terms and conditions below.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
14
+ non-sublicensable, non-transferable license to use, copy, distribute, make
15
+ available, and prepare derivative works of the software, in each case subject to
16
+ the limitations and conditions below.
17
+
18
+ ## Limitations
19
+
20
+ You may not provide the software to third parties as a hosted or managed
21
+ service, where the service provides users with access to any substantial set of
22
+ the features or functionality of the software.
23
+
24
+ You may not move, change, disable, or circumvent the license key functionality
25
+ in the software, and you may not remove or obscure any functionality in the
26
+ software that is protected by the license key.
27
+
28
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
29
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
30
+ to applicable law.
31
+
32
+ ## Patents
33
+
34
+ The licensor grants you a license, under any patent claims the licensor can
35
+ license, or becomes able to license, to make, have made, use, sell, offer for
36
+ sale, import and have imported the software, in each case subject to the
37
+ limitations and conditions in this license. This license does not cover any
38
+ patent claims that you cause to be infringed by modifications or additions to
39
+ the software. If you or your company make any written claim that the software
40
+ infringes or contributes to infringement of any patent, your patent license for
41
+ the software granted under these terms ends immediately. If your company makes
42
+ such a claim, your patent license ends immediately for work on behalf of your
43
+ company.
44
+
45
+ ## Notices
46
+
47
+ You must ensure that anyone who gets a copy of any part of the software from you
48
+ also gets a copy of these terms.
49
+
50
+ If you modify the software, you must include in any modified copies of the
51
+ software prominent notices stating that you have modified the software.
52
+
53
+ ## No Other Rights
54
+
55
+ These terms do not imply any licenses other than those expressly granted in
56
+ these terms.
57
+
58
+ ## Termination
59
+
60
+ If you use the software in violation of these terms, such use is not licensed,
61
+ and your licenses will automatically terminate. If the licensor provides you
62
+ with a notice of your violation, and you cease all violation of this license no
63
+ later than 30 days after you receive that notice, your licenses will be
64
+ reinstated retroactively. However, if you violate these terms after such
65
+ reinstatement, any additional violation of these terms will cause your licenses
66
+ to terminate automatically and permanently.
67
+
68
+ ## No Liability
69
+
70
+ *As far as the law allows, the software comes as is, without any warranty or
71
+ condition, and the licensor will not be liable to you for any damages arising
72
+ out of these terms or the use or nature of the software, under any kind of
73
+ legal claim.*
74
+
75
+ ## Definitions
76
+
77
+ The **licensor** is the entity offering these terms, and the **software** is the
78
+ software the licensor makes available under these terms, including any portion
79
+ of it.
80
+
81
+ **you** refers to the individual or entity agreeing to these terms.
82
+
83
+ **your company** is any legal entity, sole proprietorship, or other kind of
84
+ organization that you work for, plus all organizations that have control over,
85
+ are under the control of, or are under common control with that
86
+ organization. **control** means ownership of substantially all the assets of an
87
+ entity, or the power to direct its management and policies by vote, contract, or
88
+ otherwise. Control can be direct or indirect.
89
+
90
+ **your licenses** are all the licenses granted to you for the software under
91
+ these terms.
92
+
93
+ **use** means anything you do with the software requiring one of your licenses.
94
+
95
+ **trademark** means trademarks, service marks, and similar rights.
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.5
2
+ Name: pipelex-api
3
+ Version: 0.71.0
4
+ Summary: Pipelex API
5
+ Project-URL: Homepage, https://pipelex.com
6
+ Project-URL: Repository, https://github.com/Pipelex/pipelex
7
+ Project-URL: Documentation, https://docs.pipelex.com/latest/api-server/
8
+ Project-URL: Changelog, https://docs.pipelex.com/latest/changelog/
9
+ Author-email: "Evotis S.A.S." <oss@pipelex.com>
10
+ Maintainer-email: Pipelex staff <oss@pipelex.com>
11
+ License-Expression: Elastic-2.0
12
+ License-File: LICENSE
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Requires-Python: <3.15,>=3.11
18
+ Requires-Dist: fastapi<0.142,>=0.118.0
19
+ Requires-Dist: pipelex[anthropic,bedrock,fal,google,google-genai,mistralai]==0.71.0
20
+ Requires-Dist: pyjwt>=2.10.1
21
+ Requires-Dist: uvicorn>=0.37.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: boto3-stubs>=1.35.24; extra == 'dev'
24
+ Requires-Dist: httpx2>=2.4.0; extra == 'dev'
25
+ Requires-Dist: mypy>=1.11.2; extra == 'dev'
26
+ Requires-Dist: pandas-stubs>=2.2.3.241126; extra == 'dev'
27
+ Requires-Dist: pylint>=3.3.8; extra == 'dev'
28
+ Requires-Dist: pyright>=1.1.405; extra == 'dev'
29
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=6.1.1; extra == 'dev'
31
+ Requires-Dist: pytest-mock>=3.14.0; extra == 'dev'
32
+ Requires-Dist: pytest-sugar>=1.0.0; extra == 'dev'
33
+ Requires-Dist: pytest-xdist>=3.6.1; extra == 'dev'
34
+ Requires-Dist: pytest>=8.3.3; extra == 'dev'
35
+ Requires-Dist: ruff>=0.6.8; extra == 'dev'
36
+ Requires-Dist: types-aiobotocore[bedrock,bedrock-runtime]>=3.0.0; extra == 'dev'
37
+ Requires-Dist: types-aiofiles>=24.1.0.20240626; extra == 'dev'
38
+ Requires-Dist: types-beautifulsoup4>=4.12.0.20240907; extra == 'dev'
39
+ Requires-Dist: types-markdown>=3.6.0.20240316; extra == 'dev'
40
+ Requires-Dist: types-networkx>=3.3.0.20241020; extra == 'dev'
41
+ Requires-Dist: types-openpyxl>=3.1.5.20250306; extra == 'dev'
42
+ Requires-Dist: types-pyyaml>=6.0.12.20250326; extra == 'dev'
43
+ Requires-Dist: types-requests>=2.32.0.2024091; extra == 'dev'
44
+ Requires-Dist: types-toml>=0.10.8.20240310; extra == 'dev'
45
+ Description-Content-Type: text/markdown
46
+
47
+ <div align="center">
48
+ <a href="https://www.pipelex.com/"><img src="https://raw.githubusercontent.com/Pipelex/pipelex/main/.github/assets/logo.png" alt="Pipelex Logo" width="400" style="max-width: 100%; height: auto;"></a>
49
+
50
+ <h2 align="center">Pipelex API</h2>
51
+
52
+ The official REST API server for building and executing Pipelex pipelines. Deploy your pipelines as HTTP endpoints and integrate them into any application or workflow.
53
+
54
+ <div>
55
+ <a href="https://docs.pipelex.com/latest/api-server/"><strong>API Documentation</strong></a> -
56
+ <a href="https://github.com/Pipelex/pipelex"><strong>Pipelex Core</strong></a> -
57
+ <a href="https://go.pipelex.com/discord"><strong>Discord</strong></a>
58
+ </div>
59
+ <br/>
60
+
61
+ <p align="center">
62
+ <a href="https://docs.pipelex.com/latest/license/"><img src="https://img.shields.io/badge/License-Elastic--2.0-blue.svg" alt="Elastic License 2.0"></a>
63
+ <a href="https://go.pipelex.com/discord"><img src="https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
64
+ <a href="https://docs.pipelex.com/"><img src="https://img.shields.io/badge/Docs-03bb95?logo=read-the-docs&logoColor=white&style=flat" alt="Documentation"></a>
65
+ </p>
66
+ </div>
67
+
68
+ ---
69
+
70
+ > **Released with pipelex, under pipelex's version.** This server is the [`api/` directory](https://github.com/Pipelex/pipelex/tree/main/api) of [`Pipelex/pipelex`](https://github.com/Pipelex/pipelex), and every pipelex release ships it: the `pipelex-api` package on PyPI pins the `pipelex` of the same version, and `pipelex/pipelex-api:X.Y.Z` runs pipelex X.Y.Z. It was released on its own from `Pipelex/pipelex-api` until v0.33.2, so the image tag that follows 0.33.2 is a pipelex version. The image keeps its name, its port and its `/root/.pipelex` configuration mount. Please open issues on `Pipelex/pipelex`.
71
+
72
+ # 📑 Table of Contents
73
+
74
+ - [Introduction](#introduction)
75
+ - [Quick Start with Docker](#-quick-start-with-docker)
76
+ - [Run your first pipeline](#-run-your-first-pipeline)
77
+ - [How to scale Pipelex](#-how-to-scale-pipelex)
78
+ - [API Documentation](#-api-documentation)
79
+ - [Support](#-support)
80
+ - [License](#-license)
81
+
82
+ # Introduction
83
+
84
+ The **Pipelex API Server** is a FastAPI-based REST API that allows you to execute [Pipelex](https://github.com/Pipelex/pipelex) pipelines via HTTP requests. Deploy your pipelines as HTTP endpoints and integrate them into any application or workflow.
85
+
86
+ It is the source-available reference implementation of the **[MTHDS Protocol](https://mthds.ai)** — the minimal HTTP contract every MTHDS runner implements (`POST /execute`, `POST /start`, `POST /validate`, `GET /models`, `GET /version`). The contracts nest: **MTHDS Protocol ⊂ Pipelex API (this server) ⊂ Pipelex hosted API**. This server adds the build tooling extensions (`/build/*`) on top of the protocol; the hosted API at `api.pipelex.com/v1` adds durable runs, the method catalog, and account management on top of this server — same shapes throughout. All routes live under the `/v1` base path; the committed contract is [`pipelex-api.openapi.yaml`](https://github.com/Pipelex/pipelex/blob/main/docs/api-server/openapi/pipelex-api.openapi.yaml).
87
+
88
+ # 🚀 Quick Start with Docker
89
+
90
+ **Official Docker image available at:** [`pipelex/pipelex-api`](https://hub.docker.com/r/pipelex/pipelex-api)
91
+
92
+ The published image is **generic and configuration-light**: Temporal is off, no S3, no remote tracing. It boots with a single required env var (`PIPELEX_GATEWAY_API_KEY`), and you bring your own [Pipelex configuration](https://docs.pipelex.com/latest/api-server/configuration/) on top to enable storage, tracing, Temporal, or anything else.
93
+
94
+ ### 1. Run with Docker
95
+
96
+ The only required env var is `PIPELEX_GATEWAY_API_KEY`. Get a free key (with free credits) at https://app.pipelex.com, then run:
97
+
98
+ ```bash
99
+ docker run --name pipelex-api -p 8081:8081 \
100
+ -e PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-api-key \
101
+ pipelex/pipelex-api:latest
102
+ ```
103
+
104
+ To require authentication on the API, add `-e AUTH_MODE=api_key -e API_KEY=your-secret` (or `AUTH_MODE=jwt` + `JWT_SECRET_KEY`). See [`.env.example`](https://github.com/Pipelex/pipelex/blob/main/api/.env.example) for the full list of supported variables and the [Configuration page](https://docs.pipelex.com/latest/api-server/configuration/) for `--env-file` and `docker compose` patterns if you'd rather keep config out of your shell history.
105
+
106
+ If you'd rather build the image yourself instead of pulling, replace `pipelex/pipelex-api:latest` with a local tag after `docker build -f api/Dockerfile -t pipelex-api .`, run from the root of a `Pipelex/pipelex` checkout: the build context is the repository root, so the image installs the pipelex library of the same commit.
107
+
108
+ ### 2. Verify
109
+
110
+ ```bash
111
+ curl http://localhost:8081/health
112
+ ```
113
+
114
+ The API is now running at `http://localhost:8081`. To customize behavior (enable Temporal, swap to S3 storage, layer in env-specific overrides, …), see the [Configuration page](https://docs.pipelex.com/latest/api-server/configuration/).
115
+
116
+ # 🧪 Run your first pipeline
117
+
118
+ Once `/health` is green, send an inline pipeline definition and inputs to `/v1/execute`. The example below summarizes a string with a one-pipe MTHDS bundle — no files, no auth, copy-paste:
119
+
120
+ ```bash
121
+ curl -s http://localhost:8081/v1/execute \
122
+ -H "Content-Type: application/json" \
123
+ -d '{
124
+ "pipe_code": "summarize",
125
+ "mthds_contents": ["domain = \"hello\"\nmain_pipe = \"summarize\"\n\n[pipe.summarize]\ntype = \"PipeLLM\"\ndescription = \"Summarize the input text in one sentence\"\ninputs = { text = \"Text\" }\noutput = \"Text\"\nprompt = \"Summarize in one sentence:\\n@text\"\n"],
126
+ "inputs": { "text": "Pipelex turns plain-language pipeline definitions into reproducible AI workflows that run as HTTP endpoints." }
127
+ }'
128
+ ```
129
+
130
+ You'll get back a JSON response with `state: "COMPLETED"` and the summary under `pipe_output.working_memory.root.<main_stuff_name>.content`.
131
+
132
+ **Passing files (PDFs, images) as inputs.** Use the `Document` concept and point it at any HTTP(S) URL:
133
+
134
+ ```json
135
+ {
136
+ "pipe_code": "your_pipe",
137
+ "mthds_contents": ["...your MTHDS..."],
138
+ "inputs": {
139
+ "cv": { "concept": "Document", "content": { "url": "https://example.com/resume.pdf" } }
140
+ }
141
+ }
142
+ ```
143
+
144
+ `Document` accepts public HTTP/HTTPS URLs, `pipelex-storage://` URIs, or base64 data URLs. For images, use the `Image` concept with the same `{ "url": "..." }` shape.
145
+
146
+ For inline MTHDS in the request, `mthds_contents` is a JSON array of raw `.mthds` (TOML) file contents as strings — typically `[open("my_pipe.mthds").read()]` from a client. See the [Pipe Run page](https://docs.pipelex.com/latest/api-server/pipe-run/) for every supported input shape and the full `/execute` reference.
147
+
148
+ # 📈 How to scale Pipelex
149
+
150
+ A single Pipelex API container is great for development, prototyping, and low-concurrency workloads — pipelines run in-process and `/v1/execute` blocks the request thread until they finish.
151
+
152
+ For production-scale workloads (high concurrency, long-running pipelines, retries, durable execution, horizontal scaling), the recommended path is to run Pipelex on top of [**Temporal**](https://temporal.io/). With Temporal enabled:
153
+
154
+ - Pipeline runs become durable workflows — survive worker crashes, support retries and timeouts out of the box.
155
+ - The API container becomes a thin orchestrator: it submits workflows to a Temporal cluster and returns a `pipeline_run_id` immediately (this is what `POST /v1/start` already does).
156
+ - Pipeline execution itself runs on a separate pool of **Pipelex workers** that you scale independently from the HTTP layer.
157
+ - Async completion callbacks (`callback_urls` + `X-Completion-Signature`, see [Pipe Run](https://docs.pipelex.com/latest/api-server/pipe-run/)) let your application be notified when each run finishes, without polling.
158
+
159
+ Pipelex already integrates with Temporal under the hood, and the Docker image accepts `TEMPORAL_API_KEY` plus a `[temporal] is_enabled = true` override in `.pipelex/`. **A complete deployment recipe (Temporal cluster sizing, worker container, autoscaling guidance, and an end-to-end docker-compose) is coming soon.** In the meantime, if you need to scale today, get in touch on [Discord](https://go.pipelex.com/discord) and we'll help you wire it up.
160
+
161
+ # 📖 API Documentation
162
+
163
+ The full reference for this API server is part of the Pipelex documentation, under [API Server](https://docs.pipelex.com/latest/api-server/):
164
+
165
+ - [Overview](https://docs.pipelex.com/latest/api-server/) — endpoints, authentication, deployment
166
+ - [Pipe Run](https://docs.pipelex.com/latest/api-server/pipe-run/) — `/execute`, `/start`, every input shape
167
+ - [Pipe Validate](https://docs.pipelex.com/latest/api-server/pipe-validate/) — `/validate`
168
+ - [Pipe Builder](https://docs.pipelex.com/latest/api-server/pipe-builder/) — `/build/inputs`, `/build/output`, `/build/runner`
169
+ - [Configuration](https://docs.pipelex.com/latest/api-server/configuration/) — env vars, mounting your own `.pipelex/` config
170
+
171
+ For broader Pipelex documentation (MTHDS language, concepts, pipe types, the Gateway): **[https://docs.pipelex.com/](https://docs.pipelex.com/)**
172
+
173
+ # 💬 Support
174
+
175
+ - **API Documentation**: [https://docs.pipelex.com/latest/api-server/](https://docs.pipelex.com/latest/api-server/)
176
+ - **Pipelex Documentation**: [https://docs.pipelex.com/](https://docs.pipelex.com/)
177
+ - **Discord Community**: [https://go.pipelex.com/discord](https://go.pipelex.com/discord)
178
+ - **Main Repository**: [https://github.com/Pipelex/pipelex](https://github.com/Pipelex/pipelex)
179
+
180
+ # 📝 License
181
+
182
+ This project is licensed under the Elastic License 2.0 (ELv2); see [LICENSE](https://github.com/Pipelex/pipelex/blob/main/LICENSE) for the terms, and the [license page](https://docs.pipelex.com/latest/license/) for how Pipelex reads them. Runtime dependencies are distributed under their own licenses via PyPI.
183
+
184
+ ---
185
+
186
+ "Pipelex" is a trademark of Evotis S.A.S.
187
+
188
+ © 2025-2026 Evotis S.A.S.
@@ -0,0 +1,142 @@
1
+ <div align="center">
2
+ <a href="https://www.pipelex.com/"><img src="https://raw.githubusercontent.com/Pipelex/pipelex/main/.github/assets/logo.png" alt="Pipelex Logo" width="400" style="max-width: 100%; height: auto;"></a>
3
+
4
+ <h2 align="center">Pipelex API</h2>
5
+
6
+ The official REST API server for building and executing Pipelex pipelines. Deploy your pipelines as HTTP endpoints and integrate them into any application or workflow.
7
+
8
+ <div>
9
+ <a href="https://docs.pipelex.com/latest/api-server/"><strong>API Documentation</strong></a> -
10
+ <a href="https://github.com/Pipelex/pipelex"><strong>Pipelex Core</strong></a> -
11
+ <a href="https://go.pipelex.com/discord"><strong>Discord</strong></a>
12
+ </div>
13
+ <br/>
14
+
15
+ <p align="center">
16
+ <a href="https://docs.pipelex.com/latest/license/"><img src="https://img.shields.io/badge/License-Elastic--2.0-blue.svg" alt="Elastic License 2.0"></a>
17
+ <a href="https://go.pipelex.com/discord"><img src="https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
18
+ <a href="https://docs.pipelex.com/"><img src="https://img.shields.io/badge/Docs-03bb95?logo=read-the-docs&logoColor=white&style=flat" alt="Documentation"></a>
19
+ </p>
20
+ </div>
21
+
22
+ ---
23
+
24
+ > **Released with pipelex, under pipelex's version.** This server is the [`api/` directory](https://github.com/Pipelex/pipelex/tree/main/api) of [`Pipelex/pipelex`](https://github.com/Pipelex/pipelex), and every pipelex release ships it: the `pipelex-api` package on PyPI pins the `pipelex` of the same version, and `pipelex/pipelex-api:X.Y.Z` runs pipelex X.Y.Z. It was released on its own from `Pipelex/pipelex-api` until v0.33.2, so the image tag that follows 0.33.2 is a pipelex version. The image keeps its name, its port and its `/root/.pipelex` configuration mount. Please open issues on `Pipelex/pipelex`.
25
+
26
+ # 📑 Table of Contents
27
+
28
+ - [Introduction](#introduction)
29
+ - [Quick Start with Docker](#-quick-start-with-docker)
30
+ - [Run your first pipeline](#-run-your-first-pipeline)
31
+ - [How to scale Pipelex](#-how-to-scale-pipelex)
32
+ - [API Documentation](#-api-documentation)
33
+ - [Support](#-support)
34
+ - [License](#-license)
35
+
36
+ # Introduction
37
+
38
+ The **Pipelex API Server** is a FastAPI-based REST API that allows you to execute [Pipelex](https://github.com/Pipelex/pipelex) pipelines via HTTP requests. Deploy your pipelines as HTTP endpoints and integrate them into any application or workflow.
39
+
40
+ It is the source-available reference implementation of the **[MTHDS Protocol](https://mthds.ai)** — the minimal HTTP contract every MTHDS runner implements (`POST /execute`, `POST /start`, `POST /validate`, `GET /models`, `GET /version`). The contracts nest: **MTHDS Protocol ⊂ Pipelex API (this server) ⊂ Pipelex hosted API**. This server adds the build tooling extensions (`/build/*`) on top of the protocol; the hosted API at `api.pipelex.com/v1` adds durable runs, the method catalog, and account management on top of this server — same shapes throughout. All routes live under the `/v1` base path; the committed contract is [`pipelex-api.openapi.yaml`](https://github.com/Pipelex/pipelex/blob/main/docs/api-server/openapi/pipelex-api.openapi.yaml).
41
+
42
+ # 🚀 Quick Start with Docker
43
+
44
+ **Official Docker image available at:** [`pipelex/pipelex-api`](https://hub.docker.com/r/pipelex/pipelex-api)
45
+
46
+ The published image is **generic and configuration-light**: Temporal is off, no S3, no remote tracing. It boots with a single required env var (`PIPELEX_GATEWAY_API_KEY`), and you bring your own [Pipelex configuration](https://docs.pipelex.com/latest/api-server/configuration/) on top to enable storage, tracing, Temporal, or anything else.
47
+
48
+ ### 1. Run with Docker
49
+
50
+ The only required env var is `PIPELEX_GATEWAY_API_KEY`. Get a free key (with free credits) at https://app.pipelex.com, then run:
51
+
52
+ ```bash
53
+ docker run --name pipelex-api -p 8081:8081 \
54
+ -e PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-api-key \
55
+ pipelex/pipelex-api:latest
56
+ ```
57
+
58
+ To require authentication on the API, add `-e AUTH_MODE=api_key -e API_KEY=your-secret` (or `AUTH_MODE=jwt` + `JWT_SECRET_KEY`). See [`.env.example`](https://github.com/Pipelex/pipelex/blob/main/api/.env.example) for the full list of supported variables and the [Configuration page](https://docs.pipelex.com/latest/api-server/configuration/) for `--env-file` and `docker compose` patterns if you'd rather keep config out of your shell history.
59
+
60
+ If you'd rather build the image yourself instead of pulling, replace `pipelex/pipelex-api:latest` with a local tag after `docker build -f api/Dockerfile -t pipelex-api .`, run from the root of a `Pipelex/pipelex` checkout: the build context is the repository root, so the image installs the pipelex library of the same commit.
61
+
62
+ ### 2. Verify
63
+
64
+ ```bash
65
+ curl http://localhost:8081/health
66
+ ```
67
+
68
+ The API is now running at `http://localhost:8081`. To customize behavior (enable Temporal, swap to S3 storage, layer in env-specific overrides, …), see the [Configuration page](https://docs.pipelex.com/latest/api-server/configuration/).
69
+
70
+ # 🧪 Run your first pipeline
71
+
72
+ Once `/health` is green, send an inline pipeline definition and inputs to `/v1/execute`. The example below summarizes a string with a one-pipe MTHDS bundle — no files, no auth, copy-paste:
73
+
74
+ ```bash
75
+ curl -s http://localhost:8081/v1/execute \
76
+ -H "Content-Type: application/json" \
77
+ -d '{
78
+ "pipe_code": "summarize",
79
+ "mthds_contents": ["domain = \"hello\"\nmain_pipe = \"summarize\"\n\n[pipe.summarize]\ntype = \"PipeLLM\"\ndescription = \"Summarize the input text in one sentence\"\ninputs = { text = \"Text\" }\noutput = \"Text\"\nprompt = \"Summarize in one sentence:\\n@text\"\n"],
80
+ "inputs": { "text": "Pipelex turns plain-language pipeline definitions into reproducible AI workflows that run as HTTP endpoints." }
81
+ }'
82
+ ```
83
+
84
+ You'll get back a JSON response with `state: "COMPLETED"` and the summary under `pipe_output.working_memory.root.<main_stuff_name>.content`.
85
+
86
+ **Passing files (PDFs, images) as inputs.** Use the `Document` concept and point it at any HTTP(S) URL:
87
+
88
+ ```json
89
+ {
90
+ "pipe_code": "your_pipe",
91
+ "mthds_contents": ["...your MTHDS..."],
92
+ "inputs": {
93
+ "cv": { "concept": "Document", "content": { "url": "https://example.com/resume.pdf" } }
94
+ }
95
+ }
96
+ ```
97
+
98
+ `Document` accepts public HTTP/HTTPS URLs, `pipelex-storage://` URIs, or base64 data URLs. For images, use the `Image` concept with the same `{ "url": "..." }` shape.
99
+
100
+ For inline MTHDS in the request, `mthds_contents` is a JSON array of raw `.mthds` (TOML) file contents as strings — typically `[open("my_pipe.mthds").read()]` from a client. See the [Pipe Run page](https://docs.pipelex.com/latest/api-server/pipe-run/) for every supported input shape and the full `/execute` reference.
101
+
102
+ # 📈 How to scale Pipelex
103
+
104
+ A single Pipelex API container is great for development, prototyping, and low-concurrency workloads — pipelines run in-process and `/v1/execute` blocks the request thread until they finish.
105
+
106
+ For production-scale workloads (high concurrency, long-running pipelines, retries, durable execution, horizontal scaling), the recommended path is to run Pipelex on top of [**Temporal**](https://temporal.io/). With Temporal enabled:
107
+
108
+ - Pipeline runs become durable workflows — survive worker crashes, support retries and timeouts out of the box.
109
+ - The API container becomes a thin orchestrator: it submits workflows to a Temporal cluster and returns a `pipeline_run_id` immediately (this is what `POST /v1/start` already does).
110
+ - Pipeline execution itself runs on a separate pool of **Pipelex workers** that you scale independently from the HTTP layer.
111
+ - Async completion callbacks (`callback_urls` + `X-Completion-Signature`, see [Pipe Run](https://docs.pipelex.com/latest/api-server/pipe-run/)) let your application be notified when each run finishes, without polling.
112
+
113
+ Pipelex already integrates with Temporal under the hood, and the Docker image accepts `TEMPORAL_API_KEY` plus a `[temporal] is_enabled = true` override in `.pipelex/`. **A complete deployment recipe (Temporal cluster sizing, worker container, autoscaling guidance, and an end-to-end docker-compose) is coming soon.** In the meantime, if you need to scale today, get in touch on [Discord](https://go.pipelex.com/discord) and we'll help you wire it up.
114
+
115
+ # 📖 API Documentation
116
+
117
+ The full reference for this API server is part of the Pipelex documentation, under [API Server](https://docs.pipelex.com/latest/api-server/):
118
+
119
+ - [Overview](https://docs.pipelex.com/latest/api-server/) — endpoints, authentication, deployment
120
+ - [Pipe Run](https://docs.pipelex.com/latest/api-server/pipe-run/) — `/execute`, `/start`, every input shape
121
+ - [Pipe Validate](https://docs.pipelex.com/latest/api-server/pipe-validate/) — `/validate`
122
+ - [Pipe Builder](https://docs.pipelex.com/latest/api-server/pipe-builder/) — `/build/inputs`, `/build/output`, `/build/runner`
123
+ - [Configuration](https://docs.pipelex.com/latest/api-server/configuration/) — env vars, mounting your own `.pipelex/` config
124
+
125
+ For broader Pipelex documentation (MTHDS language, concepts, pipe types, the Gateway): **[https://docs.pipelex.com/](https://docs.pipelex.com/)**
126
+
127
+ # 💬 Support
128
+
129
+ - **API Documentation**: [https://docs.pipelex.com/latest/api-server/](https://docs.pipelex.com/latest/api-server/)
130
+ - **Pipelex Documentation**: [https://docs.pipelex.com/](https://docs.pipelex.com/)
131
+ - **Discord Community**: [https://go.pipelex.com/discord](https://go.pipelex.com/discord)
132
+ - **Main Repository**: [https://github.com/Pipelex/pipelex](https://github.com/Pipelex/pipelex)
133
+
134
+ # 📝 License
135
+
136
+ This project is licensed under the Elastic License 2.0 (ELv2); see [LICENSE](https://github.com/Pipelex/pipelex/blob/main/LICENSE) for the terms, and the [license page](https://docs.pipelex.com/latest/license/) for how Pipelex reads them. Runtime dependencies are distributed under their own licenses via PyPI.
137
+
138
+ ---
139
+
140
+ "Pipelex" is a trademark of Evotis S.A.S.
141
+
142
+ © 2025-2026 Evotis S.A.S.
@@ -0,0 +1,48 @@
1
+ """The hatch metadata hook that pins the published server on the pipelex it was released with.
2
+
3
+ The server and the library are released together under one version number, which this member reads from the
4
+ repository root's `pyproject.toml` (`[tool.hatch.version]`). In the workspace, its `pipelex` dependency resolves
5
+ from the same commit and carries no version, because uv ignores a version specifier on a workspace source. A
6
+ published `pipelex-api` has no workspace to resolve from, so its metadata must say which pipelex it was released
7
+ with, or an install would pair the server with whatever pipelex PyPI serves.
8
+
9
+ This hook writes the dependencies: each requirement of `lockstep-dependencies` pinned to `==` this distribution's
10
+ own version, then `dependencies` as written. Both lists live in `[tool.hatch.metadata.hooks.custom]` of
11
+ `pyproject.toml`, and `dependencies` is declared dynamic there, since a build backend may not rewrite a static
12
+ field. A wheel built from the sdist reads the dependencies back from `PKG-INFO`, so this hook runs once per release.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ from typing import Any
18
+
19
+ from hatchling.metadata.plugin.interface import MetadataHookInterface
20
+ from packaging.requirements import Requirement
21
+
22
+
23
+ class LockstepPinMetadataHook(MetadataHookInterface):
24
+ def update(self, metadata: dict[str, Any]) -> None:
25
+ version = metadata.get("version")
26
+ if not isinstance(version, str) or not version:
27
+ msg = "The lockstep pin needs the distribution's version, which hatch had not resolved when the hook ran."
28
+ raise ValueError(msg)
29
+ lockstep_requirements = self._string_list(option="lockstep-dependencies")
30
+ other_requirements = self._string_list(option="dependencies")
31
+ pinned_requirements: list[str] = []
32
+ for requirement_text in lockstep_requirements:
33
+ requirement = Requirement(requirement_text)
34
+ if requirement.specifier or requirement.url or requirement.marker:
35
+ msg = (
36
+ f"`{requirement_text}` in `lockstep-dependencies` must name the package and its extras only: "
37
+ "the hook supplies the version, so a specifier, a URL or a marker written here would be overridden."
38
+ )
39
+ raise ValueError(msg)
40
+ pinned_requirements.append(f"{requirement_text}=={version}")
41
+ metadata["dependencies"] = [*pinned_requirements, *other_requirements]
42
+
43
+ def _string_list(self, *, option: str) -> list[str]:
44
+ value = self.config.get(option)
45
+ if not isinstance(value, list) or not all(isinstance(item, str) for item in value):
46
+ msg = f"Option `{option}` of the custom metadata hook must be a list of strings."
47
+ raise TypeError(msg)
48
+ return list(value)
File without changes
@@ -0,0 +1,21 @@
1
+ # Pipelex-API deployment config — the packaged default, loaded by `load_api_config()`
2
+ # (pipelex_api/api_config.py) via core's env-aware `load_plugin_config` and validated into `ApiConfig`.
3
+ # Keys live at the file root (no `[api]` wrapper) — `load_plugin_config` validates the whole merged
4
+ # document against the schema, exactly like `pipelex-temporal`'s `temporal.toml`. The packaged
5
+ # default here is deep-merged with an optional `api_{env}.toml` / `api_override.toml` at `~/.pipelex`
6
+ # then the project `.pipelex` (env selected by `PIPELEX_ENV`). This source-available base names NO
7
+ # orchestrator: it ships the in-process `direct` mode and refuses per-request override. A deployment
8
+ # flavor bakes its own `.pipelex/api_{env}.toml` to flip this (e.g. `pipelex-api-hosted` sets
9
+ # `orchestration_mode = "temporal"`).
10
+
11
+ # Which orchestrator a top-level run dispatches to, through the orchestrator registry.
12
+ # `orchestration_mode` is an OPEN string token: core owns "direct" (in-process); each orchestrator
13
+ # plugin owns its own ("temporal" from pipelex-temporal, "mistral-workflows" from
14
+ # pipelex-mistral-workflows). A token whose plugin is not installed fails loud at dispatch with the
15
+ # plugin's install hint. The delivery axis (blocking vs fire-and-forget) is NOT configured here — it
16
+ # is set by the endpoint (`/execute` and `/validate` block; `/start` is fire-and-forget).
17
+ orchestration_mode = "direct"
18
+
19
+ # Whether a caller may override `orchestration_mode` per request. Off on the base (and recommended off
20
+ # on hosted flavors): a locked-down distributed runner must not be coercible into `direct`.
21
+ allow_request_orchestration_mode_override = false