ImageService
class ImageService()Image build/pull/list namespace.
ImageService.__init__
def __init__(impl: AsyncImageService, bridge: SyncBridge) -> NoneImageService.build
def build(builder: ImageBuilder,
/,
*,
name: Optional[str] = None,
idle_expiry_seconds: Optional[int] = None,
region: Optional[str] = None,
cpu_arch: Optional[str] = None,
timeout: Optional[float] = None) -> ImageBuild (or import) an image from an ImageBuilder declaration.
ImageService.delete
def delete(image_id: str) -> NoneImageService.follow_build_logs
def follow_build_logs(image_id: str,
*,
on_logs: _LogsCallback,
on_event: Optional[_EventCallback] = None,
cursor: Optional[str] = None,
timeout: Optional[float] = None) -> BuildLogFollowResultObserve a submitted image build. Timeout is in seconds, not execution TTL.
ImageService.get
def get(image_id: str,
*,
wait: Literal['ready'] | None = None,
timeout: Optional[float] = None) -> ImageImageService.iter
def iter(*,
anonymous: bool = False,
sandbox_id: Optional[str] = None,
name: Optional[str] = None,
cursor: Optional[str] = None,
limit: Optional[int] = None,
platform: Optional[Literal['true', 'false', 'any']] = None) -> Iterator[Image]ImageService.list
def list(*,
anonymous: bool = False,
sandbox_id: Optional[str] = None,
name: Optional[str] = None,
cursor: Optional[str] = None,
limit: Optional[int] = None,
platform: Optional[Literal['true', 'false', 'any']] = None) -> ListResult[Image]List images (GET /images).
ImageService.promote
def promote(image_id: str, name: str) -> ImageName an ANONYMOUS image, making it permanent (PATCH /images/{id}).
ImageService.pull
def pull(image: str,
*,
name: Optional[str] = None,
region: Optional[str] = None,
wait: bool = True,
timeout: Optional[float] = None) -> ImageImport a registry image, waiting until ready unless wait=False.
AsyncImageService
class AsyncImageService()Image build/pull/list namespace.
AsyncImageService.__init__
def __init__(transport: AsyncTransport) -> NoneAsyncImageService.follow_build_logs
async def follow_build_logs(image_id: str,
*,
on_logs: _LogsCallback,
on_event: Optional[_EventCallback] = None,
cursor: Optional[str] = None,
timeout: Optional[float] = None) -> BuildLogFollowResultObserve a submitted image build. Timeout is in seconds, not execution TTL.
AsyncImageService.build
async def build(builder: ImageBuilder,
/,
*,
name: Optional[str] = None,
idle_expiry_seconds: Optional[int] = None,
region: Optional[str] = None,
cpu_arch: Optional[str] = None,
timeout: Optional[float] = None) -> ImageBuild (or import) an image from an ImageBuilder declaration.
The builder is the only way to say WHAT to build — ImageBuilder. from_dockerfile(...), .from_registry(...), or the fluent
.run_commands / .env / .workdir chain — in both SDKs
(parity with TypeScript's images.build(builder, options)). name
omitted makes the image anonymous; idle_expiry_seconds is then its
idle-retention window — deleted once that long has passed without a
sandbox being created from it (every create restarts the clock);
omitted ⇒ the maximum retention supported by the API.
AsyncImageService.pull
async def pull(image: str,
*,
name: Optional[str] = None,
region: Optional[str] = None,
wait: bool = True,
timeout: Optional[float] = None) -> ImageImport a registry image, waiting until ready unless wait=False.
timeout is the submission and readiness budget in seconds; omitted
or zero waits without a deadline. A failed import raises
ImageBuildFailedError with the server's recorded error.
AsyncImageService.get
async def get(image_id: str,
*,
wait: Literal['ready'] | None = None,
timeout: Optional[float] = None) -> ImageAsyncImageService.promote
async def promote(image_id: str, name: str) -> ImageName an ANONYMOUS image, making it permanent (PATCH /images/{id}).
Promotion only: an image that already has a name answers 409 — renaming a named image is not offered (sandboxes reference images by id, so a rename would silently relabel every sandbox created from it).
AsyncImageService.delete
async def delete(image_id: str) -> NoneAsyncImageService.list
async def list(*,
anonymous: bool = False,
sandbox_id: Optional[str] = None,
name: Optional[str] = None,
cursor: Optional[str] = None,
limit: Optional[int] = None,
platform: Optional[Literal['true', 'false', 'any']] = None) -> ListResult[Image]List images (GET /images).
platform picks the shared images Daytona publishes for every
project: "false" (the server default) lists the project's own
images, "true" lists only the non-deprecated platform images (the
default one carries default=True), and "any" lists both.
AsyncImageService.iter
async def iter(*,
anonymous: bool = False,
sandbox_id: Optional[str] = None,
name: Optional[str] = None,
cursor: Optional[str] = None,
limit: Optional[int] = None,
platform: Optional[Literal['true', 'false', 'any']] = None) -> AsyncIterator[Image]ImageListItem
class ImageListItem(BaseModel)An image with its pagination cursor.
Attributes:
anonymousStrictBool = Field(description='Whether the image has no permanent name.')bytesOptional[StrictInt] = Field(default=None, description='The image size in bytes, or null until the build completes.')var_classStrictStr = Field(description='The sandbox class supported by the image.', alias='class')created_atdatetime = Field(description='When the image was created.')cursorStrictStr = Field(description='Opaque continuation token for the next image in the list.')defaultStrictBool = Field(description='Whether this is the image a sandbox create withoutimageboots.')deprecatedStrictBool = Field(description='Whether this platform image is deprecated. A deprecated image is not listed and cannot be used by name, but its ID still resolves.')disk_mibOptional[StrictInt] = Field(default=None, description='The disk size in MiB that a macOS sandbox created from this image gets when the create omitsdisk_mib. Set for saved macOS sandbox disks; null for every other image.')errorOptional[StrictStr] = Field(default=None, description='Build failure reason; null unlessstatusisfailed.')expires_atOptional[datetime] = Field(default=None, description='When an anonymous image expires, or null for a permanent image.')format_outdatedStrictBool = Field(description='format_versionis below the current format. Such an image converts on its first Linux sandbox create (which waitsqueuedmeanwhile) or ahead of time withPOST /images/{id}/convert; other operations refuse it withIMAGE_FORMAT_OUTDATEDuntil then.')format_versionStrictInt = Field(description='Image format version:1for images imported from Daytona v0,2for the current format. Seestatusfor image readiness.')idStrictStr = Field(description='The image ID.')imported_fromOptional[ImportedFrom] = Nonelayer_countOptional[StrictInt] = Field(default=None, description='The number of filesystem layers, or null until the build completes.')nameOptional[StrictStr] = Field(default=None, description='The image name, or null for an anonymous image.')originStrictStr = Field(description='How the image was created.')platformStrictBool = Field(description="Whether the platform publishes this image for every project. A project's own image with the same name takes precedence for that project, and platform images cannot be renamed, converted, or deleted.")region_idStrictStr = Field(description='The home region.')region_idsList[StrictStr] = Field(description='Every region where the image is available.')retentionImageRetentionsourceOptional[ImageSourceValue] = NonestatusStrictStr = Field(description='The build status.')updated_atdatetime = Field(description='When the image was last updated.')additional_propertiesDict[str, Any] = {}
model_config
model_config = ConfigDict(populate_by_name=True, validate_assignment=True, protected_namespaces=())ImageListItem.to_str
def to_str() -> strReturns the string representation of the model using alias
ImageListItem.to_json
def to_json() -> strReturns the JSON representation of the model using alias
ImageListItem.from_json
@classmethod
def from_json(json_str: str) -> Optional[Self]Create an instance of ImageListItem from a JSON string
ImageListItem.to_dict
def to_dict() -> Dict[str, Any]Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
ImageListItem.from_dict
@classmethod
def from_dict(obj: Optional[Dict[str, Any]]) -> Optional[Self]Create an instance of ImageListItem from a dict
BuildLogFollowResult
@dataclass(frozen=True)
class BuildLogFollowResult()Attributes:
statusstrreasonBuildLogDoneReasonoutput_completeboolcursorstr | None = Noneraw_reasonstr | None = None
BuildLogStateEvent
@dataclass(frozen=True)
class BuildLogStateEvent()Attributes:
statusstrerrorstr | None = Nonedeadline_atstr | None = NonetypeLiteral['state'] = 'state'
BuildLogChunkEvent
@dataclass(frozen=True)
class BuildLogChunkEvent()Attributes:
data_base64strstart_offsetstrnext_offsetstrcursorstrtypeLiteral['log'] = 'log'
BuildLogGapEvent
@dataclass(frozen=True)
class BuildLogGapEvent()Attributes:
requested_offsetstrfirst_available_offsetstrdropped_bytesstrcursorstrreasonBuildLogGapReason = 'truncated'typeLiteral['gap'] = 'gap'raw_reasonstr | None = None
BuildLogUnavailableEvent
@dataclass(frozen=True)
class BuildLogUnavailableEvent()Attributes:
reasonstrtypeLiteral['unavailable'] = 'unavailable'
BuildLogSourceChangedEvent
@dataclass(frozen=True)
class BuildLogSourceChangedEvent()Attributes:
reasonstrtypeLiteral['source_changed'] = 'source_changed'
BuildLogDoneEvent
@dataclass(frozen=True)
class BuildLogDoneEvent()Attributes:
resultBuildLogFollowResulttypeLiteral['done'] = 'done'
BuildLogErrorEvent
@dataclass(frozen=True)
class BuildLogErrorEvent()Attributes:
errorstrcodestrretryablebooltrace_idstr | None = NonetypeLiteral['error'] = 'error'
ImageBuilder
@dataclass(frozen=True, slots=True)
class ImageBuilder()ImageBuilder.from_registry
@classmethod
def from_registry(ref: str) -> SelfImageBuilder.from_dockerfile
@classmethod
def from_dockerfile(content: str) -> SelfImageBuilder.pip_install
def pip_install(*packages: str) -> SelfImageBuilder.run_commands
def run_commands(*commands: str) -> SelfImageBuilder.env
@overload
def env(name: str, value: str, /) -> SelfImageBuilder.env
@overload
def env(values: Mapping[str, str], /) -> SelfImageBuilder.workdir
def workdir(path: str, /) -> SelfImageBuilder.build_request_source
def build_request_source() -> tuple[dict[str, str] | None, str | None]ImageBuilder.render_dockerfile
def render_dockerfile() -> strRender the Dockerfile the build request carries.
Byte-identical to TypeScript's ImageBuilder.toDockerfile() for the
same builder: one line per layer, a single trailing newline (a POSIX
text file), no trailing whitespace.
ImageRef
@dataclass(frozen=True, slots=True)
class ImageRef()Attributes:
idstrnameOptional[str] = None
Image
@dataclass(frozen=True, slots=True)
class Image()Attributes:
idstrnameOptional[str]statusstrregionstranonymousboolretentionArtifactRetentionvar_classstravailable_inlist[str]originstrcreated_atOptional[str] = NoneerrorOptional[str] = Noneexpires_atOptional[str] = NonesourceOptional[ImageSource] = NonebytesOptional[int] = Nonelayer_countOptional[int] = NonecursorOptional[str] = Noneformat_versionOptional[int] = Noneformat_outdatedbool = Falseplatformbool = Falsedefaultbool = Falsedeprecatedbool = Falseupdated_atOptional[str] = Nonedisk_mibOptional[int] = Noneraw_retentionstr = field(default='', kw_only=True)
BuildLogDoneReason
BuildLogDoneReason = Literal['terminal', 'deadline', 'not_applicable', 'resource_deleted', 'unknown']BuildLogGapReason
BuildLogGapReason = Literal['truncated', 'unknown']BuildLogEvent
BuildLogEvent = BuildLogStateEvent | BuildLogChunkEvent | BuildLogGapEvent | BuildLogUnavailableEvent | BuildLogSourceChangedEvent | BuildLogDoneEvent | BuildLogErrorEventImageBuildResponse
ImageBuildResponse = _gen.api.AsyncOperationArtifactRetention
ArtifactRetention = Literal['permanent', 'idle', 'unknown']ImageSource
ImageSource = Union[RegistryImageSource, DockerfileImageSource, NamedImageSource, ManifestImageSource]