README
¶
oz-agent-worker
Self-hosted worker for Oz cloud agents.
Overview
oz-agent-worker is a daemon that connects to Oz via WebSocket to receive and execute cloud agent tasks on self-hosted infrastructure.
Requirements
- Service account API key with team scope
- Network egress to warp-server
- One supported execution backend:
- Docker daemon access for the Docker backend
- Local
ozCLI access plus a writable workspace root for the Direct backend - Kubernetes API access plus cluster credentials for the Kubernetes backend
- An operator-provided dispatch command for the Command backend (dispatch to any runtime over any transport)
Usage
Docker (Recommended)
The worker needs access to the Docker daemon to spawn task containers. Mount the host's Docker socket into the container:
docker run -v /var/run/docker.sock:/var/run/docker.sock \
-e WARP_API_KEY="wk-abc123" \
warpdotdev/oz-agent-worker:<release-tag> --worker-id "my-worker"
Note: Mounting the Docker socket gives the container access to the host's Docker daemon. This is required for the worker to create and manage task containers.
Docker backend configuration
backend.docker.image_pull_policy controls how the Docker backend gets the task image and each Warp/additional sidecar image before it starts a container. The accepted values match the Kubernetes backend's image_pull_policy:
Always(the default for this backend when you omit the key): pull the image from the registry, then use the pulled image.IfNotPresent: use the image if it is already stored locally. Pull the image only when it is not present locally.Never: do not contact the registry. Use the image if it is already stored locally. If the image is not present locally, the task setup fails with a clear error.
worker_id: "my-worker"
backend:
docker:
image_pull_policy: "IfNotPresent"
This setting does not control how you get the long-running oz-agent-worker image (see Image releases and pinning). It controls only the task and sidecar images the worker uses to run tasks.
backend.docker.sidecar_image is a legacy shorthand for mapping the official
docker.io/warpdotdev/warp-agent repository to a custom image. Prefer
sidecar_image_mappings for new configurations. Do not combine the two options.
The remapping version rules apply to both forms.
worker_id: "my-worker"
backend:
docker:
sidecar_image: "my-registry.io/warpdotdev/warp-agent:latest"
Remapping sidecar images
Docker and Kubernetes both support sidecar_image_mappings under their backend
configuration. Keys are source repositories without a tag or digest; values
are destination image references. The mapping applies to every assigned sidecar:
the main agent, coding-agent CLI/ACP images, computer use, and any other additional
sidecar. It does not remap the task's base image, Kubernetes preflight image, or
service containers configured in pod_template.
worker_id: "my-worker"
backend:
docker: # Use kubernetes here for the same remapping behavior.
sidecar_image_mappings:
docker.io/warpdotdev/warp-agent: "registry.internal/warp-agent"
docker.io/warpdotdev/warp-claude-cli-sidecar: "registry.internal/claude:approved"
docker.io/warpdotdev/warp-xvfb-sidecar: "registry.internal/computer-use@sha256:<digest>"
- When the destination has no tag or digest, the assigned tag/digest is preserved:
docker.io/warpdotdev/warp-agent:v123becomesregistry.internal/warp-agent:v123. - When the destination includes a tag and/or digest, that destination version
replaces the assigned version entirely. For example, any version of the Claude
image above becomes
registry.internal/claude:approved. Replace<digest>with the full digest of your mirrored computer-use image before using this config. - Matching is by normalized repository, not prefix or pattern:
warpdotdev/warp-agentanddocker.io/warpdotdev/warp-agentidentify the same source. Duplicate normalized sources, versioned source keys and malformed references are rejected at startup. - Mappings act once on the assigned repositories. A mapped destination is not remapped again. Unmatched images and mount options are unchanged; no sidecars are injected.
- Claude Code and Codex runs driven over the Agent Client Protocol (ACP) are
assigned the harness's ACP sidecar,
docker.io/warpdotdev/warp-{harness}-acp-sidecar, pinned by digest. When a harness's CLI sidecar repository (docker.io/warpdotdev/warp-{harness}-cli-sidecar) is mapped and its ACP repository is not, the worker maps the ACP repository to the CLI destination, at the destination's pinned version orlatest. Those runs then use your mirrored CLI sidecar and drive the harness through a terminal instead of pulling the ACP sidecar from Docker Hub. To use ACP, mirror the ACP sidecar and map its repository as well. - Legacy
sidecar_imageand Kubernetescoding_cli_sidecarssettings are converted into mappings at startup.sidecar_imagemapsdocker.io/warpdotdev/warp-agent; eachcoding_cli_sidecarsharness maps bothdocker.io/warpdotdev/warp-{harness}-cli-sidecaranddocker.io/warpdotdev/warp-{harness}-acp-sidecarto its configured image. Non-emptysidecar_image_mappingscannot be combined with either legacy option. These aliases use the same version rules as explicit mappings. - Compatibility change: legacy options now match only official Warp repositories. They no longer override arbitrary source images by mount path or inject coding-CLI sidecars missing from the assignment. Use explicit mappings for non-Warp repositories; the server must assign a sidecar for it to be used.
For Helm installations, configure the equivalent
kubernetesBackend.sidecarImageMappings map in your values file.
Docker sidecar pulls use credentials from the worker's Docker configuration
(including credential helpers), just like task-image pulls. Make that
configuration available to the worker process when using private mirrors.
Kubernetes uses imagePullSecrets from backend.kubernetes.pod_template.
Operators remain responsible for mirroring the selected versions and ensuring
that pinned custom images are compatible with the server and agent.
Image releases and pinning
Production self-hosted workers should pin an immutable image version instead of relying on latest.
Each merge to main creates a GitHub release and publishes a multi-architecture Docker image with a UTC timestamp tag:
warpdotdev/oz-agent-worker:vYYYY-MM-DD-HH-MM-SS
The GitHub release body includes both the Docker tag and digest. Use either the timestamp tag or the digest in production deployments:
docker pull warpdotdev/oz-agent-worker:v2026-06-01-10-09-37
docker pull warpdotdev/oz-agent-worker@sha256:<digest>
latest is updated to the same image when a release is published, but it is a moving tag intended for quick testing only.
Direct
The direct backend executes tasks directly on the host instead of inside Docker or Kubernetes. It requires the oz CLI to be available on PATH (or configured explicitly with backend.direct.oz_path) and stores per-task workspaces under backend.direct.workspace_root (default: /var/lib/oz/workspaces).
Example config:
worker_id: "my-worker"
backend:
direct:
workspace_root: "/var/lib/oz/workspaces"
oz_path: "/usr/local/bin/oz"
The Direct backend also supports one-shot workers that accept one task and exit after that task succeeds, fails, or is cancelled:
oz-agent-worker --worker-id "my-worker" --backend direct --one-shot
The equivalent config-file setting is top-level:
worker_id: "my-worker"
one_shot: true
backend:
direct:
workspace_root: "/var/lib/oz/workspaces"
One-shot mode forces max_concurrent_tasks to 1 and permanently stops the
worker from claiming another task after its first accepted assignment. The
worker flushes queued task status messages through the WebSocket writer before
closing its connection and exiting. If no task is assigned, it remains
connected until it receives a shutdown signal. Docker, Kubernetes, and Command
backends reject one-shot mode during worker startup.
The setup_command and teardown_command hooks run via /bin/sh -c on Unix and
cmd /C on Windows (using %ComSpec%, falling back to cmd.exe). Hooks inherit
the full worker environment, overlaid with these variables, each under both
its OZ_ and its WARP_ name carrying the same value (OZ_RUN_ID and WARP_RUN_ID, and so on):
OZ_RUN_ID— the run being executed.OZ_WORKER_BACKEND— alwaysdirecthere.OZ_WORKSPACE_ROOT— the per-task workspace directory, which is also the hook's working directory.OZ_ENVIRONMENT_FILE— setup only. WriteKEY=VALUElines here to add variables to the agent's environment.
The teardown hook additionally gets GIT_CONFIG_GLOBAL, pointing at the task's isolated git config.
These names are worker-owned: the worker writes them last, so an entry with one of these names in
the backend's environment is overwritten rather than honoured.
Command
The command backend hands task execution to an operator-owned runtime over any transport. Instead of running the agent itself, the worker invokes an operator-configured dispatch_command and lets that command dispatch the task however it likes (HTTP, gRPC, a cloud SDK, a message queue, SSH, etc.).
Example config:
worker_id: "my-worker"
backend:
command:
dispatch_command: "/opt/oz/dispatch.sh"
cancel_command: "/opt/oz/cancel.sh"
dispatch_timeout: "60s"
environment:
- name: MY_RUNTIME_TOKEN
Config keys:
dispatch_command(required): shell command invoked once per task to dispatch it.cancel_command(optional): shell command invoked best-effort when a dispatched task is cancelled. If unset, the worker relies on agent-side cancellation.dispatch_timeout(optional): how long the dispatch command may run before it is considered failed (humantime format, e.g.60s). Defaults to60s.environment: extra environment variables exposed to the dispatch/cancel commands (samename/valuesemantics as the other backends; omitvalueto inherit from the host).
Both commands run via /bin/sh -c on Unix and cmd /C on Windows (using
%ComSpec%, falling back to cmd.exe). They inherit the full worker environment,
overlaid with the configured environment and worker-owned variables.
The dispatch contract:
-
The dispatch command receives the task payload as JSON on stdin. This is the only place task environment variables and secrets appear — they are deliberately kept out of the subprocess environment and argv.
-
The following variables are also set in the command's environment for convenience:
OZ_RUN_ID,OZ_EXECUTION_ID,OZ_WORKER_BACKEND=command,OZ_SERVER_ROOT_URL,OZ_DOCKER_IMAGE. Each is also set under aWARP_-prefixed alias carrying the identical value (WARP_RUN_ID,WARP_EXECUTION_ID,WARP_WORKER_BACKEND,WARP_SERVER_ROOT_URL,WARP_DOCKER_IMAGE); read whichever name you prefer. One exception to "just an alias":WARP_SERVER_ROOT_URLis also the Warp CLI's own server-root-URL override, so inside the dispatch and cancel subprocesses it points anyoz/warpinvocation at that server. The value is the same one the worker already uses, so this changes nothing in practice — but do not treat that one name as inert. -
The JSON payload looks like:
{ "version": 1, "run_id": "...", "execution_id": "...", "server_root_url": "https://app.warp.dev", "worker_id": "my-worker", "docker_image": "ubuntu:22.04", "base_args": ["agent", "run", "--task-id", "...", "--server-root-url", "..."], "env": { "GITHUB_ACCESS_TOKEN": "...", "...": "..." }, "sidecars": [ { "image": "...", "mount_path": "/agent", "read_write": false } ], "task": { "id": "...", "title": "...", "task_definition": { "prompt": "..." } } }base_argsis theoz agent run …argument vector your runtime should launch the agent with, inside an environment built fromdocker_imageandsidecars. -
Exit code
0means the task was dispatched successfully; the worker will not finalize it (the remote agent reports terminal state to Warp itself). A non-zero exit or a dispatch that exceedsdispatch_timeoutmarks the task failed. -
The cancel command (when configured) receives
OZ_RUN_ID,OZ_EXECUTION_ID, andOZ_WORKER_BACKEND=commandin its environment, each with itsWARP_-prefixed alias.
Because dispatched tasks run independently of the worker process, the command backend does not consume a local concurrency slot for the lifetime of the remote task, and worker shutdown does not cancel already-dispatched tasks.
The runtime must report completion by executing oz harness-support report-shutdown using the provided run ID.
Standby sandboxes
warp-server can ask a worker to start standby sandboxes. A standby is a sandbox that waits until warp-server assigns a run to it. The worker advertises the prewarmed-sandboxes-v1 capability when its backend supports standbys. The Docker and Kubernetes backends support standbys, and so does the Direct backend unless target_dir is set. The Command backend, one-shot mode, and the Direct backend in target_dir mode do not support standbys.
Limit the number of standbys that run at once with max_prewarmed_sandboxes (or --max-prewarmed-sandboxes):
worker_id: "my-worker"
max_prewarmed_sandboxes: 4
0(the default): standbys share themax_concurrent_taskslimit. When both limits are0, standbys are unlimited. With a finite shared limit, standbys hold slots for their entire lifetime and can cause cold task assignments to be rejected at capacity.- A value above
0: standbys use their own limit, separate frommax_concurrent_tasks.
The worker rejects a standby request when it is at its limit or when it is shutting down.
Sandbox IDs must be DNS-1123 labels of at most 50 characters: lowercase letters, digits, and internal hyphens. The worker validates IDs before reporting creation. The reported instance reference is the logical warp-prewarm-<sandbox-id> identity; Direct workspaces use separate, randomly suffixed directories.
Standbys connect to warp-server directly. Sandbox egress must allow app.warp.dev and the control host platform.warp.dev.
With the Direct backend, the setup and teardown hooks run with WARP_PREWARMED_SANDBOX_ID set to the sandbox ID. This variable has no OZ_ name. The hooks do not get any run ID variables.
On shutdown, the worker stops standbys unless the backend preserves them. The Kubernetes backend preserves standby Jobs.
Docker standby containers carry warp.prewarmed-sandbox.id and warp.worker-id labels to identify them for manual cleanup. The worker removes its current containers during normal completion and cancellation unless cleanup is disabled. It does not discover or clean up containers left by a previous worker process. After a worker crash or failed cleanup, inspect and remove leftover Docker standby containers manually.
Kubernetes
The Kubernetes backend creates one Job per task. Cluster selection is controlled by the Kubernetes client config:
backend.kubernetes.kubeconfigpoints to an explicit kubeconfig file- if
kubeconfigis omitted, the worker uses in-cluster config when running inside Kubernetes - otherwise it falls back to the default kubeconfig loading rules and uses the current context
Example config:
worker_id: "my-worker"
backend:
kubernetes:
kubeconfig: "/path/to/kubeconfig"
namespace: "agents"
default_image: "my-registry.io/dev-image:latest"
unschedulable_timeout: "2m"
preflight_timeout: "5m"
pod_template:
nodeSelector:
kubernetes.io/os: linux
containers:
- name: task
resources:
requests:
cpu: "2"
memory: 4Gi
Notes:
default_imagesets the Docker image for task Jobs when no Warp environment is configured on the run; this lets you skip creating a Warp environment entirely if all your tasks use the same base image (precedence: Warp environment image >default_image>ubuntu:22.04)namespaceselects the namespace inside the chosen cluster; it does not choose the cluster itself, and defaults todefaultwhen omittedunschedulable_timeoutcontrols the Pod-age threshold for failing an unschedulable task; it defaults to10mto allow node autoscaling, and0sdisables that fail-fast behaviorimage_pull_policydefaults toIfNotPresent- the worker owns a set of names in the task container's environment and writes them last, so an entry with one of these names in
task_envorpod_templateis overwritten rather than honoured:OZ_RUN_ID,OZ_WORKER_BACKEND,OZ_WORKSPACE_ROOT,OZ_ENVIRONMENT_FILE, and theWARP_-prefixed name of each (WARP_RUN_IDand so on). Pick different names for operator-supplied variables. Warp reserves theWARP_names against managed secrets too, but a worker's own config is yours, so nothing stops you setting them — they just will not survive sidecar_imageis a legacy shorthand for mapping the official warp-agent repository to a custom image, with the same remapping rules as Dockercoding_cli_sidecarsis a legacy shorthand mapping a harness config name (e.g.claude,codex) to a custom image for its official Warp CLI and ACP repositories. It affects only assigned sidecars; it does not inject missing sidecars or match by mount path. Neither legacy option can be combined with non-emptysidecar_image_mappings. Example:
backend:
kubernetes:
coding_cli_sidecars:
claude: "registry.internal.example.com/my-claude-wrapper:v1"
The custom image must have the harness binary reachable in the path that the Warp agent entrypoint scans (typically /usr/local/bin inside the sidecar image). claude must be in PATH when the harness process is invoked
- when
use_image_volumesis omitted, the worker probes native image-volume support with a real startup Job. A successful probe enables image volumes; any failure, including an inconclusive timeout or registry/network error, is logged and falls back to root init containers that materialize sidecars intoemptyDirvolumes - set
use_image_volumes: trueto require native image volumes and fail worker startup if the probe fails, oruse_image_volumes: falseto skip the image-volume probe and always use the legacy copy path - image-volume sidecar mounts are read-only. When image volumes are enabled, each read-only sidecar uses an image volume, while each read-write sidecar uses a root init container to copy its contents into an
emptyDir. A task can mix both paths in automatic or forced-on mode; writable sidecars still require permission to run root init containers - Kubernetes
1.35+is the recommended and tested target foruse_image_volumes: true; Kubernetes1.33-1.34may work ifImageVolumeis enabled and the container runtime supports image volumes - the worker runs short-lived startup preflight Jobs and waits for either preflight success or an early controller, mount, or admission failure. Automatic mode reuses the image-volume preflight as its capability probe and then verifies the legacy path before falling back
preflight_timeoutbounds each startup preflight wait and defaults to15swhen omitted. Set a positive Go duration such as"5m"to allow cold-node provisioning, image pulls, and mounts on autoscaled clusters. In automatic mode, the image-volume probe and any legacy fallback each get this timeout. Early failures and caller cancellation still stop the wait; task execution deadlines are unchanged. For Helm, setkubernetesBackend.preflightTimeout.preflight_imagedefaults tobusybox:1.36; set it if your cluster only allows pulling startup-preflight images from an internal or allowlisted registrypod_templateaccepts standard Kubernetes PodSpec YAML and is the declarative way to configure task pod scheduling, service accounts, image pull secrets, resources, and environment- when using
pod_template, define a container namedtaskif you want to customize the main task container directly; otherwise the worker appends its owntaskcontainer to the PodSpec - when a run's runner specifies an instance shape, the worker sets the
taskcontainer's CPU and memory requests and limits from that shape on a per-run basis, overriding any matchingresourcesset on thetaskcontainer inpod_template(other resource entries are preserved). Runs whose runner has no instance shape keep yourpod_template/cluster defaults unchanged. The Docker backend applies the same shape as container CPU/memory limits; the Direct backend runs on the host and does not enforce shapes - when a run's runner specifies an OS/architecture (sent as an OCI platform, e.g.
linux/arm64), the worker steers the task pod toward nodes with that platform. By default this is a lowest-weight preference: a cluster with no matching node still schedules the pod, and preferred node affinity frompod_templatecarries at least as much weight. When the runner marks its platformstrict, the platform becomes a requirement, and a platform no node can satisfy leaves the pod Pending, the same failure mode as an unsatisfiable instance shape (preferred vs. required node affinity onkubernetes.io/os/kubernetes.io/arch).nodeSelector/affinityfrompod_templateare preserved - by default
/workspaceis anemptyDir, which counts against the task pod's ephemeral-storage limit together with the container's writable layer and any copied sidecars;workspace_size_limitcaps thatemptyDirwithout adding space. To give each task pod a disk of its own for what the task writes, settask_volume:
backend:
kubernetes:
task_volume:
base_size: "32Gi"
size_per_compute_unit: "8Gi" # optional
storage_class: "standard-rwo" # optional; defaults to the cluster default StorageClass
paths: ["/workspace", "/home/agent", "/tmp"] # optional; defaults to ["/workspace"]
Each task pod then mounts the listed paths from a generic ephemeral volume: Kubernetes provisions a PersistentVolumeClaim with the pod and deletes it with the pod, and the volume is not charged to the pod's ephemeral storage. This is the way to get more room than a platform-imposed ephemeral-storage ceiling allows, such as the 10 GiB that GKE Autopilot allows general-purpose pods. The requested size is base_size plus size_per_compute_unit for each compute unit of the task container, where a unit is 1 vCPU or 2 GiB of memory (whichever count is larger, rounded up) taken from the run's instance shape, or from the pod_template resources when the runner has none. With the example above, a 2 vCPU / 4 GiB run gets 48Gi and an 8 vCPU / 32 GiB run gets 160Gi; omit size_per_compute_unit for one fixed size. Things to know before enabling it:
- the cluster must support dynamic provisioning for the chosen StorageClass, and the namespace needs enough PersistentVolumeClaim and storage quota for every concurrent task and standby pod
- the worker adds a root init container named
prepare-workspace(using the task image) that creates the workspace directory and makes it world-writable, so the namespace must admit root init containers - sidecars that are copied rather than mounted as image volumes are copied onto the volume too, each into a directory of its own, so they stop counting against ephemeral storage as well
pathsdefaults to/workspacealone, and a list you set must include/workspace, which starts empty and world-writable as it does on anemptyDir. The workspace is rarely the only place a task writes: package managers and compilers keep their caches under the user's home directory, and many tools use/tmp, all of which stays in the container's writable layer. Add such directories topathsto back them with the same volume. Each must be a clean absolute path that does not overlap another entry, and a task whose sidecar mounts at or under one of them is rejected. Because the mount hides the image's own directory,prepare-workspacefirst copies what the image has at each path other than/workspace, keeping its owner and mode, which lengthens startup in proportion to the amount copied; it needscp -aand astatthat accepts-cin the task image (GNU coreutils and BusyBox both provide them). A path the image does not have is created empty, owned by root with mode0755, so a non-root task user can write to it only once something running as root hands it over. The Warp agent entrypoint does that for the home directory of the user it creates, which is/home/agentunless the image defines that user differently- anything the task writes outside the listed paths still lands in the container's writable layer and counts against ephemeral storage
- the requested size covers every listed path and the copied sidecars together
- provisioning and attaching a volume adds to pod startup time; a volume that cannot be provisioned keeps the pod Pending until the task is failed by
unschedulable_timeoutor, at the latest, the Job'sactive_deadline_seconds - the volume lives as long as its pod, so failed task Jobs retained for debugging keep their volume until
ttl_seconds_after_finishedremoves them task_volumecannot be combined withworkspace_size_limit; the worker's own RBAC is unchanged, because Kubernetes creates the claim on the pod's behalfworkspace_volumeis the former name oftask_volumeand is still accepted with the same fields; setting both is an error. For Helm, the values arekubernetesBackend.taskVolume.{baseSize,storageClass,sizePerComputeUnit,paths}- to run services (databases, brokers, caches, etc.) alongside the task container, declare them in
pod_template.initContainerswithrestartPolicy: Always(native sidecar containers). Matching Kubernetes Job semantics, the worker ignores their exit codes when detecting task failure: the kubelet stops sidecars with SIGTERM after the task container finishes, so services that exit non-zero on SIGTERM (e.g. JVM-based services exiting 143) do not fail the task. Init containers withoutrestartPolicyremain run-to-completion setup steps whose non-zero exit fails the task - use
valueFrom.secretKeyRefinsidepod_templateto inject Kubernetes Secret values into task container environment variables:
pod_template:
containers:
- name: task
env:
- name: MY_SECRET
valueFrom:
secretKeyRef:
name: my-k8s-secret
key: secret-key
Helm Chart
This repo includes a namespace-scoped Helm chart at charts/oz-agent-worker.
The chart deploys:
- a long-lived
Deploymentforoz-agent-worker - a namespaced
ServiceAccount - a namespaced
Role/RoleBinding - a
ConfigMapcontaining the worker config - an optional
SecretforWARP_API_KEY(or a reference to an existingSecret)
At runtime, the deployed worker connects outbound to Warp and creates one Kubernetes Job per task. The built-in Kubernetes Job controller then manages the task Pod lifecycle.
Recommended install flow:
kubectl create secret generic oz-agent-worker \
--from-literal=WARP_API_KEY="wk-abc123" \
--namespace agents
helm install oz-agent-worker ./charts/oz-agent-worker \
--namespace agents \
--create-namespace \
--set worker.workerId=my-worker \
--set image.tag=v2026-06-01-10-09-37
The chart assumes the worker runs inside the target cluster and uses in-cluster Kubernetes auth by default. It does not create CRDs or cluster-scoped RBAC. Set image.tag explicitly for each install so the worker image is pinned instead of defaulting to latest.
The chart always deploys a single replica for a given worker.workerId. If you want multiple workers, deploy multiple releases with distinct worker IDs rather than scaling one release horizontally.
The chart defaults the long-lived worker Deployment to a non-root security context and conservative starting resource requests of 100m CPU and 128Mi memory. Tune worker.resources for your workload and cluster policy.
The Deployment includes a default exec liveness probe that checks the worker process is still running (kill -0 1). If the worker becomes unresponsive, Kubernetes will restart the pod after three consecutive failures. Override worker.livenessProbe in your values to use a custom probe (e.g. httpGet if you add a health endpoint), or set it to null to disable.
When the long-lived worker pod is terminated by normal Kubernetes disruption
(for example Karpenter node consolidation), the Kubernetes backend preserves
active task Jobs instead of deleting them during worker shutdown. This protects
running Oz sessions from worker pod rotation as long as the task Job and task Pod
remain healthy. The default worker.terminationGracePeriodSeconds only needs to
cover WebSocket close and metrics flush.
This does not make task Pods disruption-proof. If Karpenter or another cluster operation evicts the node that is actually running the task Pod, the live Oz session can still be interrupted because the process and any pod-local workspace state are on that task Pod. For stronger protection, schedule worker pods and task pods independently (for example with separate node pools, selectors, tolerations, or disruption budgets) so worker rotation does not imply task pod eviction.
cleanup controls retention of finished task resources:
true: delete successful Jobs immediately; retain failed Jobs until their configured TTL expires (kubernetesBackend.ttlSecondsAfterFinished, default 24h). The TTL also removes Jobs that finish after worker disruption.false: retain finished Jobs and Pods indefinitely, with no TTL.
On task failure, the worker retains stopped executions for debugging. If execution is still possible or unknown, it expires the Job instead of deleting it. Kubernetes stops active Pods and marks the Job failed; the Job keeps its existing TTL policy. Expiration can delete active Pods, so available diagnostics are captured first. Unsuccessful expiration is reported and may require intervention. Explicit cancellation still deletes Jobs; worker shutdown preserves active Jobs.
Transient Kubernetes API observation errors are retried with bounded backoff.
Recommended namespace-scoped permissions for the worker are:
- create, get, list, watch, patch, delete
jobs - get, list, watch
pods - get
pods/log - list
events
When upgrading an existing installation, update its Role to grant patch on Jobs
before deploying the worker; this permission is required to expire abandoned Jobs.
The worker Deployment's ServiceAccount is separate from the task Job serviceAccountName you may set inside backend.kubernetes.pod_template / kubernetesBackend.podTemplate. The worker Deployment defaults to non-root. The chart leaves kubernetesBackend.useImageVolumes unset so the worker automatically enables image volumes when its real startup Job succeeds and otherwise falls back to root init containers, including when the probe is inconclusive. Set the value to true to require image-volume support or false to always use the legacy copy path. When image volumes are enabled, read-only sidecars use image volumes and read-write sidecars still use root init containers, including in forced-on mode. Kubernetes 1.35+ is the recommended and tested target, while Kubernetes 1.33-1.34 may work if ImageVolume is enabled and the container runtime supports image volumes. If your cluster restricts image sources for admission or policy reasons, set kubernetesBackend.preflightImage in the chart to an allowlisted image for the startup preflight Job, and configure task imagePullSecrets inside podTemplate when needed.
Go Install
go install github.com/warpdotdev/oz-agent-worker@latest
oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker"
Build from Source
git clone https://github.com/warpdotdev/oz-agent-worker.git
cd oz-agent-worker
go build -o oz-agent-worker
./oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker"
Environment Variables for Task Containers
Use -e / --env to pass environment variables into task containers:
# Explicit key=value
oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker" -e MY_SECRET=hunter2
# Pass through from host environment
export MY_SECRET=hunter2
oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker" -e MY_SECRET
# Multiple variables
oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker" -e FOO=bar -e BAZ=qux
When using Docker to run the worker, note that -e flags for the worker itself (task containers) are passed as arguments, while -e flags for the worker container use Docker's syntax:
docker run -v /var/run/docker.sock:/var/run/docker.sock \
-e WARP_API_KEY="wk-abc123" \
warpdotdev/oz-agent-worker:<release-tag> --worker-id "my-worker" -e MY_SECRET=hunter2
When configuring the Kubernetes backend via YAML or Helm, declarative task-container env belongs in backend.kubernetes.pod_template / kubernetesBackend.podTemplate rather than a separate top-level Kubernetes env list. The -e / --env flags remain available as backend-agnostic runtime overrides.
Docker Connectivity
The worker automatically discovers the Docker daemon using standard Docker client mechanisms, in this order:
DOCKER_HOSTenvironment variable (e.g.,unix:///var/run/docker.sock,tcp://localhost:2375)- Default socket location (
/var/run/docker.sockon Linux,~/.docker/run/docker.sockfor rootless) - Docker context via
DOCKER_CONTEXTenvironment variable - Config file (
~/.docker/config.json) for context settings
Additional supported environment variables:
DOCKER_API_VERSION- Specify Docker API versionDOCKER_CERT_PATH- Path to TLS certificatesDOCKER_TLS_VERIFY- Enable TLS verification
Example: Remote Docker Daemon
export DOCKER_HOST="tcp://remote-host:2376"
export DOCKER_TLS_VERIFY=1
export DOCKER_CERT_PATH="/path/to/certs"
oz-agent-worker --api-key "wk-abc123" --worker-id "my-worker"
Monitoring
Per-task logs
When a task assignment enables telemetry_collection.logging_enabled, the worker
sends task-scoped worker logs, setup phase events, and task stdout/stderr to the
assigned OTLP/HTTP collector. This includes Docker task output, Kubernetes
task-pod output (including init containers), and Direct agent and hook output.
The Command backend collects dispatch-command output, not remote-runtime output.
Collection is enabled by default when requested by the server. To opt out, use one of these installation settings:
- YAML: top-level
collect_task_logs: false - CLI:
--collect-task-logs=false - Environment:
OZ_COLLECT_TASK_LOGS=false - Helm:
--set worker.collectTaskLogs=false
CLI overrides environment, which overrides YAML. Disabling task logs does not disable metrics, tracing, or setup client-events reporting. Task logging works independently of tracing.
Delivery is best-effort: overload, oversized output, or collector failures can drop logs without failing or blocking tasks. Interrupted Kubernetes log streams are not reconnected. Collection does not resume for preserved tasks after a worker restart.
Docker output records carry container.name (the Docker name without its leading
slash) and log.iostream (stdout or stderr). Kubernetes records carry
k8s.container.name and k8s.pod.name, including init containers. Direct, command,
hook, and worker logs do not carry container attributes.
Before export, the worker redacts known secret environment values supplied to the task
or its hooks. Local stdout/stderr is not scrubbed. Secrets created inside tasks
or resolved through Kubernetes valueFrom/envFrom are not known to the worker
and cannot be redacted. Setup hooks must write generated credentials to the
environment file, not stdout/stderr; those values are only protected in output
collected after the file is parsed.
Worker metrics and tracing
The worker can export metrics over OpenTelemetry. Exporter selection is
driven by the standard
OpenTelemetry environment variables,
implemented via
go.opentelemetry.io/contrib/exporters/autoexport.
When OTEL_METRICS_EXPORTER is unset, the worker delegates to autoexport's
default, which is OTLP push to OTEL_EXPORTER_OTLP_ENDPOINT (defaulting to
http://localhost:4318 for http/protobuf or http://localhost:4317 for
grpc). To fully disable metrics export, set OTEL_METRICS_EXPORTER=none.
Quick start with Prometheus
export OTEL_METRICS_EXPORTER=prometheus
export OTEL_EXPORTER_PROMETHEUS_HOST=0.0.0.0
export OTEL_EXPORTER_PROMETHEUS_PORT=9464
oz-agent-worker --api-key "$WARP_API_KEY" --worker-id "my-worker"
# In another shell:
curl -s localhost:9464/metrics | grep oz_worker_
Quick start with OTLP
export OTEL_METRICS_EXPORTER=otlp
export OTEL_TRACES_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector.observability.svc:4318
oz-agent-worker --api-key "$WARP_API_KEY" --worker-id "my-worker"
Tracing is opt-in. Set OTEL_TRACES_EXPORTER to a non-none exporter such as
otlp to emit per-task spans and lifecycle events; leave it unset to export
metrics only.
Helm
helm install oz-agent-worker ./charts/oz-agent-worker \
--namespace agents --create-namespace \
--set worker.workerId=my-worker \
--set image.tag=v2026-06-01-10-09-37 \
--set metrics.enabled=true
With metrics.enabled=true and the default metrics.exporter=prometheus, the
chart adds:
- a
containerPort: metrics(default 9464) on the worker Deployment - the
OTEL_METRICS_EXPORTER,OTEL_EXPORTER_PROMETHEUS_HOST, andOTEL_EXPORTER_PROMETHEUS_PORTenvironment variables - a namespace-scoped
Servicenamed<release>-oz-agent-worker-metricswithprometheus.io/scrapeannotations - optionally a
PodMonitor(metrics.podMonitor.create=true) for clusters using the Prometheus Operator
For OTLP push instead, set metrics.exporter=otlp and forward the relevant
endpoint variables via metrics.extraEnv:
metrics:
enabled: true
exporter: otlp
extraEnv:
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://otel-collector.observability.svc:4318
Metric catalog
All metrics carry the resource attributes service.name=oz-agent-worker,
service.version, worker.id, and worker.backend, so each worker process
shows up as a distinct series.
oz_worker_connected(gauge):1while the worker has an active WebSocket connection to warp-server,0otherwise. Aggregate to count connected workers:sum(oz_worker_connected).oz_worker_tasks_active(gauge / UpDownCounter): tasks currently executing on this worker. To count workers running ≥1 task:count(oz_worker_tasks_active > 0).oz_worker_tasks_max_concurrent(gauge): configured concurrency limit (0means unlimited).oz_worker_tasks_rejected_total{reason}(counter): tasks the worker declined, e.g.reason="at_capacity".oz_worker_tasks_completed_total{result}(counter): completed tasks labeledresult="succeeded",result="failed", orresult="cancelled". Success rate over 5m:sum(rate(oz_worker_tasks_completed_total{result="succeeded"}[5m])) / sum(rate(oz_worker_tasks_completed_total[5m])).oz_worker_task_duration_seconds{result}(histogram): wall-clock task duration on the worker. p95:histogram_quantile(0.95, sum by (le) (rate(oz_worker_task_duration_seconds_bucket[5m]))).oz_worker_task_failures_total{phase,reason}(counter): bounded failure classification for task failures, such asphase="backend"withreason="image_pull",reason="unschedulable", orreason="container_oom".oz_worker_websocket_reconnects_total{reason}(counter): reconnect attempts; spikes indicate flapping workers.oz_worker_info{version,backend,worker_id}(gauge, value1): build and runtime metadata, useful for joining other series by labels.
Sample dashboards / alerts
Direct mappings for the questions enterprise operators most commonly ask:
- Workers available:
sum(oz_worker_connected) - Workers active (running ≥1 task):
count(oz_worker_tasks_active > 0) - Saturation:
sum(oz_worker_tasks_active) / sum(oz_worker_tasks_max_concurrent > 0) - Failure rate:
sum(rate(oz_worker_tasks_completed_total{result="failed"}[5m])) - Failure modes:
sum by (phase, reason) (rate(oz_worker_task_failures_total[5m])) - Reconnect storms:
sum(rate(oz_worker_websocket_reconnects_total[5m])) > 0.1
License
Copyright © 2026 Warp
Documentation
¶
There is no documentation for this package.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
command-backend
Package commandbackendexample holds reference dispatch commands for the oz-agent-worker "command" backend.
|
Package commandbackendexample holds reference dispatch commands for the oz-agent-worker "command" backend. |
|
internal
|
|
|
metrics
Package metrics owns the OpenTelemetry metrics pipeline for the worker.
|
Package metrics owns the OpenTelemetry metrics pipeline for the worker. |