Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

feature/Runner-docs-teach-files · L-261020-cbf686 (#1462)

Louis Choquel4c67d915864a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b62dd15b6..72f1da10f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## [Unreleased]
+
+### Changed
+
+- **The API server's examples send a method in `files`**: the server's README and the API Server pages send a method to `/v1/execute` and `/v1/validate` in `files`, a map from each file's path in the method's folder to its content, where they sent `mthds_contents`. The reference pages and the OpenAPI artifact now say that `mthds_contents`, with `bundle_b64`, `resources` and `/v1/validate`'s `mthds_sources`, is being retired and will be refused by a later release, so a client sends `files` now.
+
## [v0.90.0] - 2026-10-19
### Added
diff --git a/api/README.md b/api/README.md
index 2b9f5a7ad..ad326a335 100644
--- a/api/README.md
+++ b/api/README.md
@@ -69,26 +69,27 @@ The API is now running at `http://localhost:8081`. To customize behavior (enable
# 🧪 Run your first pipeline
-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:
+Once `/health` is green, send a method and its inputs to `/v1/execute`. The method travels in `files`, a map from each file's path in the method's folder to that file's content. The example below summarizes a string with a method made of a single `.mthds` file, with no auth, ready to copy and paste:
```bash
curl -s http://localhost:8081/v1/execute \
-H "Content-Type: application/json" \
-d '{
- "pipe_code": "summarize",
- "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"],
+ "files": {
+ "summarize.mthds": "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"
+ },
"inputs": { "text": "Pipelex turns plain-language pipeline definitions into reproducible AI workflows that run as HTTP endpoints." }
}'
```
-You'll get back a JSON response with `state: "COMPLETED"` and the summary under `pipe_output.working_memory.root.<main_stuff_name>.content`.
+You'll get back a JSON response with `state: "COMPLETED"` and the summary under `pipe_output.working_memory.root.<main_stuff_name>.content`. The run starts at the method's `main_pipe`; to start at another pipe of the method, name it in `pipe_code`.
**Passing files (PDFs, images) as inputs.** Use the `Document` concept and point it at any HTTP(S) URL:
```json
{
"pipe_code": "your_pipe",
- "mthds_contents": ["...your MTHDS..."],
+ "files": { "your_method.mthds": "...your MTHDS..." },
"inputs": {
"cv": { "concept": "Document", "content": { "url": "https://example.com/resume.pdf" } }
}
@@ -97,7 +98,7 @@ You'll get back a JSON response with `state: "COMPLETED"` and the summary under
`Document` accepts public HTTP/HTTPS URLs, `pipelex-storage://` URIs, or base64 data URLs. For images, use the `Image` concept with the same `{ "url": "..." }` shape.
-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.
+**Sending the method.** `files` holds the whole method, as the MTHDS standard's method tree: each key is a file's path relative to the method's folder, such as `summarize.mthds` or `templates/invoice.docx`, and each value is that file's content. A text file, such as a `.mthds` bundle or a Python module, is sent as its UTF-8 text in a JSON string, and a file that is not text, such as an office template or an image, as `{"base64": "..."}`. This server also keeps a blob store, which `GET /v1/version` reports as `blob_store: true`, so a client can send a file as `{"sha256": "...", "size": n}` instead: it asks `POST /v1/blobs/missing` which of its files the server lacks, uploads each of those to the target the answer names, and then sends the method with a hash entry for each file, so a method that has not changed is not uploaded again. The older `mthds_contents` field, a JSON array of `.mthds` texts, is still accepted, but it is being retired together with `bundle_b64` and `resources`, and a later release refuses them, so new clients send `files`. See the [Pipe Run page](https://docs.pipelex.com/latest/api-server/pipe-run/) for every supported input shape, the rules of [a method sent as a tree](https://docs.pipelex.com/latest/api-server/pipe-run/#sending-a-method-as-a-tree) and of [sending files by hash](https://docs.pipelex.com/latest/api-server/pipe-run/#sending-files-by-hash), and the full `/execute` reference.
# 📈 How to scale Pipelex
diff --git a/api/pipelex_api/routes/pipelex/validate.py b/api/pipelex_api/routes/pipelex/validate.py
index dd3e93719..8bdce5fa1 100644
--- a/api/pipelex_api/routes/pipelex/validate.py
+++ b/api/pipelex_api/routes/pipelex/validate.py
@@ -79,7 +79,10 @@ def _resolve_validation_views(views: list[str]) -> set[ValidationView]:
class ValidateRequest(MthdsContentsRequest, CallerAnalyticsGroupsMixin):
- """The shared `mthds_contents` + `allow_signatures` payload, plus optional per-file sources.
+ """The method to validate, in `files`, by `method_ref` or as `mthds_contents`, plus `allow_signatures` and optional per-file sources.
+
+ `mthds_contents`, and the `mthds_sources` and `resources` that serve it, are being retired: a later release
+ refuses them, and a method is sent in `files`, whose bundles are named by their tree paths.
`mthds_sources`, when provided, pairs each `mthds_contents[i]` with a logical source (e.g. the
file's path relative to the submitted directory). The runner threads it onto
@@ -91,7 +94,8 @@ class ValidateRequest(MthdsContentsRequest, CallerAnalyticsGroupsMixin):
mthds_sources: list[str] | None = Field(
default=None,
description=(
- "Optional per-file sources, parallel to `mthds_contents`. When provided, each entry is threaded "
+ "Being retired with `mthds_contents`, and refused by a later release: the bundles of a method sent in `files` "
+ "are named by their tree paths. Optional per-file sources, parallel to `mthds_contents`. When provided, each entry is threaded "
"onto the corresponding bundle's `source` so server-side validation errors carry a `source` pointing "
"at the owning file. Must match `mthds_contents` in length when present."
),
@@ -366,7 +370,7 @@ async def validate_mthds(request: Request, request_data: ValidateRequest) -> JSO
- **Either arm:** a member with no value is absent rather than `null`, at the arm's top level and in its
problem items; the structured artifacts of the valid arm keep their own serialization.
- **No verdict (non-2xx):** a malformed request body, an `mthds_sources` length mismatch, or
- both/neither of `mthds_contents` / `method_ref` is a request-shape **422**, and so is a forbidden
+ more or fewer than one of `files` / `method_ref` / `mthds_contents` is a request-shape **422**, and so is a forbidden
`orchestration_mode` override; a host-wiring programmer error or a genuine orchestrator fault is a
**5xx**; auth is **401/403**. A `method_ref` **resolution failure** is also a no-verdict condition —
never an `is_valid: false`: each answers the status its code declares, such as a **422** for a
diff --git a/api/pipelex_api/schemas/models.py b/api/pipelex_api/schemas/models.py
index 65561e0e9..5fccf9f54 100644
--- a/api/pipelex_api/schemas/models.py
+++ b/api/pipelex_api/schemas/models.py
@@ -88,7 +88,7 @@ DEPENDENCIES_FIELD_DESCRIPTION = (
"by. They are searched before the runner's installed copies, for this request alone. Accompanies `files`."
)
-RESOURCES_FIELD_DESCRIPTION = (
+_RESOURCES_FIELD_FACTS = (
"The files submitted with the bundle that its steps read, such as a PipeDocGen step's `template_file` (an "
"`.xlsx`, `.docx`, `.pptx` or `.html` template): a JSON object mapping each file's bundle-relative path, exactly "
"as the step names it, to the file's bytes in standard base64. A path must be relative and written with forward "
@@ -102,6 +102,21 @@ RESOURCES_FIELD_DESCRIPTION = (
"names by its digest: no file's bytes travel with the run, each being read where a step uses it."
)
+RESOURCES_FIELD_DESCRIPTION = (
+ f"{_RESOURCES_FIELD_FACTS} Being retired with `mthds_contents`, and refused by a later release: send these files in "
+ "the method's tree, in `files`."
+)
+"""`resources` on the routes that also take `mthds_contents`, the run routes and `/validate`, with which it is retired."""
+
+TREE_ROUTE_RESOURCES_FIELD_DESCRIPTION = (
+ f"{_RESOURCES_FIELD_FACTS} Being retired, and refused by a later release: a file the steps read travels inside the "
+ "method's tree, in `files`, at its path beside the bundle that names it."
+)
+"""`resources` on the routes that take a method only as `files` or `method_ref`: `/resolve`, `/codegen` and `/pipe-io`."""
+
+MTHDS_CONTENTS_RETIRING_NOTE = "Being retired, and refused by a later release: send the method in `files`."
+"""Opens the description of every request field that takes a method's bundles as `mthds_contents`."""
+
class RunRequest(BaseModel):
"""Body of `POST /execute` — this server's typed request model.
@@ -124,7 +139,8 @@ class RunRequest(BaseModel):
Attributes:
pipe_code: Code of the pipe to execute.
- mthds_contents: List of MTHDS bundle contents to load.
+ mthds_contents: List of MTHDS bundle contents to load. Being retired, with `bundle_b64`
+ and `resources`, in favor of `files`.
inputs: Inputs in PipelineInputs format, as plain JSON — Pydantic validation is
skipped to preserve the flexible format (strings, lists, objects); the runtime
shapes each value against the entry pipe's declared input.
@@ -154,7 +170,14 @@ class RunRequest(BaseModel):
model_config = ConfigDict(extra="allow")
pipe_code: str | None = None
- mthds_contents: list[str] | None = None
+ mthds_contents: list[str] | None = Field(
+ default=None,
+ description=(
+ f"{MTHDS_CONTENTS_RETIRING_NOTE} The method's `.mthds` files as raw strings, always an array, even for a single "
+ "file; with no `pipe_code`, a file must declare `main_pipe`. Mutually exclusive with `files`, `bundle_b64` and "
+ "`method_ref`."
+ ),
+ )
inputs: Annotated[PipelineInputs | None, SkipValidation] = None
output_name: str | None = None
output_multiplicity: VariableMultiplicity | None = None
@@ -166,7 +189,8 @@ class RunRequest(BaseModel):
"map of its entries, so the archive's names are judged by the method tree's rule as the keys of `files` are. "
"The method packages it calls by address may travel with it under `.mthds/methods/<name>/`, each with its "
"`METHODS.toml`; they are searched before the runner's installed copies, for this run alone. "
- "Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment."
+ "Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment. Being retired "
+ "with `mthds_contents`, and refused by a later release: send the method in `files`."
),
)
# Documents the wire only: the map is read from the request's raw JSON text (`pipelex_api.method_tree_request`),
@@ -660,7 +684,7 @@ class MethodTreeRequest(BaseModel):
"until a method registry exists). Exactly one of `files` / `method_ref`."
),
)
- resources: dict[str, str] | None = Field(default=None, description=RESOURCES_FIELD_DESCRIPTION)
+ resources: dict[str, str] | None = Field(default=None, description=TREE_ROUTE_RESOURCES_FIELD_DESCRIPTION)
read_scope: str | None = Field(default=None, description=_TREE_READ_SCOPE_DESCRIPTION)
@field_validator("read_scope")
@@ -735,7 +759,10 @@ class MthdsContentsRequest(BaseModel):
default=None,
min_length=1,
max_length=MAX_MTHDS_FILES_PER_REQUEST,
- description="MTHDS contents to load (always an array, even for a single file). Exactly one of `mthds_contents` / `files` / `method_ref`.",
+ description=(
+ f"{MTHDS_CONTENTS_RETIRING_NOTE} MTHDS contents to load (always an array, even for a single file). "
+ "Exactly one of `mthds_contents` / `files` / `method_ref`."
+ ),
)
# Documents the wire only: the route reads the map from the request's raw JSON text, never from this field.
files: Annotated[dict[str, FileEntry] | None, SkipValidation] = Field(
diff --git a/docs/api-server/codegen.md b/docs/api-server/codegen.md
index b05d86742..364f08041 100644
--- a/docs/api-server/codegen.md
+++ b/docs/api-server/codegen.md
@@ -16,7 +16,7 @@ Both endpoints take the method the way [`POST /v1/validate`](pipe-validate.md#va
Providing neither or both is a request-shape `422`. Beside `files`, the request may also carry:
- `dependencies` (object): the method packages the method calls by address, each a map of file entries keyed by its address, as on a [run](pipe-run.md#sending-the-method-packages-the-method-calls). They are loaded beside the method, never merged into it, so a cross-package call resolves without the server fetching or holding a copy. `dependencies` without `files` is a request-shape `422`.
-- `resources` (object): files the method's steps read, such as a `PipeDocGen` step's `template_file`, keyed by the path from the tree's root, each in standard base64, joining the tree with the rules and refusals of [`/v1/validate`](pipe-validate.md#sending-the-files-the-steps-read-resources). A step that names a template file the tree does not hold cannot be built, so the method is invalid. `resources` beside a `method_ref` is a request-shape `422`: a published method's files are its package's own.
+- `resources` (object): **Being retired, and refused by a later release: a file the steps read travels inside the method's tree, in `files`, at its path beside the bundle that names it.** Files the method's steps read, such as a `PipeDocGen` step's `template_file`, keyed by the path from the tree's root, each in standard base64, joining the tree with the rules and refusals of [`/v1/validate`](pipe-validate.md#sending-the-files-the-steps-read-resources). A step that names a template file the tree does not hold cannot be built, so the method is invalid. `resources` beside a `method_ref` is a request-shape `422`: a published method's files are its package's own.
- `read_scope` (string): **Pipelex-API extension.** The scope the request reads the method under, as on `/v1/validate`: a hash entry of `files` resolves in that scope's blob store, else in the caller's own id's, and only a request carrying a `read_scope` records the tree it read in the blob store; [a `jwt` caller may send only a scope under its own id](pipe-run.md#host-supplied-run-context-storage_scope-and-analytics_groups), else a `403` `auth.forbidden` whose `requirement` is `read_scope_under_caller`.
**The tree's refusals produce no verdict**, exactly as on `/v1/validate`: a key the tree's rule refuses is a `422` `method.package_invalid` naming the rule as its `reason`, or `security.input_path_refused` for a key leaving the tree's root, a malformed entry a `422` `request.invalid`, a hash the runner does not hold a `422` `request.blobs_missing`, a tree past its limits a `422` `method.package_invalid` naming the limit, and a tree holding no `.mthds` bundle of its own a `422` `method.package_invalid` whose `reason` is `no_bundle`. A `files` member that is not a map, such as a list, is a `422` `request.invalid` naming `files`.
diff --git a/docs/api-server/error-responses.md b/docs/api-server/error-responses.md
index d773cce68..a52aeab8a 100644
--- a/docs/api-server/error-responses.md
+++ b/docs/api-server/error-responses.md
@@ -116,7 +116,7 @@ Each item is one fault:
| `code` | The registry code of the fault: the code its type maps to, such as `method.input_undeclared` for an input a pipe reads but does not declare, `model.unknown` for a model the deck does not define, `method.syntax` for a TOML syntax error or `method.dependency_missing` for a package the method calls and no one supplied. A `dry_run` item's code is its failure's own, and an item no stage classified takes `method.schema_violation`, or the code of the refusal behind it. |
| `detail` | The code's sentence, rendered from the item's parameters, or the code's title when the item lacks a parameter the sentence names. A program branches on `code`, never on a sentence. |
| `params` | Every parameter the item's code requires, by the registry's names: the facts its locators give, such as the `pipe`, the `variables` it reads, the `concept` or `model` it names, the `model_type` and a `finding` quoting the validation's own account, and those the check that found the fault knows, such as the concept a pipe declares and those that would fit, the `name` and the kind of `conflict` of a name declared twice, or the declared concepts nearest one that resolves to nothing. |
-| `location` | Where the fault is: the `pipe`, the `field` within the bundle, and the `file` with its 1-based `line` and `column` when the parser stopped there. A name two bundles declare is one item per bundle, each located on its own `file`. On the in-memory submit path the `file` is the matching `mthds_sources[i]` (see [Sourcing submitted files](pipe-validate.md)), so it is absent when the caller sent no sources. Beside a server's own library directories, an item never names one of their files, nor a template file one of their `PipeDocGen` steps names. |
+| `location` | Where the fault is: the `pipe`, the `field` within the bundle, and the `file` with its 1-based `line` and `column` when the parser stopped there. A name two bundles declare is one item per bundle, each located on its own `file`. For a method sent in `files` or fetched by `method_ref`, the `file` is the bundle's tree path. On the `mthds_contents` path, which is being retired, the `file` is the matching `mthds_sources[i]` (see [Sourcing submitted files](pipe-validate.md#sourcing-submitted-files)), so it is absent when the caller sent no sources. Beside a server's own library directories, an item never names one of their files, nor a template file one of their `PipeDocGen` steps names. |
| `suggestions` | On a `model.unknown` item, the deck's close matches of the kind the pipe needs. |
| `suggested_fix` | A structured, deterministic fix for this fault — present only when the fix planner derived one. See [Suggested fixes](#suggested-fixes). |
@@ -294,8 +294,9 @@ When opening an issue, include the `request_id` from the response (or response h
```http
POST /v1/execute
{
- "mthds_contents": ["domain = \"summaries\"\nmain_pipe = \"summarize\"\n\n[pipe.summarize]\ntype = \"PipeLLM\"\ndescription = \"Summarize a text\"\ninputs = { text = \"Text\" }\noutput = \"Text\"\nprompt = \"Summarize $text in the style of $tone.\"\n"],
- "mthds_sources": ["summaries.mthds"]
+ "files": {
+ "summaries.mthds": "domain = \"summaries\"\nmain_pipe = \"summarize\"\n\n[pipe.summarize]\ntype = \"PipeLLM\"\ndescription = \"Summarize a text\"\ninputs = { text = \"Text\" }\noutput = \"Text\"\nprompt = \"Summarize $text in the style of $tone.\"\n"
+ }
}
```
diff --git a/docs/api-server/index.md b/docs/api-server/index.md
index a5972295f..9c395bcc2 100644
--- a/docs/api-server/index.md
+++ b/docs/api-server/index.md
@@ -64,19 +64,27 @@ curl http://localhost:8081/health
### 3. Run your first pipeline
-Send an inline MTHDS bundle and inputs to `/v1/execute`:
+Send a method and its inputs to `/v1/execute`. The method travels in `files`, a map from each file's path in the method's folder to that file's content; here the method is a single `.mthds` file:
```bash
curl -s http://localhost:8081/v1/execute \
-H "Content-Type: application/json" \
-d '{
- "pipe_code": "summarize",
- "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"],
+ "files": {
+ "summarize.mthds": "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"
+ },
"inputs": { "text": "Pipelex turns plain-language pipeline definitions into reproducible AI workflows that run as HTTP endpoints." }
}'
```
-The response contains `state: "COMPLETED"` and the result under `pipe_output.working_memory.root.<main_stuff_name>.content`. See **[Pipe Run →](pipe-run.md)** for every input shape (text, structured objects, `Document`, `Image`, …) and the full `/execute` and `/start` reference.
+The response contains `state: "COMPLETED"` and the result under `pipe_output.working_memory.root.<main_stuff_name>.content`. The run starts at the method's `main_pipe`, and `pipe_code` names another pipe of the method to start at.
+
+`files` carries the whole method, not only its bundles: a `PipeDocGen` step's template, a `PipeFunc`'s Python module or a `METHODS.toml` travels beside the `.mthds` files, each at its path in the method's folder. A text file is sent as its text, a file that is not text as `{"base64": "..."}`, and, since this server keeps a blob store (`blob_store: true` on `GET /v1/version`), any file the server already holds can be sent as `{"sha256": "...", "size": n}`: `POST /v1/blobs/missing` names the files it lacks and where to upload each, so a method that has not changed is not uploaded again. See [Sending a method as a tree](pipe-run.md#sending-a-method-as-a-tree) and [Sending files by hash](pipe-run.md#sending-files-by-hash).
+
+!!! note "`mthds_contents` is being retired"
+ Earlier examples sent the method as `mthds_contents`, a JSON array of `.mthds` texts. The server still accepts it, with `bundle_b64` and `resources`, but a later release refuses all three, so send the method in `files`.
+
+See **[Pipe Run →](pipe-run.md)** for every input shape (text, structured objects, `Document`, `Image`, …) and the full `/execute` and `/start` reference.
### 4. Customize the configuration
diff --git a/docs/api-server/openapi/pipelex-api.openapi.yaml b/docs/api-server/openapi/pipelex-api.openapi.yaml
index 4092a7565..6e77cf4b7 100644
--- a/docs/api-server/openapi/pipelex-api.openapi.yaml
+++ b/docs/api-server/openapi/pipelex-api.openapi.yaml
@@ -259,6 +259,9 @@ paths:
type: array
- type: 'null'
title: Mthds Contents
+ description: 'Being retired, and refused by a later release: send the method in `files`. The method''s `.mthds`
+ files as raw strings, always an array, even for a single file; with no `pipe_code`, a file must declare
+ `main_pipe`. Mutually exclusive with `files`, `bundle_b64` and `method_ref`.'
inputs:
anyOf:
- additionalProperties:
@@ -297,11 +300,12 @@ paths:
- type: string
- type: 'null'
title: Bundle B64
- description: PIPELEX-API EXTENSION (not part of the MTHDS Protocol) — base64-encoded zip of the method's
- folder, read as a map of its entries, so the archive's names are judged by the method tree's rule as the
- keys of `files` are. The method packages it calls by address may travel with it under `.mthds/methods/<name>/`,
- each with its `METHODS.toml`; they are searched before the runner's installed copies, for this run alone.
- Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment.
+ description: 'PIPELEX-API EXTENSION (not part of the MTHDS Protocol) — base64-encoded zip of the method''s
+ folder, read as a map of its entries, so the archive''s names are judged by the method tree''s rule as
+ the keys of `files` are. The method packages it calls by address may travel with it under `.mthds/methods/<name>/`,
+ each with its `METHODS.toml`; they are searched before the runner''s installed copies, for this run alone.
+ Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment. Being retired
+ with `mthds_contents`, and refused by a later release: send the method in `files`.'
files:
anyOf:
- additionalProperties:
@@ -374,7 +378,8 @@ paths:
the same bytes. By default at most 32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment
sets its own with `MAX_RESOURCES_PER_REQUEST`, `MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`.
The files make one method tree with the bundles, which the run names by its digest: no file''s bytes travel
- with the run, each being read where a step uses it.'
+ with the run, each being read where a step uses it. Being retired with `mthds_contents`, and refused by
+ a later release: send these files in the method''s tree, in `files`.'
orchestration_mode:
anyOf:
- type: string
@@ -610,6 +615,9 @@ paths:
type: array
- type: 'null'
title: Mthds Contents
+ description: 'Being retired, and refused by a later release: send the method in `files`. The method''s `.mthds`
+ files as raw strings, always an array, even for a single file; with no `pipe_code`, a file must declare
+ `main_pipe`. Mutually exclusive with `files`, `bundle_b64` and `method_ref`.'
inputs:
anyOf:
- additionalProperties:
@@ -648,11 +656,12 @@ paths:
- type: string
- type: 'null'
title: Bundle B64
- description: PIPELEX-API EXTENSION (not part of the MTHDS Protocol) — base64-encoded zip of the method's
- folder, read as a map of its entries, so the archive's names are judged by the method tree's rule as the
- keys of `files` are. The method packages it calls by address may travel with it under `.mthds/methods/<name>/`,
- each with its `METHODS.toml`; they are searched before the runner's installed copies, for this run alone.
- Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment.
+ description: 'PIPELEX-API EXTENSION (not part of the MTHDS Protocol) — base64-encoded zip of the method''s
+ folder, read as a map of its entries, so the archive''s names are judged by the method tree''s rule as
+ the keys of `files` are. The method packages it calls by address may travel with it under `.mthds/methods/<name>/`,
+ each with its `METHODS.toml`; they are searched before the runner''s installed copies, for this run alone.
+ Mutually exclusive with `files`. Custom `.py` is only honored on a sandbox-hosted deployment. Being retired
+ with `mthds_contents`, and refused by a later release: send the method in `files`.'
files:
anyOf:
- additionalProperties:
@@ -725,7 +734,8 @@ paths:
the same bytes. By default at most 32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment
sets its own with `MAX_RESOURCES_PER_REQUEST`, `MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`.
The files make one method tree with the bundles, which the run names by its digest: no file''s bytes travel
- with the run, each being read where a step uses it.'
+ with the run, each being read where a step uses it. Being retired with `mthds_contents`, and refused by
+ a later release: send these files in the method''s tree, in `files`.'
pipeline_run_id:
anyOf:
- type: string
@@ -915,14 +925,14 @@ paths:
\ diagnostics is a backend, configuration or runtime\n fault, and its problem is answered as every raised failure's\
\ is.\n- **Either arm:** a member with no value is absent rather than `null`, at the arm's top level and in its\n\
\ problem items; the structured artifacts of the valid arm keep their own serialization.\n- **No verdict (non-2xx):**\
- \ a malformed request body, an `mthds_sources` length mismatch, or\n both/neither of `mthds_contents` / `method_ref`\
- \ is a request-shape **422**, and so is a forbidden\n `orchestration_mode` override; a host-wiring programmer error\
- \ or a genuine orchestrator fault is a\n **5xx**; auth is **401/403**. A `method_ref` **resolution failure** is also\
- \ a no-verdict condition —\n never an `is_valid: false`: each answers the status its code declares, such as a **422**\
- \ for a\n malformed reference, a **502** for a failed fetch, a **404** for no matching package in the\n repository\
- \ and a **422** for the method's Python structure classes, and the custom-code sandbox gate\n a **501**. All are\
- \ `application/problem+json` documents carrying a registry `code`, rendered by the\n global handlers in `pipelex_api.exception_handlers`\
- \ — routes never shape them."
+ \ a malformed request body, an `mthds_sources` length mismatch, or\n more or fewer than one of `files` / `method_ref`\
+ \ / `mthds_contents` is a request-shape **422**, and so is a forbidden\n `orchestration_mode` override; a host-wiring\
+ \ programmer error or a genuine orchestrator fault is a\n **5xx**; auth is **401/403**. A `method_ref` **resolution\
+ \ failure** is also a no-verdict condition —\n never an `is_valid: false`: each answers the status its code declares,\
+ \ such as a **422** for a\n malformed reference, a **502** for a failed fetch, a **404** for no matching package\
+ \ in the\n repository and a **422** for the method's Python structure classes, and the custom-code sandbox gate\n\
+ \ a **501**. All are `application/problem+json` documents carrying a registry `code`, rendered by the\n global handlers\
+ \ in `pipelex_api.exception_handlers` — routes never shape them."
operationId: validate_mthds_v1_validate_post
requestBody:
content:
@@ -2170,7 +2180,9 @@ components:
its path from the tree''s root, where a file the tree already holds must have the same bytes. By default at most
32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment sets its own with `MAX_RESOURCES_PER_REQUEST`,
`MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`. The files make one method tree with the bundles, which
- the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it.'
+ the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it. Being
+ retired, and refused by a later release: a file the steps read travels inside the method''s tree, in `files`,
+ at its path beside the bundle that names it.'
read_scope:
anyOf:
- type: string
@@ -4296,7 +4308,9 @@ components:
its path from the tree''s root, where a file the tree already holds must have the same bytes. By default at most
32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment sets its own with `MAX_RESOURCES_PER_REQUEST`,
`MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`. The files make one method tree with the bundles, which
- the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it.'
+ the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it. Being
+ retired, and refused by a later release: a file the steps read travels inside the method''s tree, in `files`,
+ at its path beside the bundle that names it.'
read_scope:
anyOf:
- type: string
@@ -5901,7 +5915,9 @@ components:
its path from the tree''s root, where a file the tree already holds must have the same bytes. By default at most
32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment sets its own with `MAX_RESOURCES_PER_REQUEST`,
`MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`. The files make one method tree with the bundles, which
- the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it.'
+ the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it. Being
+ retired, and refused by a later release: a file the steps read travels inside the method''s tree, in `files`,
+ at its path beside the bundle that names it.'
read_scope:
anyOf:
- type: string
@@ -8962,8 +8978,8 @@ components:
minItems: 1
- type: 'null'
title: Mthds Contents
- description: MTHDS contents to load (always an array, even for a single file). Exactly one of `mthds_contents` /
- `files` / `method_ref`.
+ description: 'Being retired, and refused by a later release: send the method in `files`. MTHDS contents to load
+ (always an array, even for a single file). Exactly one of `mthds_contents` / `files` / `method_ref`.'
files:
anyOf:
- additionalProperties:
@@ -9029,9 +9045,10 @@ components:
type: array
- type: 'null'
title: Mthds Sources
- description: Optional per-file sources, parallel to `mthds_contents`. When provided, each entry is threaded onto
- the corresponding bundle's `source` so server-side validation errors carry a `source` pointing at the owning file.
- Must match `mthds_contents` in length when present.
+ description: 'Being retired with `mthds_contents`, and refused by a later release: the bundles of a method sent
+ in `files` are named by their tree paths. Optional per-file sources, parallel to `mthds_contents`. When provided,
+ each entry is threaded onto the corresponding bundle''s `source` so server-side validation errors carry a `source`
+ pointing at the owning file. Must match `mthds_contents` in length when present.'
resources:
anyOf:
- additionalProperties:
@@ -9048,7 +9065,8 @@ components:
its path from the tree''s root, where a file the tree already holds must have the same bytes. By default at most
32 files, 5120 KiB each and 10240 KiB in all, decoded; a deployment sets its own with `MAX_RESOURCES_PER_REQUEST`,
`MAX_RESOURCE_FILE_KIB` and `MAX_RESOURCES_TOTAL_KIB`. The files make one method tree with the bundles, which
- the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it.'
+ the run names by its digest: no file''s bytes travel with the run, each being read where a step uses it. Being
+ retired with `mthds_contents`, and refused by a later release: send these files in the method''s tree, in `files`.'
render:
items:
type: string
@@ -9092,7 +9110,13 @@ components:
is handed no scope, so a dry run without one leaves nothing stored.'
type: object
title: ValidateRequest
- description: 'The shared `mthds_contents` + `allow_signatures` payload, plus optional per-file sources.
+ description: 'The method to validate, in `files`, by `method_ref` or as `mthds_contents`, plus `allow_signatures` and
+ optional per-file sources.
+
+
+ `mthds_contents`, and the `mthds_sources` and `resources` that serve it, are being retired: a later release
+
+ refuses them, and a method is sent in `files`, whose bundles are named by their tree paths.
`mthds_sources`, when provided, pairs each `mthds_contents[i]` with a logical source (e.g. the
diff --git a/docs/api-server/pipe-io.md b/docs/api-server/pipe-io.md
index 345094dd1..9ff1bd750 100644
--- a/docs/api-server/pipe-io.md
+++ b/docs/api-server/pipe-io.md
@@ -19,7 +19,7 @@ The body names the method as the [crate routes](codegen.md#selecting-the-method)
- `pipe_ref` (string, optional): the qualified ref `domain.pipe_code` of the pipe to describe. Omitted, the selection chain below decides.
- `all_pipes` (boolean, default `false`): describe every pipe the closure loads instead of the selected one.
- `include_files` (boolean, default `false`): echo the text of the method's own `.mthds` bundles on the valid arm.
-- `resources` (object, optional): files the method's steps read, such as a `PipeDocGen` step's `template_file`, keyed by the path from the tree's root, each in standard base64, joining the tree as on [`/v1/validate`](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `files` only. A step whose template file the tree does not hold makes the method invalid.
+- `resources` (object, optional): **Being retired, and refused by a later release: a file the steps read travels inside the method's tree, in `files`, at its path beside the bundle that names it.** Files the method's steps read, such as a `PipeDocGen` step's `template_file`, keyed by the path from the tree's root, each in standard base64, joining the tree as on [`/v1/validate`](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `files` only. A step whose template file the tree does not hold makes the method invalid.
- `read_scope` (string, optional): **Pipelex-API extension.** The scope the request reads the method under, as on `/v1/validate`: a hash entry of `files` resolves in that scope's blob store, and only a request carrying it records the tree it read there; [a `jwt` caller may send only a scope under its own id](pipe-run.md#host-supplied-run-context-storage_scope-and-analytics_groups), else a `403` `auth.forbidden` whose `requirement` is `read_scope_under_caller`.
There is no `views` field, because the valid arm always carries all three artifacts. The hosted API also accepts a catalog `method_id`, which the platform resolves into the method's `files` before forwarding, so this server never declares it.
diff --git a/docs/api-server/pipe-run.md b/docs/api-server/pipe-run.md
index d1e228510..199fecad1 100644
--- a/docs/api-server/pipe-run.md
+++ b/docs/api-server/pipe-run.md
@@ -2,7 +2,9 @@
Execute pipelines with flexible input formats. Choose between synchronous execution (wait for completion) or asynchronous execution (non-blocking). Both routes are part of the [MTHDS Protocol](https://mthds.ai) — this server is the protocol's reference implementation.
-> **About `mthds_contents` and MTHDS.** An "MTHDS file" is a Pipelex pipeline definition written in TOML (with the `.mthds` extension). The `mthds_contents` field on every endpoint below is a JSON array of those file contents as raw strings — typically `[open("my_pipe.mthds").read()]` from a client. You can either pass a `pipe_code` referring to a pipe already registered on the server, pass `mthds_contents` inline (the array must contain a file with a `main_pipe` property), or both.
+> **About `files` and MTHDS.** An "MTHDS file" is a Pipelex pipeline definition written in TOML (with the `.mthds` extension), and a method is the folder holding its `.mthds` files with the other files its steps read. Both endpoints below take the method in `files`, a map from each file's path in the method's folder to that file's content, such as `{"summarize.mthds": "domain = \"hello\"\n…"}` — see [Sending a method as a tree](#sending-a-method-as-a-tree). With no `pipe_code`, the run starts at the method's entry pipe, its `main_pipe`; `pipe_code` names another pipe of the method to start at, or, sent alone, a pipe already registered on the server. A published method is run by its address instead, in `method_ref`.
+>
+> **`mthds_contents` is being retired.** The older field, a JSON array of `.mthds` texts that must include a file declaring `main_pipe` when no `pipe_code` is sent, is still accepted, together with `bundle_b64` and `resources`, but a later release refuses all three. Send the method in `files`.
### Execute Pipeline
@@ -16,8 +18,10 @@ Execute a Pipelex pipeline with flexible inputs and wait for completion.
```json
{
- "pipe_code": "your_pipeline_code",
- "mthds_contents": null,
+ "pipe_code": null,
+ "files": {
+ "my_method.mthds": "domain = \"my_domain\"\nmain_pipe = \"my_pipe\"\n…"
+ },
"inputs": {
"input_name": "simple text or object"
},
@@ -29,27 +33,28 @@ Execute a Pipelex pipeline with flexible inputs and wait for completion.
**Request Fields:**
-- `pipe_code` (string, optional): The code identifying the pipeline to execute. Required if no `mthds_contents` is provided, or if `mthds_contents` doesn't have a `main_pipe` property. Can be combined with `mthds_contents` to specify which pipe to execute from the provided MTHDS definition.
-- `mthds_contents` (list[str], optional): Inline MTHDS file contents as raw strings (always an array, even for a single file). If provided without `pipe_code`, the bundle must contain a file with a `main_pipe` property.
+- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree: each key a tree path, each value the file's text, `{"base64": "…"}`, or `{"sha256": "…", "size": n}` naming bytes this runner holds — see [Sending a method as a tree](#sending-a-method-as-a-tree). Mutually exclusive with `mthds_contents`, `bundle_b64` and `method_ref`.
+- `pipe_code` (string, optional): The code identifying the pipe to execute. Beside a method sent in `files`, it names the pipe to start at in place of the method's entry pipe; beside `method_ref`, it overrides the package's `main_pipe`; sent alone, it must name a pipe already registered on the server.
- `inputs` (PipelineInputs, optional): Flexible input format - see [Input Format: PipelineInputs](#input-format-pipelineinputs) below
- `output_name` (string, optional): Name for the output slot
- `output_multiplicity` (string, optional): Output multiplicity setting (`"single"`, `"variable"`, or a specific number)
- `dynamic_output_concept_ref` (string, optional): Override output concept ref
-- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree: each key a tree path, each value the file's text, `{"base64": "…"}`, or `{"sha256": "…", "size": n}` naming bytes this runner holds — see [Sending a method as a tree](#sending-a-method-as-a-tree). Mutually exclusive with `mthds_contents`, `bundle_b64` and `method_ref`.
- `dependencies` (object, optional): **Pipelex-API extension.** The method packages the method calls by address that the runner cannot fetch, each a map of file entries keyed by its address — see [Sending the method packages the method calls](#sending-the-method-packages-the-method-calls). Accompanies `files`.
-- `bundle_b64` (string, optional): **Pipelex-API extension.** Base64-encoded zip of the method's folder, read as a map of its entries, which may carry the method packages it calls under `.mthds/methods/<name>/`. Mutually exclusive with `files`.
- `method_ref` (string, optional): **Pipelex-API extension.** Run a published method by address instead of inline source — see [Running a method by address](#running-a-method-by-address-method_ref). Mutually exclusive with `mthds_contents` and with a method sent as a tree; `pipe_code` may accompany it to override the package's `main_pipe`.
-- `resources` (dict[str, str], optional): **Pipelex-API extension.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or a method sent as a tree, whose tree each file joins at its path from the root; beside `method_ref`, or with no bundle at all, it is a 422. The job names the method's tree by its digest and carries none of its files: the step that reads one, on an orchestrator that runs the job remotely such as Temporal included, reads it through the deployment's method file store.
+- `mthds_contents` (list[str], optional): **Being retired: send the method in `files`.** Inline MTHDS file contents as raw strings (always an array, even for a single file). If provided without `pipe_code`, the bundle must contain a file with a `main_pipe` property. Still accepted until a later release refuses it.
+- `bundle_b64` (string, optional): **Pipelex-API extension, being retired with `mthds_contents`: send the method in `files`.** Base64-encoded zip of the method's folder, read as a map of its entries, which may carry the method packages it calls under `.mthds/methods/<name>/`. Mutually exclusive with `files`.
+- `resources` (dict[str, str], optional): **Pipelex-API extension, being retired with `mthds_contents`: put the files in the method's tree, in `files`.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or a method sent as a tree, whose tree each file joins at its path from the root; beside `method_ref`, or with no bundle at all, it is a 422. The job names the method's tree by its digest and carries none of its files: the step that reads one, on an orchestrator that runs the job remotely such as Temporal included, reads it through the deployment's method file store.
- `storage_scope` (string, optional): **Pipelex-API extension.** The prefix every object this run writes lands under — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
- `read_scope` (string, optional): **Pipelex-API extension.** The prefix every stored object this run reads must lie under — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
- `analytics_groups` (dict[str, str], optional): **Pipelex-API extension.** The groups this run's telemetry belongs to, such as `{"organization": "org_acme"}` — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
**Validation Rules:**
-- At least one of `pipe_code`, `mthds_contents`, a method bundle, or `method_ref` must be provided
+- At least one of `files`, `method_ref`, `pipe_code` or a method sent the older way (`mthds_contents` or `bundle_b64`) must be provided
- If only `pipe_code`: Must reference a pipe already registered in the library
-- If only `mthds_contents`: Must contain a `main_pipe` property
-- If both: `pipe_code` specifies which pipe to execute from the `mthds_contents`
+- With `files` and no `pipe_code`: the run starts at the method's entry pipe, the `main_pipe` of its root `METHODS.toml` or else the one `main_pipe` its bundles declare (see [Sending a method as a tree](#sending-a-method-as-a-tree))
+- With `mthds_contents` and no `pipe_code`: a file must declare `main_pipe`
+- With `pipe_code` beside a method: `pipe_code` specifies which pipe of that method to execute
**Response:**
@@ -100,8 +105,10 @@ Start a pipeline execution and get its `pipeline_run_id` back with a `202` ack.
```json
{
- "pipe_code": "your_pipeline_code",
- "mthds_contents": null,
+ "pipe_code": null,
+ "files": {
+ "my_method.mthds": "domain = \"my_domain\"\nmain_pipe = \"my_pipe\"\n…"
+ },
"inputs": {
"input_name": "simple text or object"
},
@@ -113,27 +120,28 @@ Start a pipeline execution and get its `pipeline_run_id` back with a `202` ack.
**Request Fields:**
-- `pipe_code` (string, optional): The code identifying the pipeline to execute. Required if no `mthds_contents` is provided, or if `mthds_contents` doesn't have a `main_pipe` property.
-- `mthds_contents` (list[str], optional): Inline pipeline definitions (always an array, even for a single file). If provided without `pipe_code`, must have a `main_pipe` property.
+- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree: each key a tree path, each value the file's text, `{"base64": "…"}`, or `{"sha256": "…", "size": n}` naming bytes this runner holds — see [Sending a method as a tree](#sending-a-method-as-a-tree). Mutually exclusive with `mthds_contents`, `bundle_b64` and `method_ref`.
+- `pipe_code` (string, optional): The code identifying the pipe to execute. Beside a method sent in `files`, it names the pipe to start at in place of the method's entry pipe; beside `method_ref`, it overrides the package's `main_pipe`; sent alone, it must name a pipe already registered on the server.
- `inputs` (PipelineInputs, optional): Flexible input format - see [Input Format: PipelineInputs](#input-format-pipelineinputs) below
- `output_name` (string, optional): Name for the output slot
- `output_multiplicity` (string, optional): Output multiplicity setting (`"single"`, `"variable"`, or a specific number)
- `dynamic_output_concept_ref` (string, optional): Override output concept ref
-- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree: each key a tree path, each value the file's text, `{"base64": "…"}`, or `{"sha256": "…", "size": n}` naming bytes this runner holds — see [Sending a method as a tree](#sending-a-method-as-a-tree). Mutually exclusive with `mthds_contents`, `bundle_b64` and `method_ref`.
- `dependencies` (object, optional): **Pipelex-API extension.** The method packages the method calls by address that the runner cannot fetch, each a map of file entries keyed by its address — see [Sending the method packages the method calls](#sending-the-method-packages-the-method-calls). Accompanies `files`.
-- `bundle_b64` (string, optional): **Pipelex-API extension.** Base64-encoded zip of the method's folder, read as a map of its entries, which may carry the method packages it calls under `.mthds/methods/<name>/`. Mutually exclusive with `files`.
- `method_ref` (string, optional): **Pipelex-API extension.** Run a published method by address instead of inline source — see [Running a method by address](#running-a-method-by-address-method_ref). Mutually exclusive with `mthds_contents` and with a method sent as a tree; `pipe_code` may accompany it to override the package's `main_pipe`.
-- `resources` (dict[str, str], optional): **Pipelex-API extension.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or a method sent as a tree, whose tree each file joins at its path from the root; beside `method_ref`, or with no bundle at all, it is a 422. The job names the method's tree by its digest and carries none of its files: the step that reads one, on an orchestrator that runs the job remotely such as Temporal included, reads it through the deployment's method file store.
+- `mthds_contents` (list[str], optional): **Being retired: send the method in `files`.** Inline pipeline definitions (always an array, even for a single file). If provided without `pipe_code`, must have a `main_pipe` property. Still accepted until a later release refuses it.
+- `bundle_b64` (string, optional): **Pipelex-API extension, being retired with `mthds_contents`: send the method in `files`.** Base64-encoded zip of the method's folder, read as a map of its entries, which may carry the method packages it calls under `.mthds/methods/<name>/`. Mutually exclusive with `files`.
+- `resources` (dict[str, str], optional): **Pipelex-API extension, being retired with `mthds_contents`: put the files in the method's tree, in `files`.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](pipe-validate.md#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or a method sent as a tree, whose tree each file joins at its path from the root; beside `method_ref`, or with no bundle at all, it is a 422. The job names the method's tree by its digest and carries none of its files: the step that reads one, on an orchestrator that runs the job remotely such as Temporal included, reads it through the deployment's method file store.
- `storage_scope` (string, optional): **Pipelex-API extension.** The prefix every object this run writes lands under — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
- `read_scope` (string, optional): **Pipelex-API extension.** The prefix every stored object this run reads must lie under — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
- `analytics_groups` (dict[str, str], optional): **Pipelex-API extension.** The groups this run's telemetry belongs to, such as `{"organization": "org_acme"}` — see [Host-supplied run context](#host-supplied-run-context-storage_scope-and-analytics_groups).
**Validation Rules:**
-- At least one of `pipe_code`, `mthds_contents`, a method bundle, or `method_ref` must be provided
+- At least one of `files`, `method_ref`, `pipe_code` or a method sent the older way (`mthds_contents` or `bundle_b64`) must be provided
- If only `pipe_code`: Must reference a pipe already registered in the library
-- If only `mthds_contents`: Must contain a `main_pipe` property
-- If both: `pipe_code` specifies which pipe to execute from the `mthds_contents`
+- With `files` and no `pipe_code`: the run starts at the method's entry pipe, the `main_pipe` of its root `METHODS.toml` or else the one `main_pipe` its bundles declare (see [Sending a method as a tree](#sending-a-method-as-a-tree))
+- With `mthds_contents` and no `pipe_code`: a file must declare `main_pipe`
+- With `pipe_code` beside a method: `pipe_code` specifies which pipe of that method to execute
**Important Notes:**
@@ -219,10 +227,12 @@ The receiver-side secret must be the same value. In typical deployments both sid
## Sending a method as a tree
-`mthds_contents` carries only `.mthds` text. A method is more than its bundles: a custom `PipeFunc`'s Python, a `PipeDocGen` step's template, a `requirements.txt`, a `METHODS.toml`. Both `/execute` and `/start`, and [`/validate`](pipe-validate.md), take the whole method as a **method tree**, the MTHDS standard's unit of a method, in one of two mutually exclusive forms:
+A method is more than its bundles: a custom `PipeFunc`'s Python, a `PipeDocGen` step's template, a `requirements.txt`, a `METHODS.toml`. Both `/execute` and `/start`, and [`/validate`](pipe-validate.md), take the whole method as a **method tree**, the MTHDS standard's unit of a method, in one of two mutually exclusive forms:
+
+- `files`: a **map of file entries**, the standard's form, and the way to send a method. Each key is the file's tree path, its path relative to the method's folder, and each value one of three entries: the file's text as a JSON string, `{"base64": "…"}` for bytes that are not text, or `{"sha256": "…", "size": n}` naming bytes this runner already holds in its [blob store](#sending-files-by-hash). One request may mix all three.
+- `bundle_b64`: a base64-encoded **zip** of the method's folder, a Pipelex-API extension, read as a map of its entries. It is being retired with `mthds_contents`.
-- `files`: a **map of file entries**, the standard's form. Each key is the file's tree path, and each value one of three entries: the file's text as a JSON string, `{"base64": "…"}` for bytes that are not text, or `{"sha256": "…", "size": n}` naming bytes this runner already holds in its [blob store](#sending-files-by-hash). One request may mix all three.
-- `bundle_b64`: a base64-encoded **zip** of the method's folder, a Pipelex-API extension, read as a map of its entries.
+The older `mthds_contents`, which carries only `.mthds` text, and `resources`, which carries the files its steps read beside it, are being retired too: a later release refuses `mthds_contents`, `bundle_b64` and `resources`, and a method sent in `files` needs none of them.
```json
{
diff --git a/docs/api-server/pipe-validate.md b/docs/api-server/pipe-validate.md
index 3a314c4ce..e336c3349 100644
--- a/docs/api-server/pipe-validate.md
+++ b/docs/api-server/pipe-validate.md
@@ -1,6 +1,6 @@
# Pipe Validate
-Validate MTHDS content by parsing, loading, and dry-running pipes without executing them.
+Validate a method by parsing, loading, and dry-running its pipes without executing them.
**Endpoint:** `POST /v1/validate`
@@ -10,20 +10,24 @@ Validate MTHDS content by parsing, loading, and dry-running pipes without execut
```json
{
- "mthds_contents": ["domain = \"my_domain\"\ndescription = \"My domain\"\nmain_pipe = \"my_pipe\"\n\n[concept.MyResult]\ndescription = \"A result\"\n\n[pipe.my_pipe]\ntype = \"PipeLLM\"\ndescription = \"Process input\"\ninputs = { text = \"native.Text\" }\noutput = \"MyResult\""]
+ "files": {
+ "my_domain.mthds": "domain = \"my_domain\"\ndescription = \"My domain\"\nmain_pipe = \"my_pipe\"\n\n[concept.MyResult]\ndescription = \"A result\"\n\n[pipe.my_pipe]\ntype = \"PipeLLM\"\ndescription = \"Process input\"\ninputs = { text = \"native.Text\" }\noutput = \"MyResult\""
+ }
}
```
+The method to validate is sent in `files`, a map from each file's path in the method's folder to that file's content, exactly as a run sends it, or named by its address in `method_ref`. The older `mthds_contents`, an array of `.mthds` texts, is still accepted, but it is being retired together with `mthds_sources` and `resources`, which serve it, and a later release refuses them.
+
**Request Fields:**
-- `mthds_contents` (list[str], optional): MTHDS contents to validate (always an array, even for a single file). Exactly one of `mthds_contents` / `files` / `method_ref` must be provided
-- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree, each value the file's text, `{"base64": "…"}` or `{"sha256": "…", "size": n}`, read as on a run — see [Validating a method tree](#validating-a-method-tree). Exactly one of `mthds_contents` / `files` / `method_ref`
+- `files` (object, optional): The method as a map of file entries, the MTHDS standard's method tree, each value the file's text, `{"base64": "…"}` or `{"sha256": "…", "size": n}`, read as on a run — see [Validating a method tree](#validating-a-method-tree). Exactly one of `files` / `method_ref` / `mthds_contents` must be provided
- `dependencies` (object, optional): **Pipelex-API extension.** The method packages the method calls by address that the runner cannot fetch, each a map of file entries keyed by its address, as on a [run](pipe-run.md#sending-the-method-packages-the-method-calls). Accompanies `files`
-- `method_ref` (string, optional): **Pipelex-API extension.** Validate a published method by address — `github.com/<owner>/<repo>` plus an optional package selector and `@<tag>` — resolved by this server through the same fetch path as a [`method_ref` run](pipe-run.md#running-a-method-by-address-method_ref): the repository is fetched at the tag, the package located by manifest identity, and its tree read from the commit's git objects and validated as a tree sent in `files` is — see [Validating a method tree](#validating-a-method-tree). Exactly one of `mthds_contents` / `files` / `method_ref`; `mthds_sources` cannot accompany it. A package holding Python and a `requirements.txt` has its requirements checked on this server against the packages the deployment's PipeFunc sandbox offers for them before anything is validated, and a requirement the sandbox does not meet, or a line the standard refuses, makes the verdict `is_valid: false` with one item per line, whose `source` is `requirements.txt` and whose `line` is the line's number; a deployment refusing the requirements with its own explanation, no environment it can build holding them, makes it `is_valid: false` with one item on `requirements.txt` and no line
+- `method_ref` (string, optional): **Pipelex-API extension.** Validate a published method by address — `github.com/<owner>/<repo>` plus an optional package selector and `@<tag>` — resolved by this server through the same fetch path as a [`method_ref` run](pipe-run.md#running-a-method-by-address-method_ref): the repository is fetched at the tag, the package located by manifest identity, and its tree read from the commit's git objects and validated as a tree sent in `files` is — see [Validating a method tree](#validating-a-method-tree). Exactly one of `files` / `method_ref` / `mthds_contents`; `mthds_sources` cannot accompany it. A package holding Python and a `requirements.txt` has its requirements checked on this server against the packages the deployment's PipeFunc sandbox offers for them before anything is validated, and a requirement the sandbox does not meet, or a line the standard refuses, makes the verdict `is_valid: false` with one item per line, whose `source` is `requirements.txt` and whose `line` is the line's number; a deployment refusing the requirements with its own explanation, no environment it can build holding them, makes it `is_valid: false` with one item on `requirements.txt` and no line
+- `mthds_contents` (list[str], optional): **Being retired: send the method in `files`.** MTHDS contents to validate (always an array, even for a single file). Exactly one of `files` / `method_ref` / `mthds_contents` must be provided. Still accepted until a later release refuses it
- `read_scope` (string, optional): **Pipelex-API extension.** The scope the validation reads the method under, as a run's `read_scope`, which a multi-tenant host sends for the organization it serves; [a `jwt` caller may send only a scope under its own id](pipe-run.md#host-supplied-run-context-storage_scope-and-analytics_groups), else a `403` `auth.forbidden` whose `requirement` is `read_scope_under_caller`. A hash entry of `files` resolves in that scope's blob store — see [Sending files by hash](pipe-run.md#sending-files-by-hash) — and the runner hands the scope to its validator, so a validation dispatched to a worker can hand it the method through that store — see [Where validation runs](#where-validation-runs). Omitted, a hash entry resolves in the caller's own id's store, but only a validation carrying it records the tree it read in the blob store, and the validator is handed no scope, so a dry run without one leaves nothing stored
- `allow_signatures` (boolean, optional, default `false`): controls only the **sweep mechanics** for `PipeSignature` placeholders — whether signature pipes are mock-run during the dry-run sweep and therefore listed in `validated_pipes`. It does **not** change the verdict: an unimplemented signature is never a rejection, it is a *runnability fact* reported via `pending_signatures` + `is_runnable` in both modes
-- `mthds_sources` (list[str] | null, optional): per-file sources, parallel to `mthds_contents` — see [Sourcing submitted files](#sourcing-submitted-files). When present it must match `mthds_contents` in length (a mismatch is a 422 request error), and it accompanies `mthds_contents` alone, since a tree's files are named by their tree paths
-- `resources` (object | null, optional): **Pipelex-API extension.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or `files`, whose tree each file joins; beside `method_ref` it is a 422
+- `mthds_sources` (list[str] | null, optional): **Being retired with `mthds_contents`: the files of a method sent in `files` are named by their tree paths.** Per-file sources, parallel to `mthds_contents` — see [Sourcing submitted files](#sourcing-submitted-files). When present it must match `mthds_contents` in length (a mismatch is a 422 request error), and it accompanies `mthds_contents` alone, since a tree's files are named by their tree paths
+- `resources` (object | null, optional): **Pipelex-API extension, being retired with `mthds_contents`: put the files in the method's tree, in `files`.** The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, as a map from the path the step names to the file's bytes in standard base64 — see [Sending the files the steps read](#sending-the-files-the-steps-read-resources). It accompanies `mthds_contents` or `files`, whose tree each file joins; beside `method_ref` it is a 422
- `render` (list[str], optional, default `[]`): opt-in *rendered text* to attach to the verdict — see [Opt-in extras](#opt-in-extras-render-and-views)
- `views` (list[str], optional, default `[]`): opt-in *structured views* to attach to the verdict — see [Opt-in extras](#opt-in-extras-render-and-views)
- `orchestration_mode` (string | null, optional): per-request backend override for the validation dispatch — see [Where validation runs](#where-validation-runs). Honored only when the deployment allows it; a forbidden override is a 422 `pipelex.deployment.orchestration_override_forbidden`
@@ -76,7 +80,7 @@ The 200 body is one of two arms, discriminated on the mandatory `is_valid` field
**Response Fields (wire extras, valid arm only, this server only):**
-- `mthds_contents` (list[str]): echo of the validated request contents
+- `mthds_contents` (list[str]): the text of the validated bundles: the `.mthds` files of a method sent in `files` or fetched by `method_ref`, in tree path order, or the request's own `mthds_contents`
- `message` (string): status message
- `default_pipe_ref` (string, optional): the qualified `domain.pipe_code` a caller gets by **omitting** the pipe selector — the pipe a selector-less run of this same request would execute; absent when no entry pipe is determined. See [The effective entry pipe](#the-effective-entry-pipe) below
@@ -157,7 +161,9 @@ Neither axis is part of the verdict contract: a machine consumer branches on the
## Sourcing submitted files
-The submit path carries bundle text, not file paths, so by default the runtime cannot tell the client which file an error belongs to — an item's `location` carries no `file`. Send `mthds_sources` parallel to `mthds_contents` to fix this: each source is the logical identity of that content (e.g. the file's path relative to the submitted directory), and the runtime threads it onto the corresponding `blueprint.source`. The source then rides back on both arms — `bundle_blueprint.source` on the valid arm, and `errors[].location.file` on the invalid arm — so a multi-file editor client can map a cross-file diagnostic to the file that owns it. Omit `mthds_sources` (or send `null`) and behavior is exactly as before. The list, when present, must be the same length as `mthds_contents`; a mismatch is a request-shape 422 (it is the caller's wiring bug, caught before the validation sweep runs). A source is a label for diagnostics and nothing more: even one naming a real file on the server is never a directory the server reads from, so a step's template file comes from [`resources`](#sending-the-files-the-steps-read-resources) alone, and an address-based reference is not searched for above it.
+A method sent in `files` needs no sources: each of its bundles is named by its tree path, which is the `location.file` of every item it owns. This section concerns `mthds_contents`, which is being retired, and `mthds_sources` goes with it.
+
+The `mthds_contents` path carries bundle text, not file paths, so by default the runtime cannot tell the client which file an error belongs to — an item's `location` carries no `file`. Send `mthds_sources` parallel to `mthds_contents` to fix this: each source is the logical identity of that content (e.g. the file's path relative to the submitted directory), and the runtime threads it onto the corresponding `blueprint.source`. The source then rides back on both arms — `bundle_blueprint.source` on the valid arm, and `errors[].location.file` on the invalid arm — so a multi-file editor client can map a cross-file diagnostic to the file that owns it. Omit `mthds_sources` (or send `null`) and behavior is exactly as before. The list, when present, must be the same length as `mthds_contents`; a mismatch is a request-shape 422 (it is the caller's wiring bug, caught before the validation sweep runs). A source is a label for diagnostics and nothing more: even one naming a real file on the server is never a directory the server reads from, so a step's template file comes from [`resources`](#sending-the-files-the-steps-read-resources) alone, and an address-based reference is not searched for above it.
## Validating a method tree
@@ -170,7 +176,18 @@ A method sent in `files`, or fetched by `method_ref`, is validated whole, as it
## Sending the files the steps read (`resources`)
-A bundle sent as content has no directory, so a file one of its steps reads from beside the bundle, such as a `PipeDocGen` step's `template_file`, is sent with it in `resources`. The same field, with the same rules, is accepted by [`/v1/execute` and `/v1/start`](pipe-run.md), [`/v1/pipe-io`](pipe-io.md), and [`/v1/resolve` and `/v1/codegen`](codegen.md#selecting-the-method).
+A method sent in `files` carries the files its steps read in its own tree, each at its path beside the bundle whose step names it, so it needs no `resources`:
+
+```json
+{
+ "files": {
+ "invoicing.mthds": "domain = \"invoicing\"\n...\n[pipe.print_invoice]\ntype = \"PipeDocGen\"\n...\nformat = \"docx\"\ntemplate_file = \"templates/invoice.docx\"",
+ "templates/invoice.docx": {"base64": "UEsDBBQABgAIAAAAIQ..."}
+ }
+}
+```
+
+`resources` is being retired on every route that takes it, and a later release refuses it: here and on the run routes it goes with `mthds_contents`, and on the routes that take a method only as a tree, a file the steps read travels inside the tree. Until then, a bundle sent as content has no directory, so a file one of its steps reads from beside the bundle, such as a `PipeDocGen` step's `template_file`, can be sent with it in `resources`. The same field, with the same rules, is accepted by [`/v1/execute` and `/v1/start`](pipe-run.md), [`/v1/pipe-io`](pipe-io.md), and [`/v1/resolve` and `/v1/codegen`](codegen.md#selecting-the-method).
```json
{
@@ -205,7 +222,7 @@ A validation is not a run, but it still emits telemetry: the sweep's `pipe_dry_r
Only conditions where the endpoint could not produce a verdict are non-2xx, rendered as [RFC 9457 problem documents](error-responses.md):
-- **422** — a malformed request body (`request.malformed`), an `mthds_sources` / `mthds_contents` length mismatch, more or fewer than one of `mthds_contents` / `files` / `method_ref`, or a malformed `analytics_groups` (`request.invalid`, naming the field), or a per-request `orchestration_mode` override the deployment does not allow (`pipelex.deployment.orchestration_override_forbidden`) — request-shape errors caught before the runtime.
+- **422** — a malformed request body (`request.malformed`), an `mthds_sources` / `mthds_contents` length mismatch, more or fewer than one of `files` / `method_ref` / `mthds_contents`, or a malformed `analytics_groups` (`request.invalid`, naming the field), or a per-request `orchestration_mode` override the deployment does not allow (`pipelex.deployment.orchestration_override_forbidden`) — request-shape errors caught before the runtime.
- **422** on a method tree — a key the tree's rule refuses (`method.package_invalid`, or `security.input_path_refused`), a malformed entry (`request.invalid`), a hash entry the runner does not hold (`request.blobs_missing`), or a tree past its limits (`method.package_invalid`) — see [Validating a method tree](#validating-a-method-tree).
- **422** and **413** on `resources` — a path that cannot name a file inside the bundle (`security.input_path_refused`, or `request.invalid`), a file no step names (`request.invalid`), files that cannot make one tree (`request.invalid`), too many files (`request.invalid`), a file or a request over its size limit (`request.too_large`), or a value that is not base64 (`request.malformed`) — see [Sending the files the steps read](#sending-the-files-the-steps-read-resources).
- **401** — unauthenticated (`auth.missing_credential`, `auth.invalid_credential`, `auth.credential_expired`).
diff --git a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md b/docs/building-methods/pipes/pipe-operators/PipeDocGen.md
index 561e87200..2db41838f 100644
--- a/docs/building-methods/pipes/pipe-operators/PipeDocGen.md
+++ b/docs/building-methods/pipes/pipe-operators/PipeDocGen.md
@@ -172,11 +172,11 @@ The engine that prints HTML joins each relative URL to a base URL Pipelex hands
An `.xlsx`, `.docx` or `.pptx` template file is filled by its engine from the inputs as plain data, so it sees fields, not the sigils and filters of HTML templates. In plain data a native value is its value, and a verdict is its verdict: a `YesNo` is its boolean, a `Choice` its option key and a `Rating` its level, so the file reads `team` rather than `team.choice`, and a verdict's probability or confidence does not reach it. A `pdf` template reads the verdict whole, `team.choice` and `team.confidence` included, as a `PipeCompose` template does. Its contract is documented with the plugin. When the plugin's engine checks templates, `pipelex validate` and the dry run compare the file with the inputs' concepts: a misspelled name is reported before any run.
-A bundle loaded from a directory, a dependency package's included, finds its template file beside its own file, and never among the files sent with a request. A bundle loaded from a string has no directory, so its template files come with it: the API's routes take the whole method as a tree in `files`, or its bundles as strings with their template files in the request's `resources`, each keyed by exactly the path its step names, and the Python entry points take them as `submitted_files` (see [Template files sent with a bundle](#template-files-sent-with-a-bundle)). A string-loaded step whose file was not supplied is refused at load, saying so, whatever source label the bundle carries: only a bundle file the runtime read itself has a directory beside it, so a label naming a path, or a `source` written in the bundle's text, never makes the runtime read its own disk. An inline `template` works on every load path.
+A bundle loaded from a directory, a dependency package's included, finds its template file beside its own file, and never among the files sent with a request. A bundle loaded from a string has no directory, so its template files come with it: the API's routes take the whole method as a tree in `files`, or, until the server retires these older fields, its bundles as strings in `mthds_contents` with their template files in the request's `resources`, each keyed by exactly the path its step names, and the Python entry points take them as `submitted_files` (see [Template files sent with a bundle](#template-files-sent-with-a-bundle)). A string-loaded step whose file was not supplied is refused at load, saying so, whatever source label the bundle carries: only a bundle file the runtime read itself has a directory beside it, so a label naming a path, or a `source` written in the bundle's text, never makes the runtime read its own disk. An inline `template` works on every load path.
### Template files sent with a bundle
-A method sent to the [API server](../../../api-server/pipe-run.md#sending-a-method-as-a-tree) as a tree, in `files`, carries its folder whole: its bundles, its template files and every image, stylesheet and font its templates name, each at its path in the method, whether a step names it or not, and it loads as if read from its folder. When the bundles are sent as strings instead, in `mthds_contents`, every template file a step reads travels beside them:
+A method sent to the [API server](../../../api-server/pipe-run.md#sending-a-method-as-a-tree) as a tree, in `files`, carries its folder whole: its bundles, its template files and every image, stylesheet and font its templates name, each at its path in the method, whether a step names it or not, and it loads as if read from its folder. This is the way to send a method: the server's older fields, `mthds_contents` for the bundles as strings and `resources` for their template files, are being retired, and a later release refuses them. Until then, when the bundles are sent as strings in `mthds_contents`, every template file a step reads travels beside them:
```json
{