$npx -y skills add datarobot-oss/datarobot-agent-skills --skill datarobot-workload-apiUse when the user wants to create, configure, scale, debug, observe, or roll out container workloads on DataRobot's Workload API. Triggers include: deploying a container as a managed service, listing/starting/stopping workloads, changing replica counts or autoscaling, picking CPU
| 1 | # DataRobot Workload API |
| 2 | |
| 3 | Run container images as managed, autoscalable services on DataRobot. One skill, four jobs — pick the section by user intent: |
| 4 | |
| 5 | 1. **Create / configure / scale** — deploy a container; change replicas, resources, autoscaling, bundle; inject credentials |
| 6 | 2. **Diagnose** — workload is stuck, errored, or crash-looping |
| 7 | 3. **Observe** — logs, traces, metrics, service stats for a running workload |
| 8 | 4. **Artifact lifecycle** — iterate drafts, build images, lock for production, roll out new versions |
| 9 | |
| 10 | ## Prerequisites |
| 11 | |
| 12 | `DATAROBOT_ENDPOINT` (must end in `/api/v2`) and `DATAROBOT_API_TOKEN` must be set. Run `datarobot-setup` if not. Auth header: `Authorization: Bearer ${DATAROBOT_API_TOKEN}`. The Workload API is not in the `datarobot` Python SDK — call REST directly. |
| 13 | |
| 14 | **Transport.** Examples use Python `httpx` (`pip install httpx`). The API is plain HTTP, so equivalent calls work via `curl` or the `pulumi-datarobot` Pulumi provider declaratively. The skill teaches the model; transport is interchangeable. |
| 15 | |
| 16 | ## Bundled scripts |
| 17 | |
| 18 | Runnable Python in `scripts/` (this skill's folder). Each uses `httpx` and reads `DATAROBOT_ENDPOINT` + `DATAROBOT_API_TOKEN`: |
| 19 | |
| 20 | - `wait_for_running.py <workload_id>` — poll until `running`; exit 2 on terminal failure, 3 on timeout |
| 21 | - `diagnose_workload.py <workload_id>` — run the 5-step debug flow, print a structured diagnosis (`--json` for machine-readable) |
| 22 | - `wait_for_build.py <artifact_id> <build_id>` — poll a server-side image build; dumps last 2KB of logs on `FAILED` |
| 23 | - `wait_for_replacement.py <workload_id>` — poll a rolling replacement; handles the 404-when-cleared case |
| 24 | - `check_limits.py` — print the user's effective org-set scaling limits via `/account/info/` |
| 25 | |
| 26 | ## Deeper docs in references/ |
| 27 | |
| 28 | The SKILL.md is the operational core. Detail an agent needs occasionally lives in `references/`: |
| 29 | |
| 30 | - `references/status-vocabulary.md` — workload + proton status enums and lifecycle transitions |
| 31 | - `references/common-error-patterns.md` — `CrashLoopBackOff` / `ImagePullBackOff` / `OOMKilled` / probe failures / `exec format error` / pending pods |
| 32 | - `references/schema-reference.md` — OpenAPI schemas worth looking up, credential type → key mappings, public-spec path-key quirks |
| 33 | - `references/lifecycle-flows.md` — artifact draft → lock → production flow rules and behavioral gotchas |
| 34 | - `references/code-to-workload.md` — deploy from source code (no Dockerfile authoring): `dr` CLI commands, `codeRef`, Execution Environments, generated vs provided Dockerfile modes, iterate-rebuild loop |
| 35 | |
| 36 | ## OpenAPI spec is source of truth |
| 37 | |
| 38 | Published at `https://docs.datarobot.com/en/docs/api/reference/public-api/openapi.yaml`. **The spec is ~5 MB — never dump it whole into context.** Save once, then extract targeted slices with `yq`: |
| 39 | |
| 40 | ```bash |
| 41 | curl -sS "${DATAROBOT_ENDPOINT}/openapi.yaml" -o /tmp/wapi-spec.yaml |
| 42 | yq '.components.schemas.CreateWorkloadRequest' /tmp/wapi-spec.yaml |
| 43 | yq '.paths."/api/v2/workloads/{workload_id}/".patch' /tmp/wapi-spec.yaml |
| 44 | yq '.components.schemas | keys | .[]' /tmp/wapi-spec.yaml | grep -i workload # discover |
| 45 | ``` |
| 46 | |
| 47 | Python fallback: only `print()` the specific key, never the parsed dict. All workload paths in the public spec are keyed with `/api/v2/` prefix — see `references/schema-reference.md`. |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | # 1. Create / configure / scale |
| 52 | |
| 53 | ## Run a container as a workload (the 90% case) |
| 54 | |
| 55 | ```yaml |
| 56 | # spec.yaml — JSON also accepted; spec is sent verbatim |
| 57 | name: my-api-service |
| 58 | importance: low |
| 59 | artifact: |
| 60 | name: my-api-service-artifact |
| 61 | spec: |
| 62 | type: service |
| 63 | containerGroups: |
| 64 | - name: default |
| 65 | containers: |
| 66 | - name: main |
| 67 | imageUri: ghcr.io/org/my-app:latest |
| 68 | port: 8000 |
| 69 | primary: true |
| 70 | readinessProbe: {path: /readyz, port: 8000, initialDelaySeconds: 10} |
| 71 | livenessProbe: {path: /healthz, port: 8000, initialDelaySeconds: 30} |
| 72 | runtime: |
| 73 | containerGroups: |
| 74 | - name: default # must match artifact.spec.containerGroups[].name (above) |
| 75 | replicaCount: 1 |
| 76 | containers: |
| 77 | - name: main |
| 78 | resourceAllocation: {cpu: 1, memory: "512MB"} |
| 79 | ``` |
| 80 | |
| 81 | ```bash |
| 82 | dr workload create --spec-file spec.yaml # v0.2.74+; 4xx: 400=schema/li |