Workflows: Concepts & Architecture.

Beta

Typed JSON schemas, safe variable interpolation, single-pass Shield guardrails, version pinning, zero payload retention and pricing.

For agents (.md & prompt)
View as .md All docs (llms-full.txt)

Noirdoc Workflows executes linear multi-model pipelines synchronously in a single HTTP request:

Shell
JSON Input → Shield Guardrail → Step 1 → … → Step N → JSON Output

Every 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:

  1. Auth, body limit (15 MB) & input_schema: Checks the px- key and active organisation (401 invalid_api_key on an invalid/disabled key or inactive organisation), size caps (15 MB total JSON body, 10 MB decoded per file; 413 payload_too_large) and JSON Schema Draft 2020-12 (422 invalid_workflow_input). Rejections here (401, 413, 422) incur €0 workflow fee.
  2. Single-pass Shield inspection at ingress: Under block or redact, 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 422 shield_uninspectable_content (€0) under enforced Shield. If 403 shield_violation triggers, model cost is €0.00 while Shield inspection and the single €0.002 workflow run fee are settled normally (fail-closed 503 shield_unavailable incurs €0).
  3. 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.
  4. Local output_schema check + max. 1× auto-repair: Validates the final JSON against Draft 2020-12 and runs at most one repair call on the final step (502 workflow_output_invalid if repair still fails).
  5. Synchronous JSON & zero payload retention: Returns the validated output object 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 validation input_schema €0 on rejection

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.

Provider normalisation strict: true OpenAI & Anthropic

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.

Automatic repair meta.repair_attempted Max. 1× on final step

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.
Shell
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):

Schema declaration format: data-url Base64 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.

Step binding attachments Multimodal block

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.

Allowed MIME types & caps Max. 15 MB bodyMax. 10 MB / file

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.

Interaction with Noirdoc Shield enforced UTF-8 inspected · binary fail-closed

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:

Disabled off Blocked under enforced

Skips Shield inspection; forbidden when the organisation policy is enforced (422 shield_enforced_cannot_disable).

Block block 403 shield_violation

Overrides all enabled organisation rules to block; matching content halts before Step 1 with 403 shield_violation.

Redact redact secrets & injection stay block

pii, ner and custom redact in memory with fixed placeholders, while secrets and injection stay block.

[PERSON][IBAN]

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}/run always runs the latest published version.
  • POST /v1/workflows/{slug}/v{n}/run pins your application to version n – even after v2 is 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 (api or browser_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 componentRateWhen 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 tokensCatalogue rate per stepStandard gateway token pricing per step executed (BYOK settles model tokens directly with your provider).
Noirdoc Shield (optional)€0.40 / 1M tokensOnce at ingress when block or redact is active, billed separately just like /v1/shield/inspect.
Base fee / subscription€0.00No minimum spend, no fixed contract term.

Related pages.

Workflows: Concepts & Architecture
https://www.noirdoc.de/en/docs/concepts/workflows.md
.md