Start building

Orchestration

Batch orders → reusable subprocess

Run the same child process sequentially for every item, collect its outputs and render the complete result array. Try a normal batch and an empty batch.

  • JSON → JSON
  • Intermediate
  • 4 min

Last verified 2026-10-31 at f4ce7d0 — simulation fixtures

Try this template in Studio

Studio activation is a one-time payment of USD 20.

Flow

Drawn at build time from the node positions in the template's process definitions. Numbered markers are the walkthrough stages.

Main processBatch · reusable subprocess loop4 activities

Scroll sideways to see the whole flow.

Flow diagram of Batch · reusable subprocess loop4 activities and 3 transitions: Start, For each order item, Render batch result, Return batch.StartstartFor each order itemforeach1Render batch resultjson.render3Return batchend
List the 4 activities and 3 transitions

Activities

  1. Start start
  2. For each order item foreach
  3. Render batch result json.render
  4. Return batch end

Transitions

  • Start → For each order item (on success)
  • For each order item → Render batch result (on success)
  • Render batch result → Return batch (on success)
SubprocessPrepare item · subprocess3 activities

Scroll sideways to see the whole flow.

Flow diagram of Prepare item · subprocess3 activities and 2 transitions: Start, Prepare item, Return item.StartstartPrepare itemassign2Return itemend
List the 3 activities and 2 transitions

Activities

  1. Start start
  2. Prepare item assign
  3. Return item end

Transitions

  • Start → Prepare item (on success)
  • Prepare item → Return item (on success)

Walkthrough

  1. Iterate over the inputPass each item and index to the saved child process.
  2. Prepare each itemCreate a result with the original ID, position and prepared status.
  3. Collect & renderReturn every child result in a JSON array.

What you will practise

  • Observe an isolated child context for each array item.
  • Compare a three-item batch with an empty collection.

Sample cases

2 cases with 7 assertions, run with python -m server.integration examples --all in simulation.

Three-item batch

Passed

Each item gets one subprocess invocation.

Expected result A rendered array of three prepared items with indexes 0, 1 and 2.

4/4 assertions

  • Process completes in simulation
  • First item is preserved
  • Last item gets its index
  • Child mapping runs three times

This sample run only; not a production certification.

Empty batch

Passed

A valid empty array should not invoke the child.

Expected result An empty JSON array and zero child invocations.

3/3 assertions

  • Process completes in simulation
  • Empty JSON array is returned
  • No child mapping is called

This sample run only; not a production certification.

Prerequisites

Runtime
Cohuno runtime 1.27.0, the version recorded when these cases last passed.
Starter
Manual start; no listener.
Optional dependencies
None beyond the base runtime.
Simulation fixtures
None: no activity in this template uses a connector.
Verification details

Provenance

What was verified, and when. The content part changes whenever the pack, a process in its closure, the runtime version or a case result changes; the gallery check then fails until the gallery is regenerated and the changed templates are verified again.

Verified content

Pack SHA-256
9b81a0fb058ac6dab924edcb437db78c1a237925b7f3fc7ad452e0842ec085a8
Closure SHA-256
26d37ff7ad3788caffc5265aadaed64f3db6c2d39edc15ee1cf603164149eb9a
Runtime
1.27.0
Results
2/2 cases, 7/7 assertions, mode simulate, external calls: none.
Files in the closure
  • server/integration/example_packs/batch_loop.json
  • server/integration/templates/batch_item.json
  • server/integration/templates/batch_orders.json

Verification event

Commit
f4ce7d08eedc90267b405ed1974344153a8b3a34
Verified at (UTC)
2026-10-31T21:19:21Z

How the Cohuno team reproduces this check

PYTHONPATH=. python -m server.integration examples --example batch_loop
PYTHONPATH=. python scripts/export_public_gallery.py --check