airflow.providers.common.ai.sandbox.islo¶
islo.dev microVM backend for SandboxToolset.
Attributes¶
Classes¶
Sandbox backend that runs agent commands in an islo.dev microVM. |
Module Contents¶
- class airflow.providers.common.ai.sandbox.islo.IsloSandboxBackend(*, image=None, vcpus=None, memory_mb=None, pause_after_idle=600, auto_resume='on_activity', delete_after=86400)[source]¶
Bases:
airflow.providers.common.ai.sandbox.base.SandboxBackendSandbox backend that runs agent commands in an islo.dev microVM.
Note
Experimental: this can change or be removed in a minor release of this provider. See Stable and experimental features.
Islo is a hosted API with no local daemon or host-virtualization requirement, so this backend works from an Airflow worker running in a container.
Credentials are ambient. The SDK reads
ISLO_API_KEY, and optionallyISLO_BASE_URLandISLO_COMPUTE_URL, from the worker environment on first use; an unsetISLO_API_KEYfails the task at that point. Modal reads amodalconnection first, but that connection type is owned by the Modal provider; anisloconnection type belongs in a future Islo provider, not in this one.File reads, writes and exports move file contents through Islo’s native streaming APIs. Everything else runs through a shell wrapper in the sandbox, so the image needs
sh,mkdirandrmfor the wrapper,tailto bound command output,dirnameto create a written file’s parent directory,statto size an over-budget read and to check a file before it is exported,realpathto resolve a relative export path, and GNUfindfor directory listings. The server default image and any Debian or Ubuntu based image provide them. Each command’s output is captured to a scratch file in the sandbox and only its lastmax_output_bytesare returned, so the worker sees a bounded tail while the sandbox’s own ephemeral disk absorbs the rest.Islo sets
PATHfor every command itself and drops aPATHgiven at creation, so a spec that names it is refused rather than silently ignored.SandboxSpec.owneris refused for the same reason: this backend keeps no per-sandbox metadata, so a sandbox created here cannot be attached to later.- Parameters:
image (str | None) – Sandbox image.
None(default) uses the server default.vcpus (int | None) – Number of virtual CPUs.
Noneuses the server default.memory_mb (int | None) – Memory in MB.
Noneuses the server default.pause_after_idle (int | None) – Seconds without a command or file operation after which the server pauses the microVM and releases its compute.
Nonedisables it. Default600.auto_resume (Literal['never', 'on_activity']) –
"on_activity"(default) resumes a paused sandbox on the next command or file operation;"never"leaves it paused, and the backend then treats a paused sandbox as unusable.delete_after (int | None) – Seconds after creation at which the server deletes the sandbox whether or not it is in use.
Nonedisables it. Default86400.
- create(*, spec=None)[source]¶
Provision one sandbox and return its handle (name or id).
specofNonemeans “no requirements stated”: the backend applies its own defaults and makes no guarantee. It is not the same as a defaultSandboxSpec, which is an explicit request for an isolated sandbox. The toolset always sends a concrete spec, soNoneonly reaches a backend a caller drives directly.Raise
SandboxTerminalErrorifspecasks for something this backend cannot enforce, rather than provisioning something weaker than was asked for. It is terminal rather than recoverable because it states a configuration fact the model cannot see and cannot fix by retrying.Every failure raised here is terminal, whichever class carries it. The model has no input into provisioning, so a
SandboxErrorfromcreateis not something it can work around; the toolset re-raises one asSandboxTerminalErrorand fails the task, so Airflow’s retry attempts the provisioning again.
- run_command(sandbox, command, *, timeout, max_output_bytes)[source]¶
Run
commandthrough a shell in the sandbox, bounded bytimeoutseconds.max_output_bytesbounds what the backend retains per stream while reading, so unbounded command output cannot exhaust worker memory before the toolset gets a chance to format it.
- read_file(sandbox, path, *, max_bytes)[source]¶
Read a file from the sandbox.
Raise
SandboxFileTooLargeErrorinstead of transferring a file larger thanmax_bytes.
- export_file(sandbox, path, dest, *, max_bytes)[source]¶
Override: stream the file through Islo’s download API into
dest.The default reads 4 MiB slices through
run_command, which here returns at most 1 MiB per stream. The guest still runs the default’s checks first, so a refusal means what it does on every backend and the size it reports catches a file that is still being written.