rebase.artifact

Register a durable output URI on the current hosted run.

Signature

rb.artifact(
    name: str,
    *,
    uri: str,
    key: str | None = None,
    disposition: Literal["created", "reused"] = "created",
    media_type: str | None = None,
    size_bytes: int | None = None,
    version: str | None = None,
    digest: str | None = None,
    metadata: dict[str, Any] | None = None,
) -> rb.Artifact

Register an output after writing it to durable storage:

artifact = rb.artifact(
    "SE3 day-ahead forecast",
    uri="gs://forecast-archive/2026-08-11/SE3.parquet",
    key="forecast/SE3",
    media_type="application/parquet",
    size_bytes=218_420,
    version="1741632447112345",
    digest="md5:8d777f385d3dfec8815d20f7496026dc",
    metadata={"zone": "SE3", "rows": 24},
)

Rebase stores the pointer and metadata. It does not upload, copy, proxy, or validate the object itself.

Parameters

ParameterDescription
nameRequired human-readable artifact name.
uriRequired absolute URI with a scheme, such as gs://, s3://, or https://.
keyOptional logical identity within the canonical run. The same key and URI is idempotent; another URI conflicts.
disposition"created" when this run wrote the output; "reused" when it found an existing output.
media_typeOptional MIME type.
size_bytesOptional non-negative byte size.
versionOptional storage generation, version, snapshot, or ETag.
digestOptional checksum. Include the algorithm in the value.
metadataOptional JSON object with domain-specific metadata.

The returned Artifact exposes these fields plus its generated client_token and the registered platform id. During local execution, id is None.

Attribution

Attribution is automatic:

  • Inside rb.task, the artifact belongs to that inline task.
  • Inside a Function.map child run, it belongs to that map item and appears on the canonical parent workflow run.
  • Inside a workflow step without a task, it belongs to the step.
  • Otherwise it belongs directly to the active run.
with rb.task("Export report", key="report") as task:
    uri = export_report()
    artifact = rb.artifact("Report", uri=uri, key="report/pdf", media_type="application/pdf")
    task.set_result({"artifact_id": artifact.id, "uri": artifact.uri})

Errors and Local Execution

ArtifactReportingError is raised if a hosted run cannot register the pointer. This is strict by design: output that was successfully written should not silently disappear from the run record.

Outside a hosted run, rb.artifact validates its arguments, returns an Artifact with id is None, and makes no API request.

See Tasks and Artifacts for threaded and Function.map examples that register artifacts.

On this page