Factories > Managed self-hosting
Self-hosted worker reference
Look up CLI flags, YAML config fields, and telemetry variables for oz-agent-worker across Docker, Kubernetes, Direct, and Command backends.
Look up CLI flags, YAML config fields, and telemetry environment variables for the oz-agent-worker daemon’s managed backends. For installation, see Install and run the worker.
Worker flags
Section titled “Worker flags”The following flags are available when starting the worker.
Required
Section titled “Required”--worker-id— A string identifying this worker. Required via--worker-idorworker_idin the YAML config file. This is the value you pass to--hostwhen routing tasks (e.g.,prod-runner-1orci-worker). Multiple workers can share the same ID for load balancing.--api-keyorWARP_API_KEYenv var — Your self-hosted worker API key for team authentication. When running via Docker, pass it as-e WARP_API_KEY="...". When running the binary directly, use--api-keyor the environment variable. Authentication is configured via CLI flag or environment variable only and has no YAML key.
Optional
Section titled “Optional”--config-file— Path to a YAML config file. There is no automatic config-file discovery.--backend— Backend type:docker(default),kubernetes,direct, orcommand. See Managed: Kubernetes, Managed: Direct, and External orchestrators for backend-specific setup.--log-level— Log verbosity. One ofdebug,info,warn,error. Defaults toinfo. CLI-only (no YAML equivalent).--no-cleanup— Keep task containers, Kubernetes Jobs, or workspace directories after execution instead of removing them. For Direct tasks that use per-task workspaces, this also skipsteardown_command. Omitting this flag does not override YAMLcleanup: false.--target-dir— Shared working directory for all Direct backend tasks. When set, the worker does not create or remove per-task workspace directories, and disables per-task isolation and standby sandbox support. Overridesbackend.direct.target_dir.-v/--volumes— Mount host directories into task containers (Docker backend only). Format:HOST_PATH:CONTAINER_PATHorHOST_PATH:CONTAINER_PATH:MODE(where MODE isroorrw). Can be specified multiple times. Concatenates withbackend.docker.volumesfrom the config file.-e/--env— Set environment variables for tasks. Format:KEY=VALUE(explicit value) orKEY(pass through from host environment). Can be specified multiple times. Overrides same-name entries from the backend’s YAMLenvironment.--max-concurrent-tasks— Maximum number of tasks to run concurrently. Defaults to0(unlimited). Overrides YAMLmax_concurrent_tasksonly when nonzero.--max-prewarmed-sandboxes— Maximum number of standby sandboxes to hold at once. Must be non-negative. Defaults to0(shares themax_concurrent_taskslimit). Overrides YAMLmax_prewarmed_sandboxesonly when nonzero.--one-shot— Exit after one accepted task succeeds, fails, or is cancelled. Supported only by the Direct backend, forcesmax_concurrent_tasksto1, and disables standby sandboxes. Omitting this flag does not override YAMLone_shot: true.--collect-task-logsorOZ_COLLECT_TASK_LOGSenv var — Collect per-task logs when requested by the server. Defaults totrue. Set--collect-task-logs=falseorOZ_COLLECT_TASK_LOGS=falseto opt out. Precedence:--collect-task-logs>OZ_COLLECT_TASK_LOGS> YAMLcollect_task_logs.--idle-on-complete— How long to keep theozprocess alive after a task’s conversation finishes, allowing follow-up interactions via session sharing. Uses duration format (e.g.,45m,10m,0s). Defaults to45mwhen the task has noconfig.idle_timeout_minutesvalue. A task-level value takes precedence; runs created directly through the Agent API default to 10 minutes. See Configure the completion timeout.--kubernetes-qps— Kubernetes API requests per second (float32, non-negative). Defaults to0(uses the client-go default of5). Overrides YAMLbackend.kubernetes.clientConfig.QPSonly when nonzero.--kubernetes-burst— Kubernetes API request burst (int, non-negative). Defaults to0(uses the client-go default of10). Overrides YAMLbackend.kubernetes.clientConfig.burstonly when nonzero.
Worker IDs starting with warp are reserved and cannot be used. The worker refuses to start if --worker-id begins with warp.
Rootful Linux Docker example with all flags
Section titled “Rootful Linux Docker example with all flags”export DOCKER_SOCKET_GID="$(stat -c '%g' /var/run/docker.sock)"
docker run \ --group-add "$DOCKER_SOCKET_GID" \ -v /var/run/docker.sock:/var/run/docker.sock \ -e WARP_API_KEY="$WARP_API_KEY" \ warpdotdev/oz-agent-worker \ --worker-id "prod-runner-1" \ --log-level debug \ --no-cleanup \ --max-concurrent-tasks 4 \ --idle-on-complete 10m \ -v /opt/shared-cache:/cache:ro \ -e NPM_TOKEN=your_token \ -e GITHUB_TOKENConfig file
Section titled “Config file”For complex setups, use a YAML config file instead of (or in addition to) CLI flags. Pass it with --config-file:
oz-agent-worker --api-key "$WARP_API_KEY" --config-file config.yamlCLI flags generally override config file values, with these exceptions:
--max-concurrent-tasks,--max-prewarmed-sandboxes,--kubernetes-qps, and--kubernetes-burstoverride YAML only when nonzero. To replace a configured limit with0, edit the YAML file.- Omitting
--no-cleanupor--one-shotdoes not override YAMLcleanup: falseorone_shot: true. - Docker
-v/--volumesconcatenates with YAMLbackend.docker.volumesinstead of replacing it. --collect-task-logsoverridesOZ_COLLECT_TASK_LOGS, which overrides YAMLcollect_task_logs.
Unknown YAML keys are rejected, except inside the raw Kubernetes pod_template and preflight_resources blocks.
Docker backend config
Section titled “Docker backend config”worker_id: "my-worker"cleanup: truemax_concurrent_tasks: 4idle_on_complete: "10m"backend: docker: volumes: - "/data:/data:ro" - "/cache:/cache" environment: - name: NPM_TOKEN value: "your_token" - name: GITHUB_TOKEN # inherits from host environmentKubernetes backend config
Section titled “Kubernetes backend config”worker_id: "k8s-worker"max_concurrent_tasks: 4backend: kubernetes: namespace: "warp-oz" default_image: "my-registry.io/dev-image:latest" unschedulable_timeout: "2m" pod_template: nodeSelector: kubernetes.io/os: linux containers: - name: task resources: requests: cpu: "2" memory: 4Gi env: - name: GITHUB_TOKEN valueFrom: secretKeyRef: name: my-k8s-secret key: github-tokenDirect backend config
Section titled “Direct backend config”worker_id: "direct-worker"max_concurrent_tasks: 2backend: direct: workspace_root: "/var/lib/oz/workspaces" oz_path: "/usr/local/bin/oz" setup_command: "/opt/scripts/setup.sh" teardown_command: "/opt/scripts/teardown.sh" environment: - name: MY_VAR value: "hello"Command backend config
Section titled “Command backend config”worker_id: "command-worker"backend: command: dispatch_command: "python3 /opt/warp/dispatch.py" cancel_command: "python3 /opt/warp/cancel.py" dispatch_timeout: "60s" environment: - name: OZ_DISPATCH_URL value: "https://runtime.internal.example.com/agent-runs" - name: OZ_CANCEL_URL value: "https://runtime.internal.example.com/agent-runs/cancel" - name: OZ_DISPATCH_AUTH_HEADERConfig file fields
Section titled “Config file fields”Top-level:
worker_id— Worker identifier (required viaworker_idor--worker-id). Values starting withwarpare reserved.cleanup— Whether to clean up after tasks. Defaults totrue. Set tofalseto keep containers/workspaces for debugging (equivalent to--no-cleanup).max_concurrent_tasks— Maximum concurrent tasks. Defaults to0(unlimited).max_prewarmed_sandboxes— Maximum standby sandboxes to hold at once. Non-negative integer; defaults to0(sharesmax_concurrent_tasks, or unlimited when both are0). Supported by Docker, Kubernetes, and Direct (except intarget_dirorone_shotmode); unsupported by Command.one_shot— Exit after one accepted Direct backend task reaches a terminal state. Defaults tofalse, forcesmax_concurrent_tasksto1, and disables standby sandboxes.collect_task_logs— Whether to collect per-task logs when requested by the server. Defaults totrue.idle_on_complete— Duration to keep theozprocess alive after task completion (e.g.,"45m","0s"). Task-level timeout values take precedence; see Configure the completion timeout.backend— Backend configuration block. Only one backend (docker,kubernetes,direct, orcommand) may be specified.
backend.docker:
volumes— List of volume mounts (same format as-vflag). CLI-v/--volumesvalues append to this list.image_pull_policy— Pull policy for task and sidecar images. One ofAlways,Never, orIfNotPresent. Defaults toAlways. Requires worker releasev2026-08-20-16-38-31or newer.sidecar_image— Image reference for the Warp Agent sidecar mounted at/agent. It does not affect additional sidecars. Requires worker releasev2026-08-28-21-43-14or newer.sidecar_image_mappings— Map of Warp sidecar repositories (without a tag or digest) to mirrored image references, for exampledocker.io/warpdotdev/warp-claude-acp-sidecar: "registry.internal/claude-acp". Applies to every assigned sidecar. Cannot be combined withsidecar_image. See Pulling self-hosted images from a private registry.environment— List of environment variables withnameand optionalvalue. Ifvalueis omitted, the variable is inherited from the host.
backend.kubernetes:
namespace— Kubernetes namespace for task and preflight Jobs. Defaults todefault. Selects the namespace inside the chosen cluster; does not choose the cluster.kubeconfig— Path to an explicit kubeconfig file. If omitted, the worker uses in-cluster config when running inside Kubernetes, or falls back to the default kubeconfig loading rules.clientConfig.QPS— Kubernetes API requests per second (float32, non-negative).0or omitted uses the client-go default of5. Note exact key casing (clientConfig, uppercaseQPS).clientConfig.burst— Kubernetes API request burst (int, non-negative).0or omitted uses the client-go default of10. Note exact key casing (clientConfig, lowercaseburst).default_image— Default Docker image for task Jobs when the run has no Warp environment image. Precedence: Warp environment image >default_image>ubuntu:22.04. Set this to skip creating a Warp environment when all your tasks use the same base image.image_pull_policy— Pull policy for task, sidecar, and preflight images. One ofAlways,Never, orIfNotPresent. Defaults toIfNotPresent.use_image_volumes— Controls native Kubernetes image volumes for sidecar mounts. When omitted, the worker runs a startup probe Job to detect cluster and runtime support and falls back to root init containers on failure. Set totrueto require native image volumes (failing startup if the probe fails), orfalseto skip the probe and always copy sidecars with root init containers. Read-write sidecars still use root init containers even when image volumes are enabled.preflight_image— Startup preflight Job image. Defaults tobusybox:1.36. Override this if your cluster only allows pulling from an internal or allowlisted registry.preflight_timeout— Positive Go duration bounding each startup preflight wait (e.g.,"5m"). Defaults to15s. In automaticuse_image_volumesmode, the image-volume probe and any legacy fallback each get this timeout.preflight_resources— KubernetesResourceRequirements(CPU and memory requests and limits) for startup preflight containers. Defaults to requests10mCPU /16Mimemory and limits100mCPU /64Mimemory.sidecar_image— Image reference that replaces the Warp Agent sidecar mounted at/agent. Cannot be combined withsidecar_image_mappings.sidecar_image_mappings— Map of Warp sidecar repositories (without a tag or digest) to mirrored image references. Applies to every assigned sidecar. Cannot be combined withsidecar_imageorcoding_cli_sidecars. See Pulling self-hosted images from a private registry.coding_cli_sidecars— Legacy map of harness names such asclaudeorcodexto coding CLI sidecar images. A bare harness key maps both thewarp-<harness>-cli-sidecarandwarp-<harness>-acp-sidecarrepositories to that image, so the agent runs the harness over a terminal (PTY). To use the Agent Client Protocol (ACP), replace this option with explicit ACP repository keys insidecar_image_mappings, such asdocker.io/warpdotdev/warp-claude-acp-sidecar. See Images to mirror for versioned CLI-only mapping behavior.setup_command— Shell command run via/bin/sh -cin asetupinit container in/workspacebefore the task container starts. WriteKEY=VALUElines to$OZ_ENVIRONMENT_FILEto pass variables to the agent.teardown_command— Shell command run via/bin/sh -cas the task container’spreStoplifecycle hook. BecausepreStopruns on container termination, it is not a guaranteed post-success hook.extra_labels— Map of additional labels to add to task Jobs and Pods. Worker identity labels are applied last.extra_annotations— Map of additional annotations to add to task Jobs and Pods.active_deadline_seconds— Maximum task Job lifetime (KubernetesactiveDeadlineSeconds). The worker has no default; the Helm chart defaultskubernetesBackend.activeDeadlineSecondsto eight hours.ttl_seconds_after_finished— Retention period in seconds for finished Jobs left behind by the worker, including failed and orphaned Jobs. Successful Jobs are deleted immediately. Defaults to86400(24 hours); ignored whencleanup: false.workspace_size_limit— Size limit for the workspaceemptyDirvolume (e.g.,10Gi). Cannot be combined withtask_volumeorworkspace_volume.task_volume— Provisions a dedicated generic ephemeral PVC for each task pod instead of anemptyDirworkspace. Requires dynamic volume provisioning for the chosenStorageClass, and adds a rootprepare-workspaceinit container to every task pod (the namespace must admit root init containers). Cannot be combined withworkspace_size_limit. Subfields:base_size— Required positive Kubernetes quantity (e.g.,"32Gi").size_per_compute_unit— Optional non-negative Kubernetes quantity added once per compute unit of the task container. Requested disk size isbase_size + size_per_compute_unit × count, wherecountismax(ceil(CPU / 1 vCPU), ceil(memory / 2 GiB))using the task container’s resource requests (or limits where a request is absent) after run-shape overrides (for example, 8 vCPU and 32 GiB counts as 16 units).storage_class— Optional dynamically provisionedStorageClassname. Defaults to the cluster defaultStorageClass.paths— Optional list of clean, absolute, non-overlapping paths in the task container backed by the volume. Defaults to["/workspace"]and must include/workspacewhen set. Rejects/oz-task-volume(reserved) and any path that overlaps a sidecar mount.
workspace_volume— Compatibility alias fortask_volumewith the same subfields. Setting bothtask_volumeandworkspace_volumeis an error.unschedulable_timeout— How long a task Pod can stay unschedulable before the worker fails the task. Defaults to10m, which leaves time for node autoscaling. Set to0sto disable.pod_template— Raw Kubernetes PodSpec YAML merged with the worker’s required fields at runtime. Use this to configure task pod scheduling,serviceAccountName,imagePullSecrets,nodeSelector,tolerations, resources, and environment variables (includingvalueFrom.secretKeyReffor Kubernetes Secrets). Define a container namedtaskto customize the main task container directly; otherwise the worker appends its own.
backend.direct:
workspace_root— Directory where per-task workspaces are created. Defaults to/var/lib/oz/workspaces.target_dir— Shared directory used as the working directory for every task. When set, the worker does not create or remove per-task workspace directories, and disables per-task workspace isolation and standby sandbox support.oz_path— Path to the oz CLI binary. If omitted, the worker looks upozinPATH.setup_command— Shell command to run before each task. ReceivesOZ_WORKSPACE_ROOT,OZ_RUN_ID,OZ_ENVIRONMENT_FILE, andOZ_WORKER_BACKEND, each also exposed under aWARP_-prefixed alias (WARP_WORKSPACE_ROOT,WARP_RUN_ID,WARP_ENVIRONMENT_FILE,WARP_WORKER_BACKEND). For standby sandboxes, hooks receiveWARP_PREWARMED_SANDBOX_ID(noOZ_alias) instead of run ID variables.teardown_command— Shell command to run after each task completes. Receives the sameOZ_*andWARP_*variables (exceptOZ_ENVIRONMENT_FILEandWARP_ENVIRONMENT_FILE) plusGIT_CONFIG_GLOBALpointing to the task’s isolated Git config.environment— List of environment variables (same format as the Docker backend).
backend.command:
dispatch_command— Required shell command that accepts a JSON task payload on standard input and hands the task to an external runtime.cancel_command— Optional shell command invoked when a dispatched task is cancelled.dispatch_timeout— Maximum runtime for the dispatch command (Go duration, e.g.,"60s"or"2m"). Unset or non-positive values default to60s.environment— Environment variables for the dispatch and cancellation commands. Task credentials remain in the standard-input payload.
Only one backend can be configured at a time. Specifying more than one of docker, kubernetes, direct, and command in the same config file is an error.
Telemetry configuration
Section titled “Telemetry configuration”Configure OpenTelemetry metrics, tracing, and per-task log collection with environment variables on the worker process or container:
OTEL_METRICS_EXPORTER— Metrics exporter to use:prometheus,otlp,console, ornone. When unset, the worker uses the OpenTelemetry autoexport default, OTLP. Set it tononeto disable metrics initialization.OTEL_TRACES_EXPORTER— Opt-in trace exporter (for example,otlp). UnlikeOTEL_METRICS_EXPORTER, leaving this unset or settingnonedisables tracing.OTEL_EXPORTER_PROMETHEUS_HOST— Bind address for the Prometheus exporter. Defaults tolocalhost. Set to0.0.0.0when running in Docker or Kubernetes.OTEL_EXPORTER_PROMETHEUS_PORT— Port for the Prometheus exporter. Defaults to9464.OTEL_EXPORTER_OTLP_ENDPOINT— OTLP collector endpoint (e.g.,http://otel-collector.observability.svc:4318).OTEL_EXPORTER_OTLP_PROTOCOL— OTLP protocol:http/protobuf(default) orgrpc.OZ_COLLECT_TASK_LOGS— Controls server-requested per-task log collection. Defaults totrue. Set tofalseto opt out (overridden by--collect-task-logs; overrides YAMLcollect_task_logs).
When deploying with the Helm chart, use the metrics.* values and worker.collectTaskLogs instead of setting these variables manually. See Monitoring for the full setup guide, metric catalog, Helm values, and sample PromQL queries.
Routing runs to self-hosted workers
Section titled “Routing runs to self-hosted workers”Once a worker is running, route cloud agent runs to it with the --host flag or its equivalents. See Routing runs to self-hosted workers for examples across the CLI, schedules, integrations, the API, and the web UI.
Related pages
Section titled “Related pages”- Managed: Docker — Docker backend setup, connectivity, and private registries.
- Managed: Kubernetes — Kubernetes backend setup, Helm chart, pod template, and operational notes.
- Private container registry — Mirror and pull worker, task, sidecar, and preflight images from an internal registry.
- Managed: Direct — Direct backend setup and workspace model.
- External orchestrators — One-shot Direct and Command backend dispatch.
- Direct backend monorepo worktrees — Setup and teardown hooks for isolated monorepo worktrees.
- Self-hosting overview — Architecture, decision guide, and Enterprise requirements.
- Environments — Define the Docker image, repos, and setup commands used by task containers.
- Monitoring — OpenTelemetry metrics for worker health, task throughput, and capacity.
- Troubleshooting — Worker and task failure diagnostics.