Skip to content

datarobot_genai.drtools.core.clients.datarobot_workload

datarobot_workload

WorkloadApiClient

Workload API methods backed by the per-request DataRobot REST client.

Each call runs inside :func:request_user_dr_client so credentials come from the requesting user's headers::

client = WorkloadApiClient()
result = client.list_workloads(limit=50)
Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
class WorkloadApiClient:
    """Workload API methods backed by the per-request DataRobot REST client.

    Each call runs inside :func:`request_user_dr_client` so credentials come from
    the requesting user's headers::

        client = WorkloadApiClient()
        result = client.list_workloads(limit=50)
    """

    # ------------------------------------------------------------------ #
    # Workloads — read                                                     #
    # ------------------------------------------------------------------ #

    def list_workloads(
        self,
        *,
        limit: int = 100,
        offset: int = 0,
        search: str | None = None,
    ) -> dict[str, Any]:
        """GET /workloads/ with optional server-side search and pagination."""
        params: dict[str, Any] = {"limit": limit, "offset": offset}
        if search:
            params["search"] = search
        with request_user_dr_client() as client:
            return client.get("workloads/", params=params).json()

    def get_workload(self, workload_id: str) -> dict[str, Any]:
        """GET /workloads/{workload_id}."""
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}").json()

    # ------------------------------------------------------------------ #
    # Compute bundles                                                      #
    # ------------------------------------------------------------------ #

    def list_bundles(self) -> dict[str, Any]:
        """GET /mlops/compute/bundles — available CPU/GPU resource bundles."""
        with request_user_dr_client() as client:
            return client.get("mlops/compute/bundles").json()

    # ------------------------------------------------------------------ #
    # Workloads — write                                                    #
    # ------------------------------------------------------------------ #

    def create_workload(self, payload: dict[str, Any]) -> dict[str, Any]:
        """POST /workloads/ — returns the created WorkloadFormatted (201)."""
        with request_user_dr_client() as client:
            return client.post("workloads/", json=payload).json()

    def start_workload(self, workload_id: str) -> dict[str, Any]:
        """POST /workloads/{id}/start — returns WorkloadOperationResponse (202)."""
        with request_user_dr_client() as client:
            resp = client.post(f"workloads/{workload_id}/start")
            return resp.json() if resp.content else {}

    def stop_workload(self, workload_id: str) -> dict[str, Any]:
        """POST /workloads/{id}/stop — returns WorkloadOperationResponse (202)."""
        with request_user_dr_client() as client:
            resp = client.post(f"workloads/{workload_id}/stop")
            return resp.json() if resp.content else {}

    def delete_workload(self, workload_id: str) -> None:
        """DELETE /workloads/{id} — 204 No Content on success."""
        with request_user_dr_client() as client:
            client.delete(f"workloads/{workload_id}")

    def patch_workload(self, workload_id: str, payload: dict[str, Any]) -> dict[str, Any]:
        """PATCH /workloads/{id} — partial update of name / description / importance."""
        with request_user_dr_client() as client:
            return client.patch(f"workloads/{workload_id}", json=payload).json()

    # ------------------------------------------------------------------ #
    # Workloads — settings                                                 #
    # ------------------------------------------------------------------ #

    def get_workload_settings(self, workload_id: str) -> dict[str, Any]:
        """GET /workloads/{id}/settings — returns WorkloadSettingsResponse."""
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}/settings").json()

    def update_workload_settings(self, workload_id: str, runtime: dict[str, Any]) -> dict[str, Any]:
        """PATCH /workloads/{id}/settings — triggers rolling replacement (202)."""
        with request_user_dr_client() as client:
            return client.patch(
                f"workloads/{workload_id}/settings", json={"runtime": runtime}
            ).json()

    # ------------------------------------------------------------------ #
    # Workloads — observability                                            #
    # ------------------------------------------------------------------ #

    def get_workload_stats(
        self,
        workload_id: str,
        *,
        proton_id: str | None = None,
        start_time: str | None = None,
        end_time: str | None = None,
        response_time_quantile: float = 0.5,
        slow_requests_threshold: int = 2000,
    ) -> dict[str, Any]:
        """GET /workloads/{id}/stats — aggregated performance statistics."""
        params: dict[str, Any] = {
            "responseTimeQuantile": response_time_quantile,
            "slowRequestsThreshold": slow_requests_threshold,
        }
        if proton_id:
            params["protonId"] = proton_id
        if start_time:
            params["startTime"] = start_time
        if end_time:
            params["endTime"] = end_time
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}/stats", params=params).json()

    def list_workload_history(
        self, workload_id: str, *, limit: int = 10, offset: int = 0
    ) -> dict[str, Any]:
        """GET /workloads/{id}/history — artifact deployment history."""
        with request_user_dr_client() as client:
            return client.get(
                f"workloads/{workload_id}/history",
                params={"limit": limit, "offset": offset},
            ).json()

    def list_workload_events(
        self, workload_id: str, *, limit: int = 10, offset: int = 0
    ) -> dict[str, Any]:
        """GET /workloads/{id}/events — status-change and error events."""
        with request_user_dr_client() as client:
            return client.get(
                f"workloads/{workload_id}/events",
                params={"limit": limit, "offset": offset},
            ).json()

    def promote_workload_artifact(self, workload_id: str) -> dict[str, Any]:
        """POST /workloads/{id}/promote — lock the running draft artifact (202)."""
        with request_user_dr_client() as client:
            resp = client.post(f"workloads/{workload_id}/promote")
            return resp.json() if resp.content else {}

    def get_workload_related(self, workload_id: str) -> dict[str, Any]:
        """GET /workloads/{id}/related — linked artifacts and related entities."""
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}/related").json()

    # ------------------------------------------------------------------ #
    # Protons                                                              #
    # ------------------------------------------------------------------ #

    def list_protons(self, workload_id: str, *, limit: int = 10, offset: int = 0) -> dict[str, Any]:
        """GET /workloads/{id}/protons — deployed proton instances for a workload."""
        with request_user_dr_client() as client:
            return client.get(
                f"workloads/{workload_id}/protons",
                params={"limit": limit, "offset": offset},
            ).json()

    def get_proton(self, workload_id: str, proton_id: str) -> dict[str, Any]:
        """GET /workloads/{id}/protons/{proton_id} — single proton record."""
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}/protons/{proton_id}").json()

    def get_proton_status_details(self, workload_id: str, proton_id: str) -> dict[str, Any] | None:
        """GET /workloads/{id}/protons/{proton_id}/statusDetails.

        Returns the ReplicaStatusesSnapshot when available (200), or
        ``None`` when no status has been received yet (204).
        """
        with request_user_dr_client() as client:
            resp = client.get(f"workloads/{workload_id}/protons/{proton_id}/statusDetails")
            return resp.json() if resp.content else None

    # ------------------------------------------------------------------ #
    # OTel logs                                                            #
    # ------------------------------------------------------------------ #

    def list_workload_logs(
        self,
        workload_id: str,
        *,
        limit: int = 100,
        offset: int = 0,
        level: str = "debug",
        start_time: str | None = None,
        end_time: str | None = None,
        includes: list[str] | None = None,
        excludes: list[str] | None = None,
        span_id: str | None = None,
        trace_id: str | None = None,
    ) -> dict[str, Any]:
        """GET /otel/workload/{id}/logs/ — OTel log lines for a workload."""
        params: dict[str, Any] = {"limit": limit, "offset": offset, "level": level}
        if start_time:
            params["startTime"] = start_time
        if end_time:
            params["endTime"] = end_time
        if includes:
            params["includes"] = includes
        if excludes:
            params["excludes"] = excludes
        if span_id:
            params["spanId"] = span_id
        if trace_id:
            params["traceId"] = trace_id
        with request_user_dr_client() as client:
            return client.get(f"otel/workload/{workload_id}/logs/", params=params).json()

    # ------------------------------------------------------------------ #
    # Artifacts                                                            #
    # ------------------------------------------------------------------ #

    def list_artifacts(
        self,
        *,
        limit: int = 100,
        offset: int = 0,
        search: str | None = None,
        status: str | None = None,
        artifact_type: str | None = None,
        repository_id: str | None = None,
    ) -> dict[str, Any]:
        """GET /artifacts/ with optional filters and pagination."""
        params: dict[str, Any] = {"limit": limit, "offset": offset}
        if search:
            params["search"] = search
        if status:
            params["status"] = status
        if artifact_type:
            params["type"] = artifact_type
        if repository_id:
            params["repositoryId"] = repository_id
        with request_user_dr_client() as client:
            return client.get("artifacts/", params=params).json()

    def get_artifact(self, artifact_id: str) -> dict[str, Any]:
        """GET /artifacts/{id}."""
        with request_user_dr_client() as client:
            return client.get(f"artifacts/{artifact_id}").json()

    def create_artifact(self, payload: dict[str, Any]) -> dict[str, Any]:
        """POST /artifacts/ — returns the created ArtifactFormatted (201)."""
        with request_user_dr_client() as client:
            return client.post("artifacts/", json=payload).json()

    def put_artifact(self, artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]:
        """PUT /artifacts/{id} — full replacement with InputArtifact payload."""
        with request_user_dr_client() as client:
            return client.put(f"artifacts/{artifact_id}", json=payload).json()

    def patch_artifact(self, artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]:
        """PATCH /artifacts/{id} — partial update via UpdateArtifactRequest."""
        with request_user_dr_client() as client:
            return client.patch(f"artifacts/{artifact_id}", json=payload).json()

    def delete_artifact(self, artifact_id: str) -> None:
        """DELETE /artifacts/{id} — 204 No Content on success."""
        with request_user_dr_client() as client:
            client.delete(f"artifacts/{artifact_id}")

    def clone_artifact(self, artifact_id: str, name: str) -> dict[str, Any]:
        """POST /artifacts/{id}/clone — duplicate with a new name."""
        with request_user_dr_client() as client:
            return client.post(f"artifacts/{artifact_id}/clone", json={"name": name}).json()

    # ------------------------------------------------------------------ #
    # Artifact builds                                                      #
    # ------------------------------------------------------------------ #

    def list_artifact_builds(
        self,
        artifact_id: str,
        *,
        limit: int = 100,
        offset: int = 0,
    ) -> dict[str, Any]:
        """GET /artifacts/{id}/builds."""
        params: dict[str, Any] = {"limit": limit, "offset": offset}
        with request_user_dr_client() as client:
            return client.get(f"artifacts/{artifact_id}/builds", params=params).json()

    def trigger_artifact_build(self, artifact_id: str) -> dict[str, Any]:
        """POST /artifacts/{id}/builds — start image build(s) for a draft service artifact."""
        with request_user_dr_client() as client:
            return client.post(f"artifacts/{artifact_id}/builds").json()

    def get_artifact_build(self, artifact_id: str, build_id: str) -> dict[str, Any]:
        """GET /artifacts/{id}/builds/{build_id}."""
        with request_user_dr_client() as client:
            return client.get(f"artifacts/{artifact_id}/builds/{build_id}").json()

    def get_artifact_build_logs(self, artifact_id: str, build_id: str) -> str:
        """GET /artifacts/{id}/builds/{build_id}/logs — returns raw log text."""
        with request_user_dr_client() as client:
            return client.get(f"artifacts/{artifact_id}/builds/{build_id}/logs").text

    def delete_artifact_build(self, artifact_id: str, build_id: str) -> None:
        """DELETE /artifacts/{id}/builds/{build_id} — cancel or delete a build (204)."""
        with request_user_dr_client() as client:
            client.delete(f"artifacts/{artifact_id}/builds/{build_id}")

    # ------------------------------------------------------------------ #
    # Artifact repositories                                                #
    # ------------------------------------------------------------------ #

    def list_artifact_repositories(
        self,
        *,
        limit: int = 100,
        offset: int = 0,
        search: str | None = None,
        artifact_type: str | None = None,
    ) -> dict[str, Any]:
        """GET /artifactRepositories."""
        params: dict[str, Any] = {"limit": limit, "offset": offset}
        if search:
            params["search"] = search
        if artifact_type:
            params["type"] = artifact_type
        with request_user_dr_client() as client:
            return client.get("artifactRepositories", params=params).json()

    def get_artifact_repository(self, repository_id: str) -> dict[str, Any]:
        """GET /artifactRepositories/{id}."""
        with request_user_dr_client() as client:
            return client.get(f"artifactRepositories/{repository_id}").json()

    def delete_artifact_repository(self, repository_id: str) -> None:
        """DELETE /artifactRepositories/{id} — 204 No Content on success."""
        with request_user_dr_client() as client:
            client.delete(f"artifactRepositories/{repository_id}")

    # ------------------------------------------------------------------ #
    # Workload replacement (rolling update)                                #
    # ------------------------------------------------------------------ #

    def get_workload_replacement(self, workload_id: str) -> dict[str, Any]:
        """GET /workloads/{id}/replacement — current replacement status."""
        with request_user_dr_client() as client:
            return client.get(f"workloads/{workload_id}/replacement").json()

    def create_workload_replacement(
        self, workload_id: str, payload: dict[str, Any]
    ) -> dict[str, Any]:
        """POST /workloads/{id}/replacement — start a rolling replacement (202)."""
        with request_user_dr_client() as client:
            resp = client.post(f"workloads/{workload_id}/replacement", json=payload)
            return resp.json() if resp.content else {}

    def delete_workload_replacement(self, workload_id: str) -> dict[str, Any]:
        """DELETE /workloads/{id}/replacement — cancel an in-progress replacement (202)."""
        with request_user_dr_client() as client:
            resp = client.delete(f"workloads/{workload_id}/replacement")
            return resp.json() if resp.content else {}

list_workloads

list_workloads(*, limit: int = 100, offset: int = 0, search: str | None = None) -> dict[str, Any]

GET /workloads/ with optional server-side search and pagination.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_workloads(
    self,
    *,
    limit: int = 100,
    offset: int = 0,
    search: str | None = None,
) -> dict[str, Any]:
    """GET /workloads/ with optional server-side search and pagination."""
    params: dict[str, Any] = {"limit": limit, "offset": offset}
    if search:
        params["search"] = search
    with request_user_dr_client() as client:
        return client.get("workloads/", params=params).json()

get_workload

get_workload(workload_id: str) -> dict[str, Any]

GET /workloads/{workload_id}.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_workload(self, workload_id: str) -> dict[str, Any]:
    """GET /workloads/{workload_id}."""
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}").json()

list_bundles

list_bundles() -> dict[str, Any]

GET /mlops/compute/bundles — available CPU/GPU resource bundles.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_bundles(self) -> dict[str, Any]:
    """GET /mlops/compute/bundles — available CPU/GPU resource bundles."""
    with request_user_dr_client() as client:
        return client.get("mlops/compute/bundles").json()

create_workload

create_workload(payload: dict[str, Any]) -> dict[str, Any]

POST /workloads/ — returns the created WorkloadFormatted (201).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def create_workload(self, payload: dict[str, Any]) -> dict[str, Any]:
    """POST /workloads/ — returns the created WorkloadFormatted (201)."""
    with request_user_dr_client() as client:
        return client.post("workloads/", json=payload).json()

start_workload

start_workload(workload_id: str) -> dict[str, Any]

POST /workloads/{id}/start — returns WorkloadOperationResponse (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def start_workload(self, workload_id: str) -> dict[str, Any]:
    """POST /workloads/{id}/start — returns WorkloadOperationResponse (202)."""
    with request_user_dr_client() as client:
        resp = client.post(f"workloads/{workload_id}/start")
        return resp.json() if resp.content else {}

stop_workload

stop_workload(workload_id: str) -> dict[str, Any]

POST /workloads/{id}/stop — returns WorkloadOperationResponse (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def stop_workload(self, workload_id: str) -> dict[str, Any]:
    """POST /workloads/{id}/stop — returns WorkloadOperationResponse (202)."""
    with request_user_dr_client() as client:
        resp = client.post(f"workloads/{workload_id}/stop")
        return resp.json() if resp.content else {}

delete_workload

delete_workload(workload_id: str) -> None

DELETE /workloads/{id} — 204 No Content on success.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def delete_workload(self, workload_id: str) -> None:
    """DELETE /workloads/{id} — 204 No Content on success."""
    with request_user_dr_client() as client:
        client.delete(f"workloads/{workload_id}")

patch_workload

patch_workload(workload_id: str, payload: dict[str, Any]) -> dict[str, Any]

PATCH /workloads/{id} — partial update of name / description / importance.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def patch_workload(self, workload_id: str, payload: dict[str, Any]) -> dict[str, Any]:
    """PATCH /workloads/{id} — partial update of name / description / importance."""
    with request_user_dr_client() as client:
        return client.patch(f"workloads/{workload_id}", json=payload).json()

get_workload_settings

get_workload_settings(workload_id: str) -> dict[str, Any]

GET /workloads/{id}/settings — returns WorkloadSettingsResponse.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_workload_settings(self, workload_id: str) -> dict[str, Any]:
    """GET /workloads/{id}/settings — returns WorkloadSettingsResponse."""
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}/settings").json()

update_workload_settings

update_workload_settings(workload_id: str, runtime: dict[str, Any]) -> dict[str, Any]

PATCH /workloads/{id}/settings — triggers rolling replacement (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def update_workload_settings(self, workload_id: str, runtime: dict[str, Any]) -> dict[str, Any]:
    """PATCH /workloads/{id}/settings — triggers rolling replacement (202)."""
    with request_user_dr_client() as client:
        return client.patch(
            f"workloads/{workload_id}/settings", json={"runtime": runtime}
        ).json()

get_workload_stats

get_workload_stats(workload_id: str, *, proton_id: str | None = None, start_time: str | None = None, end_time: str | None = None, response_time_quantile: float = 0.5, slow_requests_threshold: int = 2000) -> dict[str, Any]

GET /workloads/{id}/stats — aggregated performance statistics.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_workload_stats(
    self,
    workload_id: str,
    *,
    proton_id: str | None = None,
    start_time: str | None = None,
    end_time: str | None = None,
    response_time_quantile: float = 0.5,
    slow_requests_threshold: int = 2000,
) -> dict[str, Any]:
    """GET /workloads/{id}/stats — aggregated performance statistics."""
    params: dict[str, Any] = {
        "responseTimeQuantile": response_time_quantile,
        "slowRequestsThreshold": slow_requests_threshold,
    }
    if proton_id:
        params["protonId"] = proton_id
    if start_time:
        params["startTime"] = start_time
    if end_time:
        params["endTime"] = end_time
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}/stats", params=params).json()

list_workload_history

list_workload_history(workload_id: str, *, limit: int = 10, offset: int = 0) -> dict[str, Any]

GET /workloads/{id}/history — artifact deployment history.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_workload_history(
    self, workload_id: str, *, limit: int = 10, offset: int = 0
) -> dict[str, Any]:
    """GET /workloads/{id}/history — artifact deployment history."""
    with request_user_dr_client() as client:
        return client.get(
            f"workloads/{workload_id}/history",
            params={"limit": limit, "offset": offset},
        ).json()

list_workload_events

list_workload_events(workload_id: str, *, limit: int = 10, offset: int = 0) -> dict[str, Any]

GET /workloads/{id}/events — status-change and error events.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_workload_events(
    self, workload_id: str, *, limit: int = 10, offset: int = 0
) -> dict[str, Any]:
    """GET /workloads/{id}/events — status-change and error events."""
    with request_user_dr_client() as client:
        return client.get(
            f"workloads/{workload_id}/events",
            params={"limit": limit, "offset": offset},
        ).json()

promote_workload_artifact

promote_workload_artifact(workload_id: str) -> dict[str, Any]

POST /workloads/{id}/promote — lock the running draft artifact (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def promote_workload_artifact(self, workload_id: str) -> dict[str, Any]:
    """POST /workloads/{id}/promote — lock the running draft artifact (202)."""
    with request_user_dr_client() as client:
        resp = client.post(f"workloads/{workload_id}/promote")
        return resp.json() if resp.content else {}
get_workload_related(workload_id: str) -> dict[str, Any]

GET /workloads/{id}/related — linked artifacts and related entities.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_workload_related(self, workload_id: str) -> dict[str, Any]:
    """GET /workloads/{id}/related — linked artifacts and related entities."""
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}/related").json()

list_protons

list_protons(workload_id: str, *, limit: int = 10, offset: int = 0) -> dict[str, Any]

GET /workloads/{id}/protons — deployed proton instances for a workload.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_protons(self, workload_id: str, *, limit: int = 10, offset: int = 0) -> dict[str, Any]:
    """GET /workloads/{id}/protons — deployed proton instances for a workload."""
    with request_user_dr_client() as client:
        return client.get(
            f"workloads/{workload_id}/protons",
            params={"limit": limit, "offset": offset},
        ).json()

get_proton

get_proton(workload_id: str, proton_id: str) -> dict[str, Any]

GET /workloads/{id}/protons/{proton_id} — single proton record.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_proton(self, workload_id: str, proton_id: str) -> dict[str, Any]:
    """GET /workloads/{id}/protons/{proton_id} — single proton record."""
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}/protons/{proton_id}").json()

get_proton_status_details

get_proton_status_details(workload_id: str, proton_id: str) -> dict[str, Any] | None

GET /workloads/{id}/protons/{proton_id}/statusDetails.

Returns the ReplicaStatusesSnapshot when available (200), or None when no status has been received yet (204).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_proton_status_details(self, workload_id: str, proton_id: str) -> dict[str, Any] | None:
    """GET /workloads/{id}/protons/{proton_id}/statusDetails.

    Returns the ReplicaStatusesSnapshot when available (200), or
    ``None`` when no status has been received yet (204).
    """
    with request_user_dr_client() as client:
        resp = client.get(f"workloads/{workload_id}/protons/{proton_id}/statusDetails")
        return resp.json() if resp.content else None

list_workload_logs

list_workload_logs(workload_id: str, *, limit: int = 100, offset: int = 0, level: str = 'debug', start_time: str | None = None, end_time: str | None = None, includes: list[str] | None = None, excludes: list[str] | None = None, span_id: str | None = None, trace_id: str | None = None) -> dict[str, Any]

GET /otel/workload/{id}/logs/ — OTel log lines for a workload.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_workload_logs(
    self,
    workload_id: str,
    *,
    limit: int = 100,
    offset: int = 0,
    level: str = "debug",
    start_time: str | None = None,
    end_time: str | None = None,
    includes: list[str] | None = None,
    excludes: list[str] | None = None,
    span_id: str | None = None,
    trace_id: str | None = None,
) -> dict[str, Any]:
    """GET /otel/workload/{id}/logs/ — OTel log lines for a workload."""
    params: dict[str, Any] = {"limit": limit, "offset": offset, "level": level}
    if start_time:
        params["startTime"] = start_time
    if end_time:
        params["endTime"] = end_time
    if includes:
        params["includes"] = includes
    if excludes:
        params["excludes"] = excludes
    if span_id:
        params["spanId"] = span_id
    if trace_id:
        params["traceId"] = trace_id
    with request_user_dr_client() as client:
        return client.get(f"otel/workload/{workload_id}/logs/", params=params).json()

list_artifacts

list_artifacts(*, limit: int = 100, offset: int = 0, search: str | None = None, status: str | None = None, artifact_type: str | None = None, repository_id: str | None = None) -> dict[str, Any]

GET /artifacts/ with optional filters and pagination.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_artifacts(
    self,
    *,
    limit: int = 100,
    offset: int = 0,
    search: str | None = None,
    status: str | None = None,
    artifact_type: str | None = None,
    repository_id: str | None = None,
) -> dict[str, Any]:
    """GET /artifacts/ with optional filters and pagination."""
    params: dict[str, Any] = {"limit": limit, "offset": offset}
    if search:
        params["search"] = search
    if status:
        params["status"] = status
    if artifact_type:
        params["type"] = artifact_type
    if repository_id:
        params["repositoryId"] = repository_id
    with request_user_dr_client() as client:
        return client.get("artifacts/", params=params).json()

get_artifact

get_artifact(artifact_id: str) -> dict[str, Any]

GET /artifacts/{id}.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_artifact(self, artifact_id: str) -> dict[str, Any]:
    """GET /artifacts/{id}."""
    with request_user_dr_client() as client:
        return client.get(f"artifacts/{artifact_id}").json()

create_artifact

create_artifact(payload: dict[str, Any]) -> dict[str, Any]

POST /artifacts/ — returns the created ArtifactFormatted (201).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def create_artifact(self, payload: dict[str, Any]) -> dict[str, Any]:
    """POST /artifacts/ — returns the created ArtifactFormatted (201)."""
    with request_user_dr_client() as client:
        return client.post("artifacts/", json=payload).json()

put_artifact

put_artifact(artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]

PUT /artifacts/{id} — full replacement with InputArtifact payload.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def put_artifact(self, artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]:
    """PUT /artifacts/{id} — full replacement with InputArtifact payload."""
    with request_user_dr_client() as client:
        return client.put(f"artifacts/{artifact_id}", json=payload).json()

patch_artifact

patch_artifact(artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]

PATCH /artifacts/{id} — partial update via UpdateArtifactRequest.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def patch_artifact(self, artifact_id: str, payload: dict[str, Any]) -> dict[str, Any]:
    """PATCH /artifacts/{id} — partial update via UpdateArtifactRequest."""
    with request_user_dr_client() as client:
        return client.patch(f"artifacts/{artifact_id}", json=payload).json()

delete_artifact

delete_artifact(artifact_id: str) -> None

DELETE /artifacts/{id} — 204 No Content on success.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def delete_artifact(self, artifact_id: str) -> None:
    """DELETE /artifacts/{id} — 204 No Content on success."""
    with request_user_dr_client() as client:
        client.delete(f"artifacts/{artifact_id}")

clone_artifact

clone_artifact(artifact_id: str, name: str) -> dict[str, Any]

POST /artifacts/{id}/clone — duplicate with a new name.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def clone_artifact(self, artifact_id: str, name: str) -> dict[str, Any]:
    """POST /artifacts/{id}/clone — duplicate with a new name."""
    with request_user_dr_client() as client:
        return client.post(f"artifacts/{artifact_id}/clone", json={"name": name}).json()

list_artifact_builds

list_artifact_builds(artifact_id: str, *, limit: int = 100, offset: int = 0) -> dict[str, Any]

GET /artifacts/{id}/builds.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_artifact_builds(
    self,
    artifact_id: str,
    *,
    limit: int = 100,
    offset: int = 0,
) -> dict[str, Any]:
    """GET /artifacts/{id}/builds."""
    params: dict[str, Any] = {"limit": limit, "offset": offset}
    with request_user_dr_client() as client:
        return client.get(f"artifacts/{artifact_id}/builds", params=params).json()

trigger_artifact_build

trigger_artifact_build(artifact_id: str) -> dict[str, Any]

POST /artifacts/{id}/builds — start image build(s) for a draft service artifact.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def trigger_artifact_build(self, artifact_id: str) -> dict[str, Any]:
    """POST /artifacts/{id}/builds — start image build(s) for a draft service artifact."""
    with request_user_dr_client() as client:
        return client.post(f"artifacts/{artifact_id}/builds").json()

get_artifact_build

get_artifact_build(artifact_id: str, build_id: str) -> dict[str, Any]

GET /artifacts/{id}/builds/{build_id}.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_artifact_build(self, artifact_id: str, build_id: str) -> dict[str, Any]:
    """GET /artifacts/{id}/builds/{build_id}."""
    with request_user_dr_client() as client:
        return client.get(f"artifacts/{artifact_id}/builds/{build_id}").json()

get_artifact_build_logs

get_artifact_build_logs(artifact_id: str, build_id: str) -> str

GET /artifacts/{id}/builds/{build_id}/logs — returns raw log text.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_artifact_build_logs(self, artifact_id: str, build_id: str) -> str:
    """GET /artifacts/{id}/builds/{build_id}/logs — returns raw log text."""
    with request_user_dr_client() as client:
        return client.get(f"artifacts/{artifact_id}/builds/{build_id}/logs").text

delete_artifact_build

delete_artifact_build(artifact_id: str, build_id: str) -> None

DELETE /artifacts/{id}/builds/{build_id} — cancel or delete a build (204).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def delete_artifact_build(self, artifact_id: str, build_id: str) -> None:
    """DELETE /artifacts/{id}/builds/{build_id} — cancel or delete a build (204)."""
    with request_user_dr_client() as client:
        client.delete(f"artifacts/{artifact_id}/builds/{build_id}")

list_artifact_repositories

list_artifact_repositories(*, limit: int = 100, offset: int = 0, search: str | None = None, artifact_type: str | None = None) -> dict[str, Any]

GET /artifactRepositories.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def list_artifact_repositories(
    self,
    *,
    limit: int = 100,
    offset: int = 0,
    search: str | None = None,
    artifact_type: str | None = None,
) -> dict[str, Any]:
    """GET /artifactRepositories."""
    params: dict[str, Any] = {"limit": limit, "offset": offset}
    if search:
        params["search"] = search
    if artifact_type:
        params["type"] = artifact_type
    with request_user_dr_client() as client:
        return client.get("artifactRepositories", params=params).json()

get_artifact_repository

get_artifact_repository(repository_id: str) -> dict[str, Any]

GET /artifactRepositories/{id}.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_artifact_repository(self, repository_id: str) -> dict[str, Any]:
    """GET /artifactRepositories/{id}."""
    with request_user_dr_client() as client:
        return client.get(f"artifactRepositories/{repository_id}").json()

delete_artifact_repository

delete_artifact_repository(repository_id: str) -> None

DELETE /artifactRepositories/{id} — 204 No Content on success.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def delete_artifact_repository(self, repository_id: str) -> None:
    """DELETE /artifactRepositories/{id} — 204 No Content on success."""
    with request_user_dr_client() as client:
        client.delete(f"artifactRepositories/{repository_id}")

get_workload_replacement

get_workload_replacement(workload_id: str) -> dict[str, Any]

GET /workloads/{id}/replacement — current replacement status.

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def get_workload_replacement(self, workload_id: str) -> dict[str, Any]:
    """GET /workloads/{id}/replacement — current replacement status."""
    with request_user_dr_client() as client:
        return client.get(f"workloads/{workload_id}/replacement").json()

create_workload_replacement

create_workload_replacement(workload_id: str, payload: dict[str, Any]) -> dict[str, Any]

POST /workloads/{id}/replacement — start a rolling replacement (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def create_workload_replacement(
    self, workload_id: str, payload: dict[str, Any]
) -> dict[str, Any]:
    """POST /workloads/{id}/replacement — start a rolling replacement (202)."""
    with request_user_dr_client() as client:
        resp = client.post(f"workloads/{workload_id}/replacement", json=payload)
        return resp.json() if resp.content else {}

delete_workload_replacement

delete_workload_replacement(workload_id: str) -> dict[str, Any]

DELETE /workloads/{id}/replacement — cancel an in-progress replacement (202).

Source code in datarobot_genai/drtools/core/clients/datarobot_workload.py
def delete_workload_replacement(self, workload_id: str) -> dict[str, Any]:
    """DELETE /workloads/{id}/replacement — cancel an in-progress replacement (202)."""
    with request_user_dr_client() as client:
        resp = client.delete(f"workloads/{workload_id}/replacement")
        return resp.json() if resp.content else {}