Execution Model
Zerq executes a workflow as a directed graph bound to a published proxy revision. Each run carries a context object, profile metadata, and request headers so downstream nodes can make deterministic decisions.
Runtime model
- Entry trigger:
http_triggersupplies gateway request fields to the graph.manual_triggeris for builder/test runs and outputstriggered_atandtrigger(manual) only. - Single run context: every node reads from and writes to the same run context.
- Deterministic order: edges define the next node; parallel branches merge only through explicit join logic.
- Branch contracts: success/error/valid/invalid branches are explicit outputs, not implied behavior.
- Policy awareness:
client,profile, andpolicydecisions happen before protected nodes execute.
Inputs that change behavior
- Selected
collectionand publishedproxyrevision. X-Client-IDandX-Profile-IDheaders used for policy/profile resolution.Authorizationcredential (JWT, token, OIDC token, or mTLS identity mapping).- Node-level timeout/retry settings and fallback outputs.
Branching and error semantics
- Validation nodes route to
validorinvalidoutputs. - Processing nodes route to
successorerroroutputs. - A step with several incoming connections runs once all of them have been followed. Connections from steps that only another trigger leads to are not counted (see Several triggers), but every other one is: a step fed by two outputs of the same step (for example both
successanderror, or two condition outputs) does not run, because only one of them is taken. Connect each output to its own step instead. - The gateway checks the request method against the proxy's allowed methods before the workflow runs. Any other method gets
405with{"error":"Method POST not allowed for this endpoint"}, the same answer as a pass-through proxy, and the workflow does not run. The check ignores case. A method blocked by the client profile also gets405({"error":"HTTP method not allowed"}) before the workflow. - Auth failures should return
401; policy denies should return403; rate controls should return429. - If the workflow itself fails (a node errors without an
errorbranch, or the definition is invalid), the caller gets500with{"error": "Workflow execution failed", "request_id": "..."}and no details. The cause is in the request's request log entry (Error, starting withworkflow failed:) and in its trace. Route expected failures toerrorbranches and aresponse_nodeto return your own status and body.
Validation steps
- Send a baseline request that should succeed for the expected
collectionandproxy. - Repeat the same request with a different
X-Profile-IDto confirm profile isolation. - Remove or alter
Authorizationand confirm the deny path returns401or403. - Burst requests to confirm throttling behavior and watch for
429when limits are exceeded. - Review request logs and audit logs to confirm actor,
client,profile, and policy decision.
Example: order lookup workflow
Scenario: proxy orders-v2 receives GET /orders/123 for partner client acme-mobile.
curl -i https://gateway.example.com/orders/123 \
-H "Authorization: Bearer $TOKEN" \
-H "X-Client-ID: acme-mobile" \
-H "X-Profile-ID: partner-prod" \
-H "Accept: application/json"
Expected behavior:
http_triggercaptures headers, path, query, and body.validate_noderoutesvalidiforderIdmatches schema.- Gateway auth/policy checks enforce
X-Client-IDandX-Profile-IDbefore proxy execution. http_request_nodeorproxy_noderuns onsuccess; failures routeerror.response_nodereturns200on success and mapped4xx/5xxon failures.
What to inspect when behavior drifts
- Wrong branch wiring (for example,
invalidconnected to success response). - Retry enabled for non-idempotent nodes, causing duplicate side effects.
- Draft workflow tested without publishing the updated
proxyrevision. - Header mismatch (
X-Profile-IDnot bound to the activecollection).