Workflows: Concepts & Architecture.
BetaTyped JSON schemas, safe variable interpolation, single-pass Shield guardrails, version pinning, zero payload retention and pricing.
For agents (.md & prompt)
Noirdoc Workflows executes linear multi-model pipelines synchronously in a single HTTP request:
JSON Input → Shield Guardrail → Step 1 → … → Step N → JSON OutputEvery step inherits your organisation’s standard gateway routing: cheapest-first EU selection, Bring Your Own Key (BYOK), provider failover, § 203 StGB enforcement, and key and tag budgets.
What happens on a /run call?
Every request to POST /v1/workflows/{slug}/run or /v{n}/run runs through five fixed stages:
- Auth, body limit (15 MB) &
input_schema: Checks thepx-key and active organisation (401invalid_api_keyon an invalid/disabled key or inactive organisation), size caps (15 MB total JSON body, 10 MB decoded per file; 413payload_too_large) and JSON Schema Draft 2020-12 (422invalid_workflow_input). Rejections here (401, 413, 422) incur €0 workflow fee. - Single-pass Shield inspection at ingress: Under
blockorredact, Noirdoc Shield inspects every non-empty string field and inline UTF-8 text file once before Step 1 (billed separately like a direct Shield call). Binary PDFs and images trigger 422shield_uninspectable_content(€0) underenforcedShield. If 403shield_violationtriggers, model cost is €0.00 while Shield inspection and the single €0.002 workflow run fee are settled normally (fail-closed 503shield_unavailableincurs €0). - Sequential steps 1..N: Runs prompt steps (optionally with file attachments via
attachments) with single-pass interpolation and your standard organisation routing. Every executed run settles the single €0.002 orchestration fee once. - Local
output_schemacheck + max. 1× auto-repair: Validates the final JSON against Draft 2020-12 and runs at most one repair call on the final step (502workflow_output_invalidif repair still fails). - Synchronous JSON & zero payload retention: Returns the validated
outputobject with per-step and EUR cost metadata – only metadata is recorded in the run log.
Typed schemas & 1× auto-repair.
Each workflow defines an input_schema and an output_schema using JSON Schema Draft 2020-12:
input_schema Before Shield and Step 1, the engine validates the JSON request body against input_schema. Invalid payloads fail immediately with 422 invalid_workflow_input (listing field paths without logging raw values) at €0 workflow fee.
strict: true When dispatching to OpenAI or Anthropic models, the engine normalises a provider copy of the schema for strict: true (adding additionalProperties: false on objects and stripping provider-unsupported keywords such as format) while keeping full Draft 2020-12 validation locally. If a provider still rejects the schema with HTTP 400, the step falls back once to prompt-instructed JSON.
meta.repair_attempted If the final step’s output fails JSON parsing or output_schema validation, the engine executes at most one repair call to the final step’s model with the schema and exact validation errors (meta.repair_attempted: true). If it still fails, the API returns 502 workflow_output_invalid.
Safe variable interpolation.
Prompt templates access inputs and earlier steps via dot paths:
{{input.<path>}}reads fields from the (possibly redacted) input JSON.{{steps.<key>}}inserts the full output of a previous step (objects serialised as compact JSON).{{steps.<key>.<path>}}reads a nested field from a JSON step output.
Channel: {{input.channel}}
Message: {{input.message}}
Category from step 1: {{steps.classify.category}}Substitution runs strictly in a single pass with no Jinja or code evaluation. If untrusted input literally contains {{steps.classify}}, that string stays untouched and is never re-expanded.
File & Vision inputs.
Alongside text fields, workflows accept PDFs, images and text files directly for Vision-capable catalogue models (such as gemini-3.8-flash, claude-sonnet-5-5 or gpt-5.4-mini):
format: data-url Declare file inputs in input_schema as string fields with "format": "data-url" and send them as base64 data URLs (data:<mime>;base64,...) inside the JSON body.
attachments A prompt step references file inputs via "attachments": ["input.receipt_file"]. The engine attaches the payload as a native multimodal file or image block and never dumps raw base64 into the prompt text.
Supports PDF (application/pdf), images (image/png, image/jpeg, image/webp, image/gif) and UTF-8 text files (text/plain, text/markdown, text/csv, application/json, application/xml, text/xml). Total JSON request body is capped at 15 MB, with at most 10 MB decoded per file.
enforced Inline UTF-8 text files are decoded and inspected by Shield. Binary PDFs and images cannot be text-inspected: when your organisation’s Shield policy is enforced, the run fails before Step 1 with 422 shield_uninspectable_content (€0.00); without enforced, Shield inspects all remaining text fields and forwards the binary attachment to the Vision model.
Single-pass Shield at ingress.
The engine inspects every non-empty string leaf of the input JSON exactly once before Step 1 through Noirdoc Shield on German infrastructure:
off Skips Shield inspection; forbidden when the organisation policy is enforced (422 shield_enforced_cannot_disable).
block Overrides all enabled organisation rules to block; matching content halts before Step 1 with 403 shield_violation.
redact pii, ner and custom redact in memory with fixed placeholders, while secrets and injection stay block.
Versioning & permissions.
Drafts (draft_definition) are mutable and can be tested in the browser at any time. Publishing records an immutable snapshot (v1, v2, …) with sample_input and ui_layout stripped:
POST /v1/workflows/{slug}/runalways runs the latest published version.POST /v1/workflows/{slug}/v{n}/runpins your application to versionn– even afterv2is published.
Role boundaries within an organisation: admin creates workflows, edits drafts, runs browser tests, publishes new versions and archives workflows; member has read-only access to workflows, versions and run metadata. Workflows is available to every active organisation without separate activation; requests with a missing, invalid or disabled API key or an inactive organisation fail before Step 1 with 401 invalid_api_key (€0.00).
Zero payload retention & audit trail.
The workflow engine never stores customer inputs, intermediate step outputs, final outputs or detected plaintext PII in databases, caches or logs:
- The run log stores metadata only:
run_id, workflow ID, version, source (apiorbrowser_test), HTTP status, error code, duration, step count,pii_mode, detected categories (such as["PERSON", "IBAN"]) and EUR cost breakdown. - Browser test runs return intermediate step outputs live in the HTTP response only, require no
px-key, and appear separately from production API runs in gateway audit logs. - Organisation audit logs (Activity) record control-plane events (
workflow.created,workflow.updated,workflow.published,workflow.archived,workflow.test_run) without payload data.
Pricing & settlement.
| Cost component | Rate | When billed |
|---|---|---|
| Workflow orchestration fee | €2.00 / 1,000 runs | €0.002 once per executed run (including 403 shield_violation, managed models, BYOK and browser test runs). |
| Model tokens | Catalogue rate per step | Standard gateway token pricing per step executed (BYOK settles model tokens directly with your provider). |
| Noirdoc Shield (optional) | €0.40 / 1M tokens | Once at ingress when block or redact is active, billed separately just like /v1/shield/inspect. |
| Base fee / subscription | €0.00 | No minimum spend, no fixed contract term. |