> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/dataos-resources/worker/core-concepts.md).

# Core concepts

### Replicas

`replicas` controls how many Worker instances DataOS maintains. Increase the replica count when the Worker logic can safely run in parallel.

```yaml
spec:
  replicas: 1
```

### Execution mode

`executionMode` defines how the Worker is executed by the runtime. Use `default` unless the Worker stack or platform guidance requires another mode.

```yaml
spec:
  executionMode: default
```

### Resources

Use `resources.requests` and `resources.limits` to control CPU and memory allocation for the Worker runtime.

```yaml
spec:
  resources:
    requests:
      cpu: 50m
      memory: 64Mi
    limits:
      cpu: 200m
      memory: 256Mi
```

### Stack and stackSpec

`stack` selects the runtime stack. `stackSpec` contains stack-specific configuration. For the `container` stack, provide the container image, command, and arguments.

```yaml
spec:
  stack: container
  stackSpec:
    image: docker.io/library/alpine:3.20
    command:
      - sh
    arguments:
      - -c
      - "while true; do echo heartbeat; sleep 30; done"
```

Common Worker stacks include:

* `container` for custom long-running containers
* `bento` for stream processing pipelines
* `fastfun` for sink-style background runtimes

The fields under `stackSpec` depend on the selected stack.

### Projections

Use `use.projection` when the Worker needs environment variables, Secrets, or files at runtime.

For projection syntax, template engines, data sources, and troubleshooting, see [Projections](/references/dataos-resources/secret/projections.md).

```yaml
spec:
  use:
    projection:
      projections:
        envVarsTemplate: |
          WORKER_NAME: ${{worker-name}}
          FQDN: https://${{dataos-fqdn}}
        files:
          - name: verify.py
            directory: /etc/app
            template: |
              print("verify worker")
```

### Storage

Workers can use inline disk storage or mount existing Volume Resources when a background process needs local or persistent files.

* Use `disk` when storage belongs to the Worker lifecycle.
* Use `use.volumes` when data must persist independently of the Worker.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/references/dataos-resources/worker/core-concepts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
