Skip to content

JavaScript and Python callouts

Callouts are for focused behavior that is specific to an API and does not belong in a reusable built-in policy type. Centiceps currently exposes JavaScript and Python callouts.

- callout:
name: normalize-email
lang: js
file: resources/js/normalize-email.js
bodyAccess: read
timeoutMs: 150
condition: request.method == "POST"
onError: fault

Scripts are stored under resources/ and frozen with the bundle revision. Reachability analysis includes only scripts referenced by active flows.

  • JavaScript executes through the gateway’s embedded V8 host.
  • Python executes through an optional localhost gRPC sidecar in the same gateway pod.

Python is the only extra process. If the sidecar is unavailable, only Python callout steps fail; their configured onError behavior determines whether the flow faults or continues.

Scripts interact through one object named context. The contract exposes bounded operations to:

  • read and write flow variables;
  • inspect headers;
  • read or replace the body when declared by bodyAccess;
  • terminate the flow with a response;
  • use approved helpers such as UUID generation, time, base64, and hashing.

Callouts do not receive arbitrary access to the gateway service container or control-plane data.

Value Behavior
none No body buffering; the script cannot read or replace the body.
read Buffer and expose the body read-only.
replace Buffer the body and allow replacement.

Choose the smallest access level. Body-dependent callouts are skipped for opaque streaming traffic according to the runtime streaming rules.