> 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/resources/worker/example.md).

# Example

End-to-end Worker examples for common deployment patterns.

Use this page for complete Worker manifests and related deployment examples.

## Sleep Worker

This example runs a minimal Alpine container as a long-running Worker. The command prints a heartbeat every 30 seconds.

```yaml
version: v2alpha
name: ${WORKER_NAME}
type: worker
tags:
  - test
  - worker
  - container
description: "Minimal long-running worker (alpine sleep loop) for poros worker-reconciler smoke test"
spec:
  compute: ${COMPUTE_NAME}
  replicas: 1
  executionMode: default
  resources:
    requests:
      cpu: 50m
      memory: 64Mi
    limits:
      cpu: 200m
      memory: 256Mi
  stack: container
  stackSpec:
    image: docker.io/library/alpine:3.20
    command:
      - sh
    arguments:
      - -c
      - "while true; do echo \"$(date -u +%FT%TZ) sleep-worker heartbeat\"; sleep 30; done"
```

## Deploy with a Bundle

For Workers that need verification or dependencies, package the resources in a Bundle so they are applied in order.

```yaml
version: v2alpha
name: test-worker-sleep
type: bundle
description: "Integration test: deploy a minimal long-running worker (container stack) and verify pod runtime is running"
tags:
  - test
  - worker
  - container
bundle:
  resources:
    - id: sleep-worker
      file: tests/worker/sleep-worker/worker.yaml

    - id: verify-sleep-worker
      file: tests/worker/sleep-worker/verify-workflow.yaml
      dependencies:
        - sleep-worker
      dependencyConditions:
        - resourceId: sleep-worker
          status:
            is:
              - active
          runtime:
            contains:
              - "running"
```

## Verify with a Workflow

A verification Workflow can fetch Worker metadata and assert that the Worker is active and running.

```python
status_obj = data.get("status") or {}
top_status = status_obj.get("aggregateStatus")
runtime_state = status_obj.get("runtimeState") or {}
runtime = runtime_state.get("status") or ""

if top_status != "active":
    errors.append(f"expected status=active, got {top_status!r}")
if "running" not in runtime:
    errors.append(f"expected 'running' in runtime, got {runtime!r}")
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://v2.dataos.info/references/resources/worker/example.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
