Subpipes
Reusable named valve sequences that run in the calling pipe's context.
A subpipe is a named, reusable sequence of valves defined at module level. When a pipe includes a subpipe using the Pipe Include valve, the subpipe's valves execute inside the calling pipe's context. They share the same request, session, state, and items — no new context is created.
This is useful when several pipes share a common set of steps, such as enriching request data, validating a token, or building a set of items, and you want to maintain that logic in one place.
Defining subpipes
Section titled “Defining subpipes”Subpipes are defined in the module configuration. The preferred approach is to use the top-level subpipes attribute alongside the pipes array.
| Name | Description | Default | Mandatory |
|---|---|---|---|
id | Unique identifier of the subpipe. Used when referencing the subpipe from the Pipe Include valve. | ||
enabled | Flag to enable or disable the subpipe. | true | |
display_name | Optional display name used in logs. If omitted, the id is used. | id | |
config.valves | Ordered list of valves forming the subpipe. | [] |
{ "name": "Pipes", "config": { "subpipes": [ { "id": "shared-auth", "enabled": true, "display_name": "Shared auth logic", "config": { "valves": [ { "name": "SessionPut", "enabled": true, "config": { "name": "authenticated", "value": "true" } } ] } } ], "pipes": [ { "id": "pipe01", "config": { "valves": [ { "name": "PipeInclude", "config": { "subpipe": "shared-auth" } } ] } } ] }}Using a subpipe
Section titled “Using a subpipe”A subpipe is included in a pipe using the Pipe Include valve. The subpipe property references the subpipe by its id.
{ "name": "PipeInclude", "config": { "subpipe": "shared-auth" }}The exec_if_expr property can be used on a PipeInclude valve to conditionally include the subpipe, the same as with any other valve.
Restrictions
Section titled “Restrictions”The following valves are not allowed inside a subpipe and will cause an error at startup:
PipeInclude— subpipes cannot include other subpipesPipeExec— subpipes cannot execute other pipesPipeCall— subpipes cannot call other pipes
Logging
Section titled “Logging”When a subpipe executes, each valve logs with context identifying both the calling pipe and the subpipe:
pipe=<pipe-id> subpipe=<subpipe-display-name> valve=<valve-name>[<index>]This makes it possible to trace execution across pipes and subpipes in the same log stream.