Workspaces
Create, run and manage workspaces: IDEs running in their own containers.
Access it as client.workspaces on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.
Quick start
from strongly import Strongly
client = Strongly()
# List (auto-paginates as you iterate) # filters: search, status, project_id, sort
for workspace in client.workspaces.list():
print(workspace.id)
Methods
Core
list
list(*, search: str | None = None, status: str | None = None, project_id: str | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[WorkspaceSummary]
List the workspaces you can use, newest first.
Parameters
search(str | None, optional): Only workspaces whose name or description contains this text (case insensitive).status(str | None, optional): Only workspaces with this status, such as"running".project_id(str | None, optional): Only the workspaces of this project.sort(str | None, optional): The order, as comma-separated wire field names, each prefixed with-for descending (for example"name"). The API's default is"-createdAt".limit(int | None, optional): The most workspaces to return;Nonereturns every one.
Returns
SyncPaginator[WorkspaceSummary]: The workspaces, fetched a page at a time.
create
create(*, name: str, description: str, environment_type: str, environment_id: str | None = None, environment_version: int | None = None, custom_resources: Mapping[str, Any] | None = None, workspace_volume_size: str | None = None, project_id: str | None = None, use_spot: bool | None = None, spot_fallback: bool | None = None, environment_variables: Mapping[str, str] | None = None, addons: Sequence[str] | None = None, data_sources: Sequence[str] | None = None, ai_gateways: Sequence[str] | None = None, workflows: Sequence[str] | None = None, skill_ids: Sequence[str] | None = None, shared_volume_ids: Sequence[str] | None = None, coding_assistants: Sequence[str] | None = None, assistant_model_id: str | None = None, code_session_enabled: bool | None = None, custom_port: int | None = None, proxy_headers: Sequence[Mapping[str, str]] | None = None, cluster: Mapping[str, Any] | None = None) -> Workspace
Create a workspace, stopped. Start it with start.
The workspace runs at exactly the size you set and none is assumed: give
environment_id (a saved environment supplies the image and size) or
custom_resources.
A size is the whole workload: Strongly's helper services beside it
(sign-in proxy, outbound proxy, data volume mounts, model cache upload,
metrics) are taken out of it, never added on top (set 4 GB and the workload
uses 4 GB in total). A size too small to hold them is refused naming them.
A CPU, memory, GPU count or disk above the largest allowed machine's room
for one workload raises APIError with status_code 400 naming the
resource and both figures, and nothing is created or changed. Check
client.compute.list_pools() allowed_sizes (max_cpu,
max_memory_gib, max_disk_gib, max_gpus) before a large size.
Parameters
name(str): The workspace's name.description(str): What the workspace is for.environment_type(str): The IDE:"jupyter","vscode","rstudio"or"custom"(the environment image runs its own IDE oncustom_port).environment_id(str | None, optional): A saved environment (image and size).environment_version(int | None, optional): A version of that environment. The API's default is the latest.custom_resources(Mapping[str, Any] | None, optional): The size when no environment is chosen, such as{"cpu": "2", "memory": "8GB", "disk": "20GB"}(optionally"gpu"and"gpu_type");diskis scratch space. At least 0.1 CPU and 128MB of memory.gpu_type: One of the typeslist_gpu_optionslists (the admin Compute selection); any other is refused with a 400ValidationError.workspace_volume_size(str | None, optional): The size of the persistent/workspacevolume, such as"40GB". The API's default is"20GB".project_id(str | None, optional): The project the workspace belongs to; it mounts the project's volume. The API's default creates a project named after the workspace.use_spot(bool | None, optional):Trueruns the workspace on spot capacity (cheaper; it can be reclaimed, and the workspace restarts on a new node with its volumes kept).spot_fallback(bool | None, optional): Withuse_spot:True(the API's default) falls back to on-demand capacity when no spot is available;Falsewaits for spot.environment_variables(Mapping[str, str] | None, optional): Environment variables for the container.addons(Sequence[str] | None, optional): Add-on ids to attach (delivered inSTRONGLY_SERVICES).data_sources(Sequence[str] | None, optional): Data source ids to attach (delivered inSTRONGLY_SERVICES).ai_gateways(Sequence[str] | None, optional): AI model ids to make available.workflows(Sequence[str] | None, optional): Workflow ids to make available.skill_ids(Sequence[str] | None, optional): Skill ids to install in the workspace.shared_volume_ids(Sequence[str] | None, optional): The shared volumes to mount at/volumes/shared/<name>; none unless listed (the project's volume always mounts). A volume you may not mount is refused, by name.coding_assistants(Sequence[str] | None, optional): The coding assistant to install: at most one of"claude-code","codex"and"opencode"(CLIs you sign in to from the terminal; not for RStudio or a custom IDE), or"cline"(a VS Code extension, VS Code workspaces only, that calls your AI Gateway models with no key to sign in with).assistant_model_id(str | None, optional): With"cline"(required then, refused otherwise): the id of the AI Gateway chat model Cline calls, one you may use.code_session_enabled(bool | None, optional):Trueadds a terminal an agent can drive.custom_port(int | None, optional): For a custom IDE: the port it serves on. The API's default is 8888.proxy_headers(Sequence[Mapping[str, str]] | None, optional): For a custom IDE: headers the proxy forwards to it, each{"name": ..., "value": ...}; values may use${BASE_PATH},${ORIGIN},${PATH}and${REQUEST_URI}.cluster(Mapping[str, Any] | None, optional): A Ray, Dask or Spark cluster to attach, such as{"engine": "ray", "coordinator": {"cpu": "2", "memory": "4GB"}, "worker": {"cpu": "2", "memory": "4GB"}, "workers": 2}.
Returns
Workspace: The new workspace,stopped, asretrieveshows it.
Raises
ValidationError: A required field is missing, or no size was given.NotFoundError: The project or environment does not exist.PermissionDeniedError: You may not add workspaces to the project.ConflictError: Noproject_idwas given and a project or volume already has the workspace's name (error_codeduplicate).
retrieve
retrieve(workspace_id: str) -> Workspace
Retrieve a workspace you can use.
Parameters
workspace_id(str): The workspace's id.
Returns
Workspace: The workspace.
Raises
NotFoundError: There is no such workspace, or you cannot use it.
update
update(workspace_id: str, *, name: str | None = None, description: str | None = None, environment_variables: Mapping[str, str] | None = None, addons: Sequence[str] | None = None, data_sources: Sequence[str] | None = None, ai_gateways: Sequence[str] | None = None, workflows: Sequence[str] | None = None, shared_volume_ids: Sequence[str] | None = None, coding_assistants: Sequence[str] | None = None, skill_ids: Sequence[str] | None = None, assistant_model_id: str | None = None) -> Workspace
Change a workspace's name, description, services, assistant or env variables.
Only the fields you give change; returns the workspace, as
retrieve shows it. The size, image, IDE and environment are fixed at
create. Services apply at the next start or restart.
Parameters
workspace_id(str): The workspace's id.name(str | None, optional): The workspace's name.description(str | None, optional): Its description.environment_variables(Mapping[str, str] | None, optional): Environment variables, replacing the current set. Only before the first start, or while the workspace is inerror.addons(Sequence[str] | None, optional): The add-on ids it selects, replacing the list.data_sources(Sequence[str] | None, optional): The data source ids it selects, replacing the list.ai_gateways(Sequence[str] | None, optional): The AI model ids it selects, replacing the list.workflows(Sequence[str] | None, optional): The workflow ids it selects, replacing the list.shared_volume_ids(Sequence[str] | None, optional): The shared volumes it mounts at/volumes/shared/<name>from its next start or restart, replacing the list ([]for none).coding_assistants(Sequence[str] | None, optional): The coding assistant installed at each start ([]for none), ascreatetakes it. Switching away from"cline"drops its model.skill_ids(Sequence[str] | None, optional): The Skill Library skills installed at each start, replacing the list.assistant_model_id(str | None, optional): Cline only: the AI Gateway chat model it calls.
Raises
NotFoundError: There is no such workspace, or you may not change it.ConflictError:environment_variableson a deployed workspace (error_codeinvalid-state).ValidationError: A value is invalid (a blank name, a repeated id).
delete
delete(workspace_id: str) -> None
Delete a workspace.
The workspace moves to pending_delete and is removed once its
container is gone.
Parameters
workspace_id(str): The workspace's id.
Raises
NotFoundError: There is no such workspace.PermissionDeniedError: You may not delete it.
Lifecycle & actions
start
start(workspace_id: str) -> Workspace
Start a workspace.
Returns as soon as the start is accepted; the status moves through
deploying and starting to running (or error). Poll
retrieve or status. Starting a running or starting
workspace changes nothing.
A workspace with a compute cluster answers at once too: its cluster
comes up after the start (cluster["status"] provisioning), and
the workspace is running once its cluster is ready. A cluster
that cannot start (one no machine fits) fails the start: the workspace
ends in error, its error and cluster["error"] saying why.
Parameters
workspace_id(str): The workspace's id.
Returns
Workspace: The workspace, asretrieveshows it, with itsstatusnow.
Raises
NotFoundError: There is no such workspace, or you may not start it.PaymentRequiredError: A budget or the organization's credits refuse the start.PermissionDeniedError: A governance policy blocks the workspace.
stop
stop(workspace_id: str) -> Workspace
Stop a workspace. Its volumes keep their data.
Parameters
workspace_id(str): The workspace's id.
Returns
Workspace: The workspace, asretrieveshows it,stopped.
Raises
NotFoundError: There is no such workspace.
restart
restart(workspace_id: str) -> Workspace
Restart a started workspace, redeploying it (its owner only).
Parameters
workspace_id(str): The workspace's id.
Raises
UnprocessableEntityError: The workspace has never been started (usestart).PermissionDeniedError: You are not the workspace's owner.
execute
execute(workspace_id: str, command: str, *, cwd: str | None = None, idempotency_key: str | None = None) -> CommandResult
Run a shell command in a running workspace and return its result once it exits.
Returns {stdout, stderr, exit_code} with its whole output. The
command runs in the workspace until it exits, whatever happens to the
connection: this starts it (start_execution, sent again with the
same Idempotency-Key when the connection drops, so it never runs twice)
and follows it to its end (wait_for_execution). A command of any
length works the same way.
Parameters
workspace_id(str): The workspace's id.command(str): The command, run by a shell.cwd(str | None, optional): The directory to run it in.idempotency_key(str | None, optional): The execution's key (1 to 255 characters): calling again with the same key and command answers the same execution and never runs the command again. Omitted, a new key for this call.
Raises
ConflictError: The workspace is not ready (error_codeworkspace-not-ready): it is starting or restarting. The error's details carry itsphaseand each container's state; run the command once it is running.UnprocessableEntityError: The key was used for another command (idempotency-key-reused).StronglyError: The command failed in the workspace (it stopped or restarted while the command ran), or its output is no longer kept.
Other
abort_sync
abort_sync(workspace_id: str, *, volume_id: str) -> WorkspaceMerges
Cancel a volume's merge in a workspace, keeping its work as it was.
Parameters
workspace_id(str): The workspace's id.volume_id(str): The volume whose merge to cancel.
add_port
add_port(workspace_id: str, port: int, *, label: str | None = None) -> ExposedPort
Save a labeled link to a port of the workspace: {port, label, url}.
Parameters
workspace_id(str): The workspace's id.port(int): The port the app listens on (1024 to 65535).label(str | None, optional): The link's label.
cancel_sync
cancel_sync(workspace_id: str, sync_id: str) -> WorkspaceSync
Cancel a running workspace sync: it stops before its next batch.
What it committed stays committed; the rest stays in the workspace for the next sync.
Parameters
workspace_id(str): The workspace's id.sync_id(str): The running sync.
Returns
WorkspaceSync: The sync, its cancel requested (cancel_requested); it endscancelled.
Raises
ConflictError: The sync is not running.
deletion_impact
deletion_impact(workspace_id: str) -> DeletionImpact
Say whether a workspace can be deleted, and what the delete removes.
Parameters
workspace_id(str): The workspace's id.
logs
logs(workspace_id: str, *, type: str | None = None) -> list[WorkspaceLogEntry]
Return a workspace's log: every line since its container started.
Parameters
workspace_id(str): The workspace's id.type(str | None, optional): Which logs:"pod"(the IDE's own runtime log, the API's default) or"deploy"(its Kubernetes rollout).
Returns
list[WorkspaceLogEntry]: The log lines.
metrics
metrics(workspace_id: str) -> WorkspaceMetrics
Measure a running workspace now (about 6 seconds).
Parameters
workspace_id(str): The workspace's id.
Returns
WorkspaceMetrics: CPU and memory against its size, disk, network, GPU, IDE response time, and every container's usage.
Raises
ConflictError: The workspace is not running (error_codeinvalid-state).
minimum_size
minimum_size() -> WorkspaceMinimumSize
Get the smallest size a workspace (and a cluster coordinator) can have.
planned_volumes
planned_volumes(*, project_id: str, shared_volume_ids: Sequence[str] | None = None) -> PlannedVolumes
List the volumes a new workspace in a project would mount.
Parameters
project_id(str): The project the workspace would be in.shared_volume_ids(Sequence[str] | None, optional): Shared volumes it would mount besides the project's.
platform_environment
platform_environment(workspace_id: str) -> PlatformEnvironment
Return the variables the platform sets in a workspace, with their values.
The values are the ones its running IDE container was started with (WORKSPACE_ID, STRONGLY_SERVICES, ...).
Its owner's only: STRONGLY_SERVICES carries the owner's connections' credentials. While the workspace is not running every name is listed with no value.
Parameters
workspace_id(str): The workspace ID.
pod
pod(workspace_id: str) -> WorkerStatus
Read what runs a workspace right now (live).
Its phase, every container's ready flag, restart count and state (the
IDE is kind main; the platform's data volume and proxies are
sidecar), how a container's last run ended
(last_terminated.reason, such as OOMKilled), and why it is not
running yet (pending_reasons: the scheduler's answer, a waiting
container, Warning events).
Parameters
workspace_id(str): The workspace's id.
Returns
WorkerStatus: The workspace's worker.
Raises
NotFoundError: The workspace has no worker (it is stopped).
remove_port
remove_port(workspace_id: str, port: int) -> None
Remove a saved port link; the app keeps running.
Parameters
workspace_id(str): The workspace's id.port(int): The link's port.
resolve_sync_conflict
resolve_sync_conflict(workspace_id: str, *, volume_id: str, path: str, take: str) -> WorkspaceMerges
Decide one conflicted file of a workspace's Sync.
Parameters
workspace_id(str): The workspace's id.volume_id(str): The volume the file is in.path(str): The file's path in the volume.take(str):mine(the workspace's copy) ortheirs(the volume's).
retrieve_execution
retrieve_execution(workspace_id: str, execution_id: str, *, cursor: str | None = None) -> WorkspaceExecution
Read an execution: its status, exit code and a page of its output.
Parameters
workspace_id(str): The workspace's id.execution_id(str): The execution's id (start_executionanswered it).cursor(str | None, optional): The previous page'snext_cursor; omitted, its output from the start.
Raises
NotFoundError: The workspace has no such execution (an execution is kept 24 hours after it ends).
retrieve_sync
retrieve_sync(workspace_id: str, sync_id: str) -> WorkspaceSync
Read a workspace sync: its status and each volume's progress and result.
Parameters
workspace_id(str): The workspace's id.sync_id(str): The sync's id (syncanswered it).
Returns
WorkspaceSync: The sync. One whose workspace stopped, or whose storage restarted, before it finished isfailed, with why in each volume's result.
Raises
NotFoundError: The workspace has no such sync.
start_execution
start_execution(workspace_id: str, command: str, *, cwd: str | None = None, idempotency_key: str | None = None) -> WorkspaceExecution
Start a shell command in a running workspace; answers within a short wait.
The execution, ended (completed or failed, with the first page of
its output) when it ended within the wait, else running: follow it with
wait_for_execution or retrieve_execution. When the
connection drops before the answer, the start is sent again with the same
Idempotency-Key, which answers the same execution: the command runs once.
Parameters
workspace_id(str): The workspace's id.command(str): The command, run by a shell.cwd(str | None, optional): The directory to run it in.idempotency_key(str | None, optional): The execution's key (1 to 255 characters); omitted, a new one.
Raises
ConflictError: The workspace is not ready (workspace-not-ready).UnprocessableEntityError: The key was used for another command (idempotency-key-reused).
stats
stats(*, search: str | None = None, status: str | None = None, project_id: str | None = None) -> WorkspaceStats
Count the workspaces list lists, with the same filters.
It counts them in all, by status and by the IDE each opens.
Every workspace the list holds for you with these filters is counted (not a page).
Parameters
search, status, project_id(optional): Aslisttakes them.
Returns
WorkspaceStats:total,by_statusandby_environment(most first).
status
status(workspace_id: str) -> WorkspaceStatus
Ask the cluster for a workspace's status now.
Parameters
workspace_id(str): The workspace's id.
Returns
WorkspaceStatus: The status, the IDE's path and any error.
Raises
NotFoundError: There is no such workspace.
sync
sync(workspace_id: str) -> WorkspaceSync
Start saving a running workspace's work to its volumes (its owner only).
The project volume's code is committed and pushed (a shared volume's
code is read-only and never pushed), and each data file changed in a
volume the owner may write is saved as a new version of that file, in
batches. The sync runs in the background in the workspace: this
answers at once with the sync (status running); follow it with
retrieve_sync until it is completed, cancelled or
failed, and start a job that reads the saved data only once it is
completed. cancel_sync stops it; what it committed stays.
Unsynced work survives stop, start and restart; only deleting the
workspace loses it.
Parameters
workspace_id(str): The workspace's id.
Returns
WorkspaceSync: The sync, running.
Raises
ConflictError: The workspace is not running, a sync of it is already running (error_codeconflict), or its storage is not ready yet.PermissionDeniedError: You are not the workspace's owner.
sync_conflicts
sync_conflicts(workspace_id: str) -> WorkspaceMerges
List the files a workspace still has to decide after a Sync conflict.
Parameters
workspace_id(str): The workspace's id.
time_series
time_series(workspace_id: str, *, window: SeriesWindow | None = None, granularity: SeriesGranularity | None = None) -> ResourceUsageSeries
Get a workspace's CPU and memory over time, from its hourly usage records.
Each point holds the mean used (weighted by the minutes it ran), its busiest hour, and its
size; None where it did not run.
Every hour (24h) or UTC day (7d, 30d) of the window is a point, from the one
its start falls in to the current one; a quiet point counts zero.
Parameters
workspace_id(str): The workspace ID.window({"24h", "7d", "30d"} | None, optional): The window. The API's default is"30d".granularity({"hourly", "daily"} | None, optional):hourlyfor24h,dailyotherwise; the window's when left out (another is refused).
volumes
volumes(workspace_id: str, *, group: str, q: str | None = None, sort: str | None = None) -> SyncPaginator[WorkspaceMount]
List a workspace's mounted volumes.
Parameters
workspace_id(str): The workspace's id.group(str):project(the project's volume) orshared.q(str | None, optional): Only volumes whose name contains this text.sort(str | None, optional):name,createdAtorupdatedAt; a leading-sorts descending.
wait_for_execution
wait_for_execution(workspace_id: str, execution: WorkspaceExecution | str, *, poll_interval: float = 2.0) -> CommandResult
Follow an execution to its end and return its result with its whole output.
Reads it every poll_interval seconds while it runs, and page by page
until its output is read whole. A dropped connection is read again.
Parameters
workspace_id(str): The workspace's id.execution(WorkspaceExecution | str): The executionstart_executionanswered (its output so far is kept), or an execution's id (read from the start).poll_interval(float, optional): Seconds between reads while it runs.
Raises
StronglyError: The command failed in the workspace, or its output is no longer kept.