ByteChef LogoByteChef

Commands

Runs shell, Python or Node commands in an external task runner, outside this JVM.

Categories: Helpers, Developer Tools

Type: commands/v1


Actions

Shell

Name: shell

Runs shell commands in the selected task runner.

Properties

NameLabelTypeDescriptionRequired
commandsCommandsARRAY
Items [STRING]
The lines to run, in order. They are written into one script file and run by /bin/sh, so a variable set on one line is visible on the next. A failing line does not stop the lines after it unless the first line is set -e; the task fails when the script exits with a non-zero code. Write a JSON object to output.json in the folder named by the BYTECHEF_OUTPUT_DIR environment variable to return it as the task's vars.true
taskRunnerTask RunnerOBJECT
Properties {STRING(type), STRING(image), [STRING](entrypoint), STRING(user), NUMBER(cpu), STRING(memory), STRING(networkMode), [STRING](extraHosts), BOOLEAN(privileged), {STRING(registry), STRING(username), STRING(password), STRING(registryToken)}(credentials), STRING(killGracePeriod), STRING(pullPolicy), BOOLEAN(resume), BOOLEAN(delete), STRING(waitUntilRunning), STRING(waitUntilCompletion), STRING(interpreter), BOOLEAN(inheritEnvironment)}
Chooses where and how this task's code runs. Each runner type shows its own settings, and only the runners an operator has enabled are offered.false
envEnvironmentOBJECT
Properties {}
Environment variables the script or commands see, as name and value pairs. The host's own environment is not passed on unless the Process runner's Inherit Environment option is on, so add every variable the code needs here. ByteChef also sets BYTECHEF_WORKING_DIR (the folder the code runs in), BYTECHEF_OUTPUT_DIR, BYTECHEF_INPUT_FILE and, when the task has connections, BYTECHEF_CONNECTIONS_FILE.false
inputFilesInput FilesOBJECT
Properties {}
Files placed in the working folder (BYTECHEF_WORKING_DIR) before the code runs, keyed by file name. A name may include folders, such as data/orders.csv. A value is either inline text, written as is, or a file from an earlier step, such as another task's output file, whose content is copied in. The code reads them by name, relative to the working folder.false
outputFilesOutput FilesARRAY
Items [STRING]
Glob patterns for the files to keep from the output folder (BYTECHEF_OUTPUT_DIR) after the code finishes, such as *.csv or charts/summary.png. Each matching file is stored and returned in the task's outputFiles, keyed by its path relative to the output folder, so a later step can use it, for example task_1.outputFiles['report.csv']. Without patterns no file is kept and outputFiles is empty. Files that match no pattern are discarded, and output.json is never kept as a file because it becomes the task's vars.false
timeoutTimeout (seconds)INTEGERHow many seconds the code may run before it is stopped and the task fails. When empty, Process and GraalVM's Trusted mode stop it after 5 minutes, and container runners use Wait Until Completion. For container runners the operator's max-wait caps it.false
warnOnStdErrWarn On Standard ErrorBOOLEAN
Options true, false
Logs a warning when the code writes anything to standard error, which also comes back in the result's stderr. On by default; turn it off for tools that print progress there.false

Example JSON Structure

{
  "label" : "Shell",
  "name" : "shell",
  "parameters" : {
    "commands" : [ "" ],
    "taskRunner" : {
      "type" : "",
      "image" : "",
      "entrypoint" : [ "" ],
      "user" : "",
      "cpu" : 0.0,
      "memory" : "",
      "networkMode" : "",
      "extraHosts" : [ "" ],
      "privileged" : false,
      "credentials" : {
        "registry" : "",
        "username" : "",
        "password" : "",
        "registryToken" : ""
      },
      "killGracePeriod" : "",
      "pullPolicy" : "",
      "resume" : false,
      "delete" : false,
      "waitUntilRunning" : "",
      "waitUntilCompletion" : "",
      "interpreter" : "",
      "inheritEnvironment" : false
    },
    "env" : { },
    "inputFiles" : { },
    "outputFiles" : [ "" ],
    "timeout" : 1,
    "warnOnStdErr" : false
  },
  "type" : "commands/v1/shell"
}

Output

The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.

Python

Name: python

Runs Python commands in the selected task runner.

Properties

NameLabelTypeDescriptionRequired
commandsCommandsARRAY
Items [STRING]
The lines of a Python program, run in order as one file by python3, so indentation carries across lines. The task fails when the program exits with a non-zero code or an uncaught error. Write a JSON object to output.json in the folder named by the BYTECHEF_OUTPUT_DIR environment variable to return it as the task's vars.true
taskRunnerTask RunnerOBJECT
Properties {STRING(type), STRING(image), [STRING](entrypoint), STRING(user), NUMBER(cpu), STRING(memory), STRING(networkMode), [STRING](extraHosts), BOOLEAN(privileged), {STRING(registry), STRING(username), STRING(password), STRING(registryToken)}(credentials), STRING(killGracePeriod), STRING(pullPolicy), BOOLEAN(resume), BOOLEAN(delete), STRING(waitUntilRunning), STRING(waitUntilCompletion), STRING(interpreter), BOOLEAN(inheritEnvironment)}
Chooses where and how this task's code runs. Each runner type shows its own settings, and only the runners an operator has enabled are offered.false
envEnvironmentOBJECT
Properties {}
Environment variables the script or commands see, as name and value pairs. The host's own environment is not passed on unless the Process runner's Inherit Environment option is on, so add every variable the code needs here. ByteChef also sets BYTECHEF_WORKING_DIR (the folder the code runs in), BYTECHEF_OUTPUT_DIR, BYTECHEF_INPUT_FILE and, when the task has connections, BYTECHEF_CONNECTIONS_FILE.false
inputFilesInput FilesOBJECT
Properties {}
Files placed in the working folder (BYTECHEF_WORKING_DIR) before the code runs, keyed by file name. A name may include folders, such as data/orders.csv. A value is either inline text, written as is, or a file from an earlier step, such as another task's output file, whose content is copied in. The code reads them by name, relative to the working folder.false
outputFilesOutput FilesARRAY
Items [STRING]
Glob patterns for the files to keep from the output folder (BYTECHEF_OUTPUT_DIR) after the code finishes, such as *.csv or charts/summary.png. Each matching file is stored and returned in the task's outputFiles, keyed by its path relative to the output folder, so a later step can use it, for example task_1.outputFiles['report.csv']. Without patterns no file is kept and outputFiles is empty. Files that match no pattern are discarded, and output.json is never kept as a file because it becomes the task's vars.false
timeoutTimeout (seconds)INTEGERHow many seconds the code may run before it is stopped and the task fails. When empty, Process and GraalVM's Trusted mode stop it after 5 minutes, and container runners use Wait Until Completion. For container runners the operator's max-wait caps it.false
warnOnStdErrWarn On Standard ErrorBOOLEAN
Options true, false
Logs a warning when the code writes anything to standard error, which also comes back in the result's stderr. On by default; turn it off for tools that print progress there.false

Example JSON Structure

{
  "label" : "Python",
  "name" : "python",
  "parameters" : {
    "commands" : [ "" ],
    "taskRunner" : {
      "type" : "",
      "image" : "",
      "entrypoint" : [ "" ],
      "user" : "",
      "cpu" : 0.0,
      "memory" : "",
      "networkMode" : "",
      "extraHosts" : [ "" ],
      "privileged" : false,
      "credentials" : {
        "registry" : "",
        "username" : "",
        "password" : "",
        "registryToken" : ""
      },
      "killGracePeriod" : "",
      "pullPolicy" : "",
      "resume" : false,
      "delete" : false,
      "waitUntilRunning" : "",
      "waitUntilCompletion" : "",
      "interpreter" : "",
      "inheritEnvironment" : false
    },
    "env" : { },
    "inputFiles" : { },
    "outputFiles" : [ "" ],
    "timeout" : 1,
    "warnOnStdErr" : false
  },
  "type" : "commands/v1/python"
}

Output

The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.

Node

Name: node

Runs Node commands in the selected task runner.

Properties

NameLabelTypeDescriptionRequired
commandsCommandsARRAY
Items [STRING]
The lines of a JavaScript program, run in order as one file by node. The task fails when the program exits with a non-zero code or an uncaught error. Write a JSON object to output.json in the folder named by the BYTECHEF_OUTPUT_DIR environment variable to return it as the task's vars.true
taskRunnerTask RunnerOBJECT
Properties {STRING(type), STRING(image), [STRING](entrypoint), STRING(user), NUMBER(cpu), STRING(memory), STRING(networkMode), [STRING](extraHosts), BOOLEAN(privileged), {STRING(registry), STRING(username), STRING(password), STRING(registryToken)}(credentials), STRING(killGracePeriod), STRING(pullPolicy), BOOLEAN(resume), BOOLEAN(delete), STRING(waitUntilRunning), STRING(waitUntilCompletion), STRING(interpreter), BOOLEAN(inheritEnvironment)}
Chooses where and how this task's code runs. Each runner type shows its own settings, and only the runners an operator has enabled are offered.false
envEnvironmentOBJECT
Properties {}
Environment variables the script or commands see, as name and value pairs. The host's own environment is not passed on unless the Process runner's Inherit Environment option is on, so add every variable the code needs here. ByteChef also sets BYTECHEF_WORKING_DIR (the folder the code runs in), BYTECHEF_OUTPUT_DIR, BYTECHEF_INPUT_FILE and, when the task has connections, BYTECHEF_CONNECTIONS_FILE.false
inputFilesInput FilesOBJECT
Properties {}
Files placed in the working folder (BYTECHEF_WORKING_DIR) before the code runs, keyed by file name. A name may include folders, such as data/orders.csv. A value is either inline text, written as is, or a file from an earlier step, such as another task's output file, whose content is copied in. The code reads them by name, relative to the working folder.false
outputFilesOutput FilesARRAY
Items [STRING]
Glob patterns for the files to keep from the output folder (BYTECHEF_OUTPUT_DIR) after the code finishes, such as *.csv or charts/summary.png. Each matching file is stored and returned in the task's outputFiles, keyed by its path relative to the output folder, so a later step can use it, for example task_1.outputFiles['report.csv']. Without patterns no file is kept and outputFiles is empty. Files that match no pattern are discarded, and output.json is never kept as a file because it becomes the task's vars.false
timeoutTimeout (seconds)INTEGERHow many seconds the code may run before it is stopped and the task fails. When empty, Process and GraalVM's Trusted mode stop it after 5 minutes, and container runners use Wait Until Completion. For container runners the operator's max-wait caps it.false
warnOnStdErrWarn On Standard ErrorBOOLEAN
Options true, false
Logs a warning when the code writes anything to standard error, which also comes back in the result's stderr. On by default; turn it off for tools that print progress there.false

Example JSON Structure

{
  "label" : "Node",
  "name" : "node",
  "parameters" : {
    "commands" : [ "" ],
    "taskRunner" : {
      "type" : "",
      "image" : "",
      "entrypoint" : [ "" ],
      "user" : "",
      "cpu" : 0.0,
      "memory" : "",
      "networkMode" : "",
      "extraHosts" : [ "" ],
      "privileged" : false,
      "credentials" : {
        "registry" : "",
        "username" : "",
        "password" : "",
        "registryToken" : ""
      },
      "killGracePeriod" : "",
      "pullPolicy" : "",
      "resume" : false,
      "delete" : false,
      "waitUntilRunning" : "",
      "waitUntilCompletion" : "",
      "interpreter" : "",
      "inheritEnvironment" : false
    },
    "env" : { },
    "inputFiles" : { },
    "outputFiles" : [ "" ],
    "timeout" : 1,
    "warnOnStdErr" : false
  },
  "type" : "commands/v1/node"
}

Output

The output for this action is dynamic and may vary depending on the input parameters. To determine the exact structure of the output, you need to execute the action.


Additional Instructions

The Commands component runs a list of shell, Python or Node commands in an external task runner - a runner that executes outside this JVM, in its own process. It is the counterpart to the Script component's graalvm runner: where Script executes inline perform(input, context) source with access to context.component.*, Commands executes plain interpreter commands with none of that in-process access, and gets a plain process's environment, timeout and file handling in exchange.

The Task Runners guide covers every runner, its operator settings, the working directory contract and worked examples. For a single Bash script with structured input, the Script component's Bash action is the closer fit; it also replaces the deprecated Bash component.

Available actions

The three actions - Shell, Python and Node - differ only in the interpreter they hand the commands to; their properties are identical. Each action's commands are lines fed to that action's own interpreter - a Shell action's commands are shell lines, a Python action's commands are Python statements, a Node action's commands are JavaScript statements. They are never mixed: a Python action does not accept shell syntax, and vice versa.

Properties (for all three actions):

  • commands (array of strings, required): the lines handed to the interpreter, in order.
  • taskRunner (object, required if a runner is enabled): selects which task runner executes the commands. See below.
  • warnOnStdErr (boolean, default true): logs a warning when the execution writes to standard error. It never fails the task by itself - a non-zero exit code is what fails the task, and that happens regardless of this setting.

Depending on which task runner is selected, additional properties may appear: env (environment variables), inputFiles, outputFiles (glob patterns matched after the run), timeout (seconds), and the selected runner's own properties - the Process runner's interpreter override, or the Docker runner's image and container settings.

Task runners

Commands only offers runners that declare the Commands capability - that excludes GraalVM entirely, since GraalVM's in-process component bridge cannot run a list of shell commands. Four built-in runners declare it:

RunnerTypeWhat it does
ProcessprocessRuns the commands in a child process on the same host, with the server's own environment cleared.
DockerdockerRuns the commands in a single-use container, on the local daemon or on whichever daemon the operator's host names.
KuberneteskubernetesEnterprise. Runs the commands as a pod on the cluster the task's Kubernetes connection names.
AWS Batchaws-batchEnterprise. Runs the commands as an AWS Batch job in the account the task's AWS connection names.

All four are off until an operator turns them on with bytechef.script.runners.<type>.enabled=true - the shipped configuration enables only graalvm, which Commands never offers. So this list is what your installation may have, not what it has; it may also include a runner contributed by another module. If no runner declaring the Commands capability is enabled at all, running any of these actions fails with a message naming the configuration key to set.

Operator configuration

Every key these runners read, together, with its default:

bytechef:
  script:
    runners:
      graalvm:
        enabled: true
      process:
        enabled: false
      docker:
        enabled: false
        properties:
          host: ""
          allow-task-host: false
          allow-volume-mounts: false
      aws-batch:
        enabled: false
      kubernetes:
        enabled: false
    inject-connections: true
    runner-limits:
      max-wait: PT1H
      max-log-bytes: 1MB
      max-transfer-bytes: 512MB
    trusted:
      enabled: true

Only graalvm and trusted are enabled by the shipped configuration; process, docker, kubernetes and aws-batch need their own enabled: true before anything else under them takes effect. What each key costs to turn on:

  • trusted.enabled: lets a workflow's script task ask for mode: trusted, which drops GraalVM's guest sandbox entirely and grants the guest context full host access (HostAccess.ALL) with no resource ceilings - the same access the server process itself has. On in the shipped self-hosted configuration, which already trusts workflow authors with Java code workflows and custom components; turn it off on a multi-tenant installation.
  • process.enabled: any workflow author can run arbitrary commands on the ByteChef host as the server's user - with that user's files, credentials and network reach. Leave it off unless every workflow author is trusted with the host.
  • docker.enabled: any workflow author can choose any image, user, privileged: true and networkMode: host - effectively root on the daemon's host. Turn it on only where workflow authors are trusted with that host.
  • kubernetes.enabled: any workflow author with a Kubernetes connection can run any image on that connection's cluster, within what the connection's credentials allow. Authors choose the pod's namespace and serviceAccountName, so the pod can run in any namespace the connection can create pods in, as any service account there. ByteChef adds no limits of its own beyond runner-limits; give the connection a dedicated namespace and enforce Pod Security Admission (for example the restricted level) on it.
  • aws-batch.enabled: any workflow author with an AWS connection can run any image on that account's Batch queues, as any job and task role the connection's identity may pass. Give the connection's identity a policy scoped to the queues, bucket and roles below.
  • docker.host: points the runner at a remote Docker daemon instead of the local socket. Whoever controls that daemon controls every container this runner starts, so this is only as safe as the daemon it names.
  • docker.allow-task-host: lets a workflow name its own Docker API through the runner's host property; whoever controls that daemon controls every container it starts, so leave it off unless workflow authors are trusted with the daemons they can reach.
  • docker.allow-volume-mounts: offers the runner's volumes property; a host bind mount chosen by a workflow author is a container escape.
  • inject-connections: when true (as in the shipped application-bytechef.yml; the Java default is false), the connections a task declares are handed to external runners in a connections.json file and masked in the output; see Connections in external runners. Set it to false to deliver nothing and mask nothing.
  • runner-limits: ceilings on what a remote execution may cost this server: the longest a worker waits on one job, the most log bytes it keeps, and the most bytes it moves in or out; any runner may override them under its own properties.

Every key can also be set as an environment variable, for example BYTECHEF_SCRIPT_RUNNERS_PROCESS_ENABLED=true. Drop the dash in the aws-batch type (BYTECHEF_SCRIPT_RUNNERS_AWSBATCH_ENABLED); a dash in a property name may be written as an underscore (BYTECHEF_SCRIPT_RUNNERS_DOCKER_PROPERTIES_ALLOW_TASK_HOST).

The property list in the Properties tables above is configuration-dependent, and this page's is not necessarily yours. The taskRunner property's schema is assembled from whichever runners were enabled in the registry that generated this page, filtered to the ones declaring the Commands capability. That registry enabled process and docker, so the tables show those two runners' properties and nothing of Kubernetes or AWS Batch, which are documented by hand below. Your own deployment's editor shows the select and properties for the runners you enabled, which may add or omit entries this page shows.

Each action's default interpreter, when the Process runner's interpreter property is left blank:

ActionDefault interpreter
Shell/bin/sh
Pythonpython3
Nodenode

The Docker runner

The Docker runner is the Process runner's sibling: the same working directory, the same env, inputFiles, outputFiles and timeout handling, the same five-key result. What differs is that the interpreter is reached through a container image instead of the host's PATH, so the commands run with the host filesystem, the host's installed packages and the host's users all out of reach.

Its own properties:

PropertyWhat it does
imageThe container image the task runs in. Optional - see the defaults below.
entrypointReplaces the interpreter the source file is handed to. The source file is appended either way.
userThe user the container runs as, as a name or a numeric uid[:gid].
cpuHow many CPUs the container may use, as a decimal fraction of one CPU.
memoryHow much memory the container may use, in bytes or with a b, k, m or g suffix.
networkModebridge, none, host or a named network; left blank the daemon's default applies.
extraHostsAdditional entries for the container's hosts file, each written as host:ip.
privilegedGives the container every capability of the daemon's host.
credentialsregistry, username, password, registryToken for a private registry.
killGracePeriodHow long a still-running container is given to stop on its own when it is killed - on a timeout or a non-resumable shutdown - before it is forced, as an ISO-8601 duration. Zero (the default) forces it at once.
hostThe Docker API this task talks to; only when the operator set allow-task-host.
volumesBind mounts; only when the operator set allow-volume-mounts; each entry host-path:container-path[:ro].
pullPolicyWhen the image is pulled from its registry: ALWAYS, IF_NOT_PRESENT (default) or NEVER.
resumeAfter a server restart, re-attach to the job this task execution already started instead of starting another one. Defaults to true.
deleteRemove the job and whatever it left behind once it has finished. Turn it off to inspect a failed job by hand. Defaults to true.
waitUntilRunningHow long the job may take to be scheduled, pull its image and start, as an ISO-8601 duration. Defaults to PT10M.
waitUntilCompletionHow long the job may run before it is killed, as an ISO-8601 duration. The task's Timeout, when set, takes precedence; both are capped by the operator's max-wait. Defaults to PT1H.

Each action runs in a default image when image is left blank:

ActionDefault image
Shellubuntu:24.04
Pythonpython:3.12-slim
Nodenode:22-alpine

HOME is the working directory under both runners. Several interpreters write caches relative to it and fall over when it is unset, so the Process runner re-seeds it and the Docker runner sets it to the container's working directory rather than leaving it to the image - where it would be /root, or / for a numeric user that appears in no /etc/passwd. Without that, pip install --user under user: "1000:1000" succeeds on the Process runner and fails on the Docker runner with a permission error, for a reason that has nothing to do with the execution environment. A declared env entry named HOME still wins.

Resource limits are the workflow's own choice. cpu and memory are applied exactly as written and nothing is applied when they are blank. The operator's only ceilings are the runner-limits above, which bound what the server spends on a job, not what the container may use.

A restart does not lose a running container. Every container carries an io.bytechef.managed-by=bytechef label and an io.bytechef.task-execution-id label whose value combines the tenant, the job and the task execution (<tenant>-<job>-<task execution>), so executions of different tenants never share a key. When a task execution is redelivered - after a server restart, say - the runner finds the container that execution already started and waits for it instead of starting another (resume). With delete: false the finished container is kept, so a failed run can be inspected by hand.

Re-attaching only happens when something redelivers the task, which takes a durable message broker. With the default in-memory broker nothing is redelivered after a restart, so a graceful shutdown with resume on leaves the container behind: keep delete on, and remove leftovers by hand with docker rm -f $(docker ps -aq --filter label=io.bytechef.managed-by=bytechef). The key is unique within one ByteChef installation only, so two installations should not share one Docker daemon while resume is on.

The Kubernetes runner (Enterprise)

The Kubernetes runner is the Docker runner's sibling for clusters: the same env, inputFiles, outputFiles and timeout handling and the same five-key result, but the task runs as a single-use pod on the cluster that the task's Kubernetes connection names. It is available with bytechef.edition=ee and bytechef.script.runners.kubernetes.enabled=true.

What it needs. A kubernetes connection with the API server URL, an optional CA certificate (PEM or base64 PEM), a bearer token or a client certificate and key, a default namespace, and "Skip TLS Verification" for test clusters only. Client keys may be RSA or EC in PEM BEGIN EC PRIVATE KEY form; an EC key in PKCS#8 form (BEGIN PRIVATE KEY) is read as RSA and does not work. The task's image must provide /bin/sh.

Its own properties:

PropertyWhat it does
imageThe container image the task runs in. Optional - the defaults are the Docker runner's.
entrypointReplaces the interpreter the source file is handed to. The source file is appended either way.
namespaceThe namespace the pod runs in; defaults to the connection's namespace.
serviceAccountNameThe service account the pod runs as. Without one, no service account token is mounted into the pod.
resourcescpuRequest, cpuLimit, memoryRequest, memoryLimit, each a Kubernetes quantity such as 500m or 256Mi.
nodeSelectorNode labels the pod must match.
tolerationsTaints the pod tolerates.
labelsAdditional labels for the pod.
annotationsAdditional annotations for the pod. Keys under bytechef.io/ are reserved.
credentialsregistry, username, password for a private registry. Becomes a temporary image pull secret that is owned by the pod, so it is removed with the pod.
fileSidecarImageThe image of the file sidecar containers. Defaults to busybox:1.36; it needs sh, head, tar, test, sleep and touch.
killGracePeriodHow long a still-running pod is given to stop on its own when it is killed - on a timeout or a non-resumable shutdown - before it is forced, as an ISO-8601 duration. A finished pod is deleted at once.
pullPolicyWhen the image is pulled from its registry: ALWAYS, IF_NOT_PRESENT (default) or NEVER.
resumeAfter a server restart, re-attach to the pod this task execution already started instead of starting another one. Defaults to true.
deleteRemove the pod and its pull secret once it has finished. Turn it off to inspect a failed pod by hand. Defaults to true.
waitUntilRunningHow long the pod may take to be scheduled, pull its images and start, as an ISO-8601 duration. Defaults to PT10M.
waitUntilCompletionHow long the pod may run before it is killed, as an ISO-8601 duration. The task's Timeout, when set, takes precedence; both are capped by the operator's max-wait. Defaults to PT1H.

How a run works.

  • The pod has three containers sharing an emptyDir sized at twice max-transfer-bytes. The file sidecar (an init container) receives the inputs, main runs the task with stderr redirected to .stderr, and the output sidecar hands back output/ and .stderr before the pod completes. Inputs are sent as one archive that the file sidecar unpacks with sh -c "head -c <size> | tar -xf - -C /bytechef/work" over pods/exec, because the exec protocol cannot signal the end of its input.
  • activeDeadlineSeconds is the completion budget plus one minute, so a pod whose ByteChef worker died still stops.
  • Image pull and configuration errors fail within seconds.
  • A pod that cannot be scheduled fails after waitUntilRunning with the cluster's scheduling message.
  • OOMKilled and evictions are named in the failure.

Resume.

  • Pods carry bytechef.io/managed-by=bytechef and bytechef.io/task-execution-id (the tenant-job-task key, or a k- SHA-256 prefix when it does not fit a label value). The full key is in the annotation bytechef.io/key.
  • A redelivered task re-attaches to a pod whose inputs were delivered and whose outputs were not yet collected. Any other match is deleted and the task resubmitted.
  • The same durable-broker caveat as Docker applies. Clean up leftovers with kubectl delete pod -l bytechef.io/managed-by=bytechef and kubectl delete secret -l bytechef.io/managed-by=bytechef.
  • The key is unique within one ByteChef installation only, so two installations must not share one namespace while resume is on.

RBAC. The connection's identity needs a Role like this one:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: bytechef-task-runner
  namespace: <namespace>
rules:
  - apiGroups: [""]
    resources: ["pods"]
    verbs: ["create", "get", "list", "watch", "delete"]
  - apiGroups: [""]
    resources: ["pods/log"]
    verbs: ["get"]
  - apiGroups: [""]
    resources: ["pods/exec"]
    verbs: ["create", "get"]
  - apiGroups: [""]
    resources: ["secrets"]
    verbs: ["create", "patch", "delete"]
  - apiGroups: [""]
    resources: ["events"]
    verbs: ["list"]

Secrets are only needed when tasks use credentials; patch ties each pull secret to its pod through an owner reference, so the cluster removes the secret with the pod even when ByteChef cannot. Without events, scheduling failures are reported without the cluster's message.

The AWS Batch runner (Enterprise)

The AWS Batch runner is the Kubernetes runner's sibling for AWS: the same env, inputFiles, outputFiles and timeout handling and the same five-key result, but the task runs as an AWS Batch job in the account that the task's AWS connection names. It is available with bytechef.edition=ee and bytechef.script.runners.aws-batch.enabled=true.

What it needs.

  • An aws connection: access key ID, secret access key, region, and optionally a role ARN and external ID. With a role, its maximum session duration must cover the completion budget plus 10 minutes, at most 12 hours.
  • An ECS-backed job queue (Fargate or EC2; EKS queues are not supported).
  • A staging bucket.
  • On Fargate, an execution role. If the subnets have no NAT gateway, use public subnets with Assign Public IP, so the task can pull images and reach S3.
  • The task's image must provide /bin/sh.

Its own properties:

PropertyWhat it does
imageThe container image the task runs in. Optional - the defaults are the Docker runner's.
entrypointReplaces the interpreter the source file is handed to. The source file is appended either way.
jobQueueThe ECS-backed job queue the job is submitted to.
bucketThe staging bucket for the input and output archives.
platformFARGATE (default) or EC2.
executionRoleArnThe role Fargate uses to pull images and write logs. Required on Fargate.
taskRoleArnThe role the task itself runs as. Without one, the task has no AWS permissions.
vcpuThe task's total vCPU, sidecars included. Defaults to 1.
memoryThe task's total memory in MiB, sidecars included. Defaults to 2048.
assignPublicIpGives the Fargate task a public IP, so it can pull images and reach S3 from public subnets.
completionCheckIntervalHow often the job's status and logs are polled, as an ISO-8601 duration. Defaults to PT5S.
fileSidecarImageThe image of the file sidecar containers. Defaults to curlimages/curl:8.11.1; it needs sh, curl and tar.
pullPolicyShared with the other runners, and ignored by Batch.
resumeAfter a server restart, re-attach to the job this task execution already started instead of starting another one. Defaults to true.
deleteDeregister the job definition and delete the staged objects once the job has finished. Defaults to true.
waitUntilRunningHow long the job may stay queued, pending or starting before it fails, as an ISO-8601 duration. Defaults to PT10M.
waitUntilCompletionHow long the job may run before it is killed, as an ISO-8601 duration. The task's Timeout, when set, takes precedence; both are capped by the operator's max-wait. Defaults to PT1H.

Sizing.

  • vcpu and memory are the task's totals. The two file sidecars take 0.25 vCPU / 64 MiB each, and the task's own container gets the rest.
  • On Fargate the total must be a Fargate combination of at least 1 vCPU:
vCPUMemory (MiB)Step (MiB)
12048 to 81921024
24096 to 163841024
48192 to 307201024
816384 to 614404096
1632768 to 1228808192
  • EC2 queues are not checked beyond the sidecar minimum.

How a run works.

  • Inputs go to s3://<bucket>/bytechef/<job>/<name>-<random>/input.tar. A job definition is registered for the run, with three containers sharing an ephemeral volume:
    • the file sidecar downloads and unpacks the inputs through a presigned GET;
    • main runs the task with stderr redirected to .stderr;
    • the essential output sidecar tars output/ and .stderr and uploads them through a presigned PUT, then the job ends.
  • The presigned URLs are valid for the completion budget plus 10 minutes. They sit in the job definition's environment, readable by anyone allowed batch:DescribeJobDefinitions, and the definition is deregistered after the run.
  • The same holds for the task's env values: they are stored in the job definition, readable through batch:DescribeJobDefinitions and batch:DescribeJobs, and deregistered after the run unless the job is detached. Do not put secrets in env on this runner.
  • The job's attempt timeout is the completion budget plus one minute.
  • The result's exit code is main's, even when the job itself reports SUCCEEDED. If main succeeds but the output upload fails, the task fails.
  • A job stuck in RUNNABLE fails after waitUntilRunning with "the job queue may have no capacity".
  • Logs are tailed from CloudWatch /aws/batch/job.

Resume.

  • Jobs are named bytechef-<key> (k- plus a SHA-256 prefix when the key does not fit) and tagged bytechef.io/key.
  • A redelivered task re-attaches to the newest job with that key that has not finished.
  • The same durable-broker caveat as the other runners applies, and two installations must not share one queue with resume on.
  • Clean up leftovers by terminating jobs named bytechef-*, deregistering bytechef-* job definitions, and deleting s3://<bucket>/bytechef/.

IAM. The connection's identity needs a policy like this one:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "batch:RegisterJobDefinition", "batch:DeregisterJobDefinition", "batch:SubmitJob", "batch:DescribeJobs",
        "batch:ListJobs", "batch:TerminateJob", "batch:TagResource"
      ],
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": ["s3:PutObject", "s3:GetObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::<bucket>/bytechef/*"
    },
    {
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::<bucket>",
      "Condition": {"StringLike": {"s3:prefix": "bytechef/*"}}
    },
    {
      "Effect": "Allow",
      "Action": "logs:GetLogEvents",
      "Resource": "arn:aws:logs:*:*:log-group:/aws/batch/job:*"
    },
    {
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": ["<execution role ARN>", "<task role ARN>"]
    }
  ]
}

Without s3:ListBucket, S3 answers 403 instead of 404 for a missing object, so a run that produced no outputs would fail instead of reading as "no outputs".

Verifying it. The automated tests cover the job definition and the S3 staging (against LocalStack), but not Batch itself. Check these by hand on a real account:

  • Run a Python script and a shell command with an output file on a Fargate queue.
  • Confirm the job definition and the bytechef/ prefix are gone afterwards.
  • Confirm a stuck queue fails after waitUntilRunning.
  • Confirm an init-container failure (for example an expired input URL or an unreachable S3) ends the job promptly with a failure, instead of hanging until the job timeout.
  • Confirm a task declaring a connection finds it in the file BYTECHEF_CONNECTIONS_FILE names in main, and its value appears as ****** in the task's stdout.
  • Confirm a missing output object reads as "no outputs". This relies on the role and bucket granting s3:ListBucket; without it S3 answers 403 instead of 404.

Connections in external runners

The Process, Docker, Kubernetes and AWS Batch runners hand the connections the task declares to the execution in a JSON file, so a script or command can authenticate without the credentials being written into its source.

What is delivered. Every connection the task declares, except taskRunner, is written to connections.json in the working directory, beside the input file, as one JSON object that maps each connection's name to its parameters:

{
  "github-bot": {"accessToken": "gho_..."},
  "slack": {"token": "xoxb-..."}
}

Names and parameters keep their exact spelling, and the parameters are the same ones a GraalVM script's perform(input, connection, context) receives. BYTECHEF_CONNECTIONS_FILE holds the file's path - on Docker, Kubernetes and AWS Batch the path inside the container - and, like BYTECHEF_WORKING_DIR, BYTECHEF_INPUT_FILE and BYTECHEF_OUTPUT_DIR, the task's own env cannot override it. No parameter is ever exported as an environment variable. The file lies outside the output directory, so it is never collected into outputFiles. An input file named connections.json collides with it and fails the task.

A script on these runners reads the map through its perform; see the Script component. A command reads the file itself, for example with jq:

export AWS_ACCESS_KEY_ID="$(jq -r '.aws.accessKeyId' "$BYTECHEF_CONNECTIONS_FILE")"

Masking. Every string value of the delivered connections' parameters (nested values included), each connection's JSON form and the whole file's JSON are replaced by ****** in stdout, stderr, failure messages and the server log. Values shorter than 6 characters are not masked, and the top-level parameters named authorizationType, region, baseUri, baseUrl, url, uri, instanceUrl, endpoint, host, hostname, port and domain are delivered but never masked (the name match ignores case, _, - and .). Masking is best effort: a transformed value (base64, a substring) is not caught, and vars and outputFiles are not masked. It is applied where the captured text is read and on each logged line, and each line of a multi-line secret is masked too. Very long lines (over 8192 characters) are split before logging, so a secret crossing that split may appear in fragments in the server log.

Exposure. All parameters are delivered, including long-lived credentials such as an OAuth2 refresh_token and clientSecret. The file travels with the rest of the working directory, so it is readable wherever that directory is:

RunnerReadable by
Processthe server's OS user while the run lasts; the file is created owner-only (rw-------) where the file system supports it, and removed with the working directory
Dockeranyone who can docker exec into or docker cp from the container while it exists
Kubernetesanyone who can exec into the pod while it runs; the file sits in the pod's emptyDir, not in the pod spec
AWS Batchanyone who can read the staged input archive under the bucket's bytechef/ prefix until the run's cleanup removes it

The values no longer reach docker inspect, the Kubernetes pod spec or the AWS Batch job definition.

Snapshot. Values are read when the run starts. An OAuth access token is not refreshed during the run, so it can expire in a long one.

Operator switch. bytechef.script.inject-connections (true in the shipped configuration, application-bytechef.yml; without that file the Java default is false) turns the whole feature off when false: no file is written, BYTECHEF_CONNECTIONS_FILE is not set, a script's connection argument is an empty map, and nothing is masked.

GraalVM. Scripts on the GraalVM runner receive the same map as the connection argument of perform(input, connection, context), and can also use a connection through context.component.<component>.<action>(input, connectionName).

Workflow data reaches commands through env, not ${…}

Commands are not evaluated as workflow expressions. POSIX shell parameter expansion is written ${VAR}, which is character-for-character the workflow evaluator's own accessor syntax - if commands were evaluated the ordinary way, a line as unremarkable as echo ${GREETING:-hi} would fail the whole task with Invalid expression, naming neither this component nor the commands property, because a shell default is not a valid accessor. The same goes for ${#items[@]} and every other expansion form that is not a bare name. A bare ${HOME} fares worse rather than better: it is a valid accessor, so it would be resolved against the workflow context instead of the shell's environment. To avoid all of that, the commands property is held back from expression evaluation entirely.

Workflow data reaches a command through the env property instead, whose values are evaluated normally:

env:
  GREETING_TARGET: ${trigger.name}
commands:
  - echo "Hello, $GREETING_TARGET"

Reference an env entry the normal way for the interpreter you selected - $VAR or ${VAR} in shell, os.environ in Python, process.env in Node.

Result

Every action returns:

{
  "exitCode": 0,
  "stdout": "...",
  "stderr": "",
  "vars": {},
  "outputFiles": {}
}

vars carries whatever structured output the execution wrote, if any. Unlike the Script component's graalvm runner, Commands has no in-process runner to fall back to, so this five-key map is always the result shape - there is no bare-value variant.

stdout and stderr are truncated: each stream keeps the first half and the last half of a byte budget, and anything between them is replaced by a ... N bytes elided ... marker. The budget is 64 KiB per stream on the Process runner (32 KiB at each end), and the operator's max-log-bytes (1 MB by default) on Docker, Kubernetes and AWS Batch. Both ends are kept because the head carries what the run started doing and the tail carries how it ended. An execution that writes less than that is stored whole.

A non-zero exit code fails the task, with the tails of both streams in the error message, so a returned result always carries exitCode 0. To read structured output, write a JSON value to $BYTECHEF_OUTPUT_DIR/output.json; it comes back as vars:

commands:
  - echo "counting"
  - printf '{"files": %d}' "$(ls | wc -l)" > "$BYTECHEF_OUTPUT_DIR/output.json"

Log volume

The child's standard output and standard error are also written to the server log in full, line by line, as they arrive - stdout at INFO, stderr at WARN. That is deliberate: it is the only place the elided middle of a long stream still exists. It also means log volume is proportional to how much your commands print, without a ceiling of its own. A command that emits megabytes per run emits megabytes into the server log on every run, so keep chatty output (progress bars, per-row tracing, set -x) out of production commands or redirect it to a file the run discards.

How is this guide?

Last updated on

On this page