1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
# ─────────────────────────────────────────────────────────────────────────────
# Bria — Multi-pipeline job orchestrator
# ─────────────────────────────────────────────────────────────────────────────
#
# Environment variable substitution: ${VAR_NAME} is resolved at config load
# time. Unset variables cause a load error — never silently replaced with "".
#
# Command-line: bria --config Config.toml
# Environment: BRIA_CONFIG=Config.toml bria
# Validate and check configuration; Bria won't start if there are errors.
#
# ─── Conceptual model ────────────────────────────────────────────────────────
#
# [[sources]] — named inlets that produce Jobs
# [[tasks]] — named, reusable command templates
# [[sinks]] — named outlets that consume Results
# [[pipelines]] — DAGs of steps wiring the above together
#
# A Job flows through a pipeline's steps.
# Each step receives a Context and emits an updated Context:
#
# Context = {
# job: { id, source, payload }
# steps: { <step_id>: { stdout, stderr, exit_code, duration_ms,
# attempt, outputs: { <name>: <value> } } }
# }
#
# ─── Expressions (CEL) ───────────────────────────────────────────────────────
#
# condition steps, map steps, routing rules, and merge correlation_expr
# all use Google Common Expression Language (CEL) evaluated by cel-rust.
# CEL is sandboxed — no I/O, no side effects, deterministic.
#
# The full Context object is available as the CEL input. Examples:
# job.payload.width <= 4096
# steps.resize.exit_code == 0 && job.payload.priority == "high"
# "s3://" + job.payload.bucket + "/" + job.payload.key
# job.payload.order_id == job.payload.request_id ← merge correlation
#
# ─── Placeholder syntax ──────────────────────────────────────────────────────
#
# Used in: cmd, args, env values, stdin templates, file paths, URLs,
# body templates, routing keys. Rendered by minijinja.
#
# {{job.id}} ULID e.g. 01ARZ3NDEKTSV4RRFFQ69G5FAV
# {{job.source}} source id that produced the job
# {{job.payload.<field>}} field from the ingress payload
# {{steps.<id>.stdout}} raw stdout of a prior step
# {{steps.<id>.stderr}} raw stderr of a prior step
# {{steps.<id>.exit_code}} integer exit code of a prior step
# {{steps.<id>.outputs.<name>}} named output extracted from a prior step
# {{env.<VAR>}} OS environment variable at runtime
# {{now}} ISO-8601 UTC timestamp at step start
# {{now_unix}} Unix epoch seconds at step start
#
# Missing placeholders cause the job to fail — no silent empty substitution.
#
# ─────────────────────────────────────────────────────────────────────────────
# ══════════════════════════════════════════════════════════════════════════════
# GLOBAL
# ══════════════════════════════════════════════════════════════════════════════
[]
# Number of Tokio worker threads. 0 = logical CPU count. Default: 0
= 0
# Graceful shutdown timeout across all pipelines (seconds). Default: 30
= 30
# Directory for temporary files (e.g. stdin payloads written to disk).
# Default: OS temp dir. Uncomment to override explicitly.
# tmp_dir = "/tmp/bria"
# Maximum size of a single job payload in bytes. Default: 10485760 (10 MiB)
= 10485760
# How long cancellation signals are retained for jobs that have not arrived yet
# (seconds). Prevents unbounded memory growth from stale cancellation requests.
# Default: 3600
= 3600
# ─── Logging ──────────────────────────────────────────────────────────────────
[]
# "trace" | "debug" | "info" | "warn" | "error". Default: "info"
= "info"
# "text" — human-readable (default when stdout is a TTY)
# "json" — structured JSON (default when stdout is not a TTY)
= "json"
# When non-empty, write logs to this file in addition to stdout. Default: ""
= "/var/log/bria/bria.log"
# ─── State backend ────────────────────────────────────────────────────────────
# Persists in-flight job state and retry schedules so Bria can resume cleanly
# after a restart without re-processing completed jobs or losing in-flight ones.
#
# This is distinct from sinks (which record results for observability) and from
# per-source cursors (which track ingestion position).
#
# Supported backends:
# memory — no persistence; all in-flight state is lost on restart (default)
# sqlite — single-node durability; good for development and single-host prod
# pg — multi-node / HA; required for horizontally scaled deployments
[]
# Default: "memory"
= "sqlite"
# SQLite: path to the state database file.
# Default: "bria-state.db"
= "bria-state.db"
# PostgreSQL: connection URL (only used when backend = "pg").
# Default: ""
= "postgres://${PG_USER}:${PG_PASS}@${PG_HOST}:${PG_PORT}/bria_state"
# ─── Global retry defaults ────────────────────────────────────────────────────
# Inherited by all tasks unless overridden at the task or step level.
# Precedence: [pipelines.steps.retry] > [tasks.retry] > [global.retry]
[]
= 0
= 1000
= 30000
= 0.2
# ─── Global timeout defaults ──────────────────────────────────────────────────
# Precedence: [pipelines.steps.with] > [tasks] > [global.timeout]
[]
# Wall-clock seconds per step. 0 = unlimited. Default: 300
= 300
# "kill" — SIGKILL immediately. "term" — SIGTERM then SIGKILL. Default: "kill"
= "term"
# Seconds between SIGTERM and SIGKILL when action = "term". Default: 5
= 5
# ══════════════════════════════════════════════════════════════════════════════
# SERVER (optional HTTP control plane)
# ══════════════════════════════════════════════════════════════════════════════
[]
= false # Default: false
= "0.0.0.0" # Default: "0.0.0.0"
= 4000 # Default: 4000
= "v1" # URL prefix for all routes. Default: "v1"
# When non-empty all routes require:
# Authorization: Bearer <key> OR X-Bria-Api-Key: <key>
= "" # Default: ""
# Static dashboard served at /{prefix}/dashboard. Default: ""
= ""
# In-flight request drain timeout during graceful shutdown (seconds).
= 5 # Default: 5
# Server-wide maximum request body size in bytes. Applied as a global
# cap via `axum::DefaultBodyLimit`. Per-source limits take precedence
# and are enforced inside the handler.
= 52428800 # Default: 52428800 (50 MiB)
# ══════════════════════════════════════════════════════════════════════════════
# SOURCES
# ══════════════════════════════════════════════════════════════════════════════
# Each [[sources]] block defines a named inlet that produces Jobs.
# Pipelines reference sources by id.
#
# Supported types:
# file — watch a file or directory for new/modified entries
# http — receive jobs via HTTP POST (requires server.enabled)
# webhook — passive HTTP listener with optional HMAC verification
# queue — consume from an AMQP topic exchange
# cron — emit a synthetic job on a cron schedule
# pg — poll a PostgreSQL table for pending rows
# sqlite — poll a SQLite table for pending rows
# ─────────────────────────────────────────────────────────────────────────────
# ─── file ─────────────────────────────────────────────────────────────────────
[[]]
= "image-file"
= "file"
# .json → array of job objects, reloaded on change
# .jsonl → one job object per line, tailed for new lines
# .csv → each row becomes a job; header row defines field names
# Directory: all supported files inside are processed; new files are picked up.
= "jobs/images.jsonl"
# How often to stat the path for changes (seconds). Minimum 1. Default: 2
= 2
# When true, a sidecar .bria-cursor file tracks the last-read position so
# already-seen lines are skipped on restart. Default: true
= true
# When true, a full reload withdraws jobs no longer present. Default: false
= false
# Payload field used as job.id.
# When absent, Bria generates a ULID. Default: ""
= "job_id"
[]
= "ml-platform"
= "production"
# ─── http ─────────────────────────────────────────────────────────────────────
[[]]
= "image-http"
= "http"
# POST /{prefix}/{path} → submit a job
# DELETE /{prefix}/{path}/{id} → cancel a job
= "jobs/images"
# Maximum request body size in bytes. Default: 1048576
= 1048576
# ─── webhook ──────────────────────────────────────────────────────────────────
[[]]
= "stripe-events"
= "webhook"
= "webhooks/stripe"
= "${STRIPE_WEBHOOK_SECRET}" # Default: "" (no verification)
= "Stripe-Signature" # Default: "X-Bria-Signature"
= 202 # Default: 202
= 1048576
# ─── queue ────────────────────────────────────────────────────────────────────
[[]]
= "amqp-image-jobs"
= "queue"
= "amqp://${AMQP_HOST}:${AMQP_PORT}"
= "bria"
= "${AMQP_PASSWORD}"
= "bria.sources"
= "job.submit"
= "job.cancel"
= 5
= 100
= "bria-source"
# ─── cron ─────────────────────────────────────────────────────────────────────
[[]]
= "hourly-tick"
= "cron"
= "0 * * * *" # Standard 5-field cron expression. Required.
= "UTC" # IANA timezone name. Default: "UTC"
[]
= "hourly"
= "${S3_BUCKET}"
# ─── pg ───────────────────────────────────────────────────────────────────────
[[]]
= "pg-image-jobs"
= "pg"
= "postgres://${PG_USER}:${PG_PASS}@${PG_HOST}:${PG_PORT}/bria"
= 5
[]
= "pending_jobs"
[]
= "id"
= "payload"
= "created_at"
= "status"
= "processing"
= "done"
= "failed"
# ─── sqlite ───────────────────────────────────────────────────────────────────
[[]]
= "sqlite-image-jobs"
= "sqlite"
= "jobs.db"
= 5
[]
= "pending_jobs"
[]
= "id"
= "payload"
= "created_at"
= "status"
= "processing"
= "done"
= "failed"
# ══════════════════════════════════════════════════════════════════════════════
# TASKS
# ══════════════════════════════════════════════════════════════════════════════
# A task is a reusable command template. Steps instantiate tasks by id and
# may override individual fields via [pipelines.steps.with].
#
# Execution drivers:
# local — spawn a subprocess on the host (default)
# docker — run inside a container; cmd becomes the container entrypoint
# wasm — execute a WebAssembly module; cmd is the path to the .wasm file
#
# Override precedence (highest to lowest):
# [pipelines.steps.with] → [[tasks]] → [global]
#
# [with.env] merges key-by-key into [tasks.env].
# [with.args] replaces the entire args list.
# ─────────────────────────────────────────────────────────────────────────────
[[]]
= "add-red-balloon"
= "local" # Default: "local"
= "npx"
= [
"-y",
"add-red-balloon",
"{{job.payload.s3_url}}",
"{{job.payload.prompt}}",
]
# Inherit the parent process's full environment before applying [tasks.env].
# Default: false
= false
# Working directory for the child process. Default: Bria's cwd.
# working_dir = "/tmp/bria/work"
# Exit codes treated as success. Default: [0]
= [0]
= 300
= "term"
= 5
[]
= "${AWS_ACCESS_KEY_ID}"
= "${AWS_SECRET_ACCESS_KEY}"
= "${AWS_REGION}"
= "production"
[]
# "none" — close stdin immediately (default)
# "payload" — raw job payload JSON
# "template" — render [tasks.stdin.template] and send the result
= "none"
# template = '{"url":"{{job.payload.s3_url}}","instruction":"{{job.payload.prompt}}"}'
[]
# "capture" — buffer in memory, available to later steps (default)
# "stream" — emit lines to step sinks in real time
# "discard" — drop
= "capture"
= 10485760 # Hard cap; exceeding this fails the job. Default: 10 MiB
[]
= "capture"
= 1048576 # Default: 1 MiB
[]
= 3
= 1000
= 30000
= 0.2
[]
= "ml-platform"
= "node"
# ─────────────────────────────────────────────────────────────────────────────
[[]]
= "resize-image"
= "local"
= "python3"
= [
"scripts/resize.py",
"--input", "{{steps.balloon.outputs.output_path}}",
"--width", "{{job.payload.width}}",
"--output", "/tmp/bria/{{job.id}}_resized.jpg",
]
= false
= 60
[]
= "scripts"
[]
= "none"
[]
= "capture"
= 10485760
[]
= "capture"
= 1048576
[]
= 2
= 500
# ─────────────────────────────────────────────────────────────────────────────
[[]]
= "upload-to-s3"
= "local"
= "aws"
= [
"s3", "cp",
"{{steps.resize.outputs.local_path}}",
"s3://{{job.payload.bucket}}/results/{{job.id}}.jpg",
]
= false
= 120
[]
= "${AWS_ACCESS_KEY_ID}"
= "${AWS_SECRET_ACCESS_KEY}"
= "${AWS_REGION}"
[]
= "none"
[]
= "capture"
= 10485760
[]
= "capture"
= 1048576
[]
= 5
= 2000
= 60000
# ─────────────────────────────────────────────────────────────────────────────
# Docker driver example: run a task inside a container.
# cmd becomes the container image; args become the command passed to it.
[[]]
= "ocr-extract"
= "docker"
= "ghcr.io/example/ocr-service:latest" # container image
= ["--input", "{{job.payload.s3_url}}", "--lang", "{{job.payload.lang}}"]
[]
# Additional docker run flags. Default: []
= ["--rm", "--network=host"]
# Mount pairs: "host_path:container_path". Supports {{}} placeholders.
# Default: []
= ["/tmp/bria:/tmp/bria"]
# Pull policy: "always" | "missing" | "never". Default: "missing"
= "missing"
[]
= "none"
[]
= "capture"
= 10485760
[]
= "capture"
= 1048576
[]
= 2
= 1000
# ─────────────────────────────────────────────────────────────────────────────
# Wasm driver example: execute a sandboxed WebAssembly module.
# cmd is the path to the .wasm file. args and stdin are passed via WASI.
[[]]
= "validate-payload"
= "wasm"
= "modules/validate.wasm"
= ["--schema", "{{job.payload.schema_id}}"]
[]
# WASI preopened directory mappings: "host_path:guest_path".
# The module can only access explicitly listed paths. Default: []
= ["/tmp/bria:/tmp"]
# Maximum memory pages (1 page = 64 KiB). Default: 256 (16 MiB)
= 256
# Wall-clock fuel limit (instructions). 0 = unlimited. Default: 0
= 100000000
[]
= "payload" # pass job payload JSON to the module via stdin
[]
= "capture"
= 1048576
[]
= "capture"
= 65536
[]
= 1
# ─────────────────────────────────────────────────────────────────────────────
[[]]
= "remote-transcribe"
= "local"
= "ssh"
= [
"-i", "${SSH_KEY_PATH}",
"-o", "StrictHostKeyChecking=no",
"{{job.payload.remote_user}}@{{job.payload.remote_host}}",
"python3 /opt/transcribe/run.py --file {{job.payload.remote_path}}",
]
= false
= 600
[]
= "${SSH_AUTH_SOCK}"
[]
= "none"
[]
= "capture"
= 10485760
[]
= "capture"
= 1048576
[]
= 1
# ══════════════════════════════════════════════════════════════════════════════
# SINKS
# ══════════════════════════════════════════════════════════════════════════════
# Each [[sinks]] block defines a named outlet that receives Results.
# Pipelines and individual steps reference sinks by id.
#
# Template variables available in path, url, body_template, routing keys:
# {{job.id}} ULID of the original job
# {{job.source}} source id
# {{job.payload.<field>}} any field from the original payload
# {{steps.<id>.stdout}} captured stdout of a named step
# {{steps.<id>.stderr}} captured stderr of a named step
# {{steps.<id>.exit_code}} exit code of a named step
# {{steps.<id>.outputs.<name>}} extracted output of a named step
# {{pipeline.id}} pipeline id
# {{result.status}} "success" | "failure"
# {{result.duration_ms}} total wall-clock time across all steps
# {{occurred_at}} ISO-8601 UTC timestamp of completion
# ─────────────────────────────────────────────────────────────────────────────
# ─── file ─────────────────────────────────────────────────────────────────────
[[]]
= "results-file"
= "file"
= "results/output.jsonl"
# template = '{"id":"{{job.id}}","out":"{{steps.resize.stdout}}"}'
# ─── webhook ──────────────────────────────────────────────────────────────────
[[]]
= "results-webhook"
= "webhook"
= "https://hooks.example.com/bria/results"
= "${WEBHOOK_SECRET}"
= "X-Bria-Signature"
= "application/json"
= 3
= 250
= 30
[]
= "bria"
= "{{pipeline.id}}"
# ─── queue ────────────────────────────────────────────────────────────────────
[[]]
= "results-queue"
= "queue"
= "amqp://${AMQP_HOST}:${AMQP_PORT}"
= "bria"
= "${AMQP_PASSWORD}"
= "bria.results"
= "result.{{pipeline.id}}.success"
= "result.{{pipeline.id}}.failure"
= 5
# ─── pg ───────────────────────────────────────────────────────────────────────
[[]]
= "results-pg"
= "pg"
= "postgres://${PG_USER}:${PG_PASS}@${PG_HOST}:${PG_PORT}/bria"
[]
= "job_results"
[]
= "result_id"
= "job_id"
= "pipeline_id"
= "step_id"
= "occurred_at"
= "exit_code"
= "stdout"
= "stderr"
= "duration_ms"
= "attempt"
= "status"
# ─── sqlite ───────────────────────────────────────────────────────────────────
[[]]
= "results-sqlite"
= "sqlite"
= "results.db"
[]
= "job_results"
[]
= "result_id"
= "job_id"
= "pipeline_id"
= "step_id"
= "occurred_at"
= "exit_code"
= "stdout"
= "stderr"
= "duration_ms"
= "attempt"
= "status"
# ─── stream (SSE + WebSocket push) ───────────────────────────────────────────
[[]]
= "results-stream"
= "stream"
= "sse" # /{prefix}/sse
= "ws" # /{prefix}/ws
= 30
= 5
= 1024
# ══════════════════════════════════════════════════════════════════════════════
# PIPELINES
# ══════════════════════════════════════════════════════════════════════════════
#
# ─── Step types ───────────────────────────────────────────────────────────────
# process — run a [[tasks]] command template
# map — reshape the context with CEL expressions (no subprocess)
# condition — branch: fail, jump to a labelled step, or emit early
#
# ─── DAG execution ────────────────────────────────────────────────────────────
# Steps declare dependencies via depends_on = ["step_id", ...].
# Steps whose dependencies are all satisfied run concurrently.
# Steps with no depends_on implicitly depend on the immediately preceding
# step, preserving simple top-to-bottom readability for linear pipelines.
# Bria validates the graph at startup and rejects cycles.
#
# ─── Source shorthand ─────────────────────────────────────────────────────────
# Single source → source = "my-source" (scalar string)
# Multiple sources → [[pipelines.sources]] (array of tables)
# [pipelines.merge] is only present with multiple sources.
#
# ─── Sink selection precedence ────────────────────────────────────────────────
# step routing rule > step sinks > pipeline sinks
#
# ─── Failure handling ─────────────────────────────────────────────────────────
# [failure]
# action = "discard" — drop silently (default)
# "dead_letter" — route context to sink
# "stop" — halt pipeline until operator intervention
# sink = "<sink id>" — required when action = "dead_letter"
# ─────────────────────────────────────────────────────────────────────────────
# ── Example 1: parallel-capable image pipeline ────────────────────────────────
# Steps "resize" and "validate" both depend only on "balloon", so they run
# concurrently. "upload" waits for both to finish.
[[]]
= "image-processing"
[[]]
= "image-file"
[[]]
= "image-http"
[]
= "any"
= "correlation_id"
= 60
= 8
= 256
= ["results-webhook", "results-pg"]
[]
= "dead_letter"
= "results-sqlite"
[]
= "ml-platform"
= "production"
# ── Step: balloon ─────────────────────────────────────────────────────────────
[[]]
= "balloon"
= "process"
= "add-red-balloon"
# No depends_on → depends on the preceding step (none here = entry point).
[]
= 180
[]
= "staging"
[]
= "json"
[[]]
= "output_path"
= "output_path" # → {{steps.balloon.outputs.output_path}}
[[]]
= "width"
= "detected_width"
[]
= 2
= 2000
[]
= "dead_letter"
= "results-sqlite"
= []
# ── Step: validate (runs concurrently with resize) ────────────────────────────
[[]]
= "validate"
= "process"
= "validate-payload"
= ["balloon"] # runs as soon as balloon finishes
[]
= "json"
[[]]
= "valid"
= "valid"
# ── Step: resize (runs concurrently with validate) ────────────────────────────
[[]]
= "resize"
= "process"
= "resize-image"
= ["balloon"] # also starts immediately after balloon
[]
= "json"
[[]]
= "local_path"
= "local_path"
# ── Step: upload (waits for both validate and resize) ─────────────────────────
[[]]
= "upload"
= "process"
= "upload-to-s3"
= ["validate", "resize"] # fan-in: starts only when both are done
[[]]
# CEL expression evaluated against the full context.
= 'steps.upload.exit_code == 0 && job.payload.priority == "high"'
= ["results-webhook", "results-pg", "results-stream"]
[[]]
= "steps.upload.exit_code != 0"
= ["results-sqlite"]
# ── Example 2: map step ───────────────────────────────────────────────────────
# Reshapes context using CEL expressions — no subprocess spawned.
# Each [[pipelines.steps.set]] entry writes one field into the context.
# [[pipelines.steps]]
# id = "normalise"
# type = "map"
#
# [[pipelines.steps.set]]
# target = "job.payload.s3_url"
# expr = '"s3://" + job.payload.bucket + "/" + job.payload.key'
#
# [[pipelines.steps.set]]
# target = "job.payload.prompt"
# expr = '"add red balloon, do not change face"'
# ── Example 3: condition step ─────────────────────────────────────────────────
# Short-circuit the pipeline using a CEL expression.
# [[pipelines.steps]]
# id = "guard-size"
# type = "condition"
# expr = "job.payload.width <= 4096"
#
# # What to do when expr is false:
# # "fail" — fail the job with reason (default)
# # "skip_to" — jump forward to the step with id = skip_to
# # "emit" — send current context to sinks and stop
# action = "fail"
# skip_to = "" # step id; used when action = "skip_to"
# sinks = ["results-sqlite"] # used when action = "emit"
# reason = "Image too wide; skipped processing."
# ── Example 4: single-source pipeline (scalar shorthand) ──────────────────────
[[]]
= "hourly-report"
= "hourly-tick"
= 1
= ["results-file"]
[]
= "discard"
[[]]
= "generate-report"
= "process"
= "resize-image"
[]
= "text"
[[]]
= ""
= "report" # → {{steps.generate-report.outputs.report}}
# ── Example 5: multi-source correlation with CEL merge expression ──────────────
# [pipelines.merge] supports an optional correlation_expr (CEL) as an
# alternative to correlation_key when matching requires logic beyond equality.
# Example: match jobs where either order_id OR request_id align across sources.
[[]]
= "order-fulfilment"
[[]]
= "stripe-events"
[[]]
= "amqp-image-jobs"
[]
= "all"
# Simple field equality (most common case):
# correlation_key = "order_id"
#
# CEL expression for multi-field or cross-field correlation.
# Both `a` and `b` refer to the job context from each source respectively.
# correlation_expr is mutually exclusive with correlation_key.
= 'a.job.payload.order_id == b.job.payload.order_id'
= 300
= 16
= 512
= ["results-queue"]
[]
= "dead_letter"
= "results-pg"
[]
= "payments"
[[]]
= "transcribe"
= "process"
= "remote-transcribe"
[]
= "json"
[[]]
= "transcript"
= "transcript"
[[]]
= "notify"
= "process"
= "add-red-balloon"
= ["transcribe"]
[]
= [
"notify-service",
"--job", "{{job.id}}",
"--text", "{{steps.transcribe.outputs.transcript}}",
]