Skip to main content

aip_sdk.run_sdg

aip_sdk.run_sdg(adapter_id: str, project_id: str | None = None, *, target_dataset_id: str | None = None, source_dataset_version_id: str | None = None, client: APIClient | None = None) -> SdgRun

Trigger an SDG run against a previously registered adapter.

The adapter must have been registered with pipeline_config; adapters registered with the legacy pipeline_class dotted-path slot are not runnable and are rejected with 400.

The call returns immediately (HTTP 202 Accepted) once the run has been enqueued; processing happens asynchronously. Use SdgRun.refresh() to poll status, or aip.get_run() to attach a full Run handle.

Parameters

  • adapter_id str: ID of the registered SDG adapter to run.
  • project_id str | None: Optional project to attach the resulting run to. Must belong to the adapter's workspace. Strongly recommended: without it non-admin callers cannot fetch the run back via GET /runs/{id} and the run is invisible to project-scoped run lists.
  • target_dataset_id str | None: Optional dataset to write the generated samples into.
  • source_dataset_version_id str | None: Optional dataset version to read seed samples from.
  • client APIClient | None: Optional pre-configured API client.

Returns

  • SdgRun: SdgRun with id, status, created_at.

Raises

  • AdapterNotFoundError: If the adapter doesn't exist.
  • APIError: If the adapter was registered without pipeline_config, or if project_id is unknown / not in the adapter's workspace.
  • AuthError: If no credentials are configured.

Example:

# Authoring a JobConfig requires the SDG extra: pip install 'aip-sdk[sdg]'
import aip_sdk as aip
from aip_sdg_core import JobConfig
from aip_sdg_core.schemas.object_detection.augmentation.brightness_contrast import (
BrightnessContrastConfig,
)

aip.init("https://aip.example.com", api_key="...")
job_config = JobConfig(storage_root="/tmp/sdg")
job_config.add_node("seed", ...)
job_config.add_node("augmented", BrightnessContrastConfig(...), upstream="seed")
adapter = aip.register_sdg_adapter(name="brightness-tune", job_config=job_config)
run = aip.run_sdg(adapter_id=adapter.id, project_id="proj_…")
print(run.id, run.status)