Child Spaces (experiment)

Let a Space make Spaces of its own, set the budget of its tree and list orphans.

These calls belong to the Child Spaces experiment (cua experiments enable child-spaces) and are refused while it is off. set_children lets a Space make children through a channel only it can reach; tree_budget and set_tree_budget bound what a tree may hold and spend; orphans lists children whose parent is gone. See Child Spaces.

Children#

Methods of Spaces.

Spaces.set_children#

Lets a Space make child Spaces of its own, or stops it. While on, cua, the SDKs and the agent's tools in that Space create, list and delete Spaces that belong to it (on the same computer, never wider than it, ending no later than it), through a channel only it can reach. Off ends its capability at once; children it made keep running until deleted or their lifetime ends. Only for a Space the machine of this runtime runs itself.

async def set_children(self, space: str, enabled: bool) -> None
ParameterTypeDefault
spaceStringrequired
enabledboolrequired

Async · Raises CuaError

Spaces.tree_budget#

The budget of space's tree (any Space of it) and what its children use now. Kept by the cua daemon.

async def tree_budget(self, space: str) -> TreeBudget
ParameterTypeDefault
spaceStringrequired

Returns TreeBudget · Async · Raises CuaError

Spaces.set_tree_budget#

Sets the budget of space's tree: how many child Spaces, vCPUs and memory its children may hold at once, and what they may cost. A child that does not fit is refused with what is left. All None removes it.

async def set_tree_budget(self, space: str, limits: TreeBudgetLimits) -> TreeBudget
ParameterTypeDefault
spaceStringrequired
limitsTreeBudgetLimitsrequired

Returns TreeBudget · Async · Raises CuaError

Spaces.orphans#

Child Spaces whose parent is gone or out of reach. The cua daemon ends a child only on proof its parent is gone (after a grace period); the rest are listed here and never ended by it.

async def orphans(self) -> List[SpaceOrphan]

Returns Vec<SpaceOrphan> · Async · Raises CuaError

TreeBudget record#

A tree's budget and what its children use (Spaces.tree_budget).

Returned by Spaces.set_tree_budget, Spaces.tree_budget.

FieldTypeDefaultDescription
rootStringThe tree's top-level Space.
setTreeBudgetLimitsWhat the owner set.
max_spaces / maxSpacesu32Child Spaces it may hold at once.
max_vcpus / maxVcpusu32vCPUs it may hold at once.
max_memory_mb / maxMemoryMbu64Memory it may hold at once (MiB).
usd_per_hour / usdPerHourf64Cost per hour it may run at.
usd_total / usdTotalOption<f64>Cost in total it may reach, when capped.
spacesu32Child Spaces now.
vcpusu32vCPUs they hold.
memory_mb / memoryMbu64Memory they hold (MiB).
usd_per_hour_used / usdPerHourUsedf64Cost per hour they run at.
usd_spent / usdSpentf64What they have cost so far.

TreeBudgetLimits record#

What a tree's children may hold and cost (Spaces.set_tree_budget). None: the default.

FieldTypeDefaultDescription
max_spaces / maxSpacesOption<u32>NoneChild Spaces at once (default 16).
max_vcpus / maxVcpusOption<u32>NonevCPUs at once (default 16).
max_memory_mb / maxMemoryMbOption<u64>NoneMemory at once, MiB (default 32768).
usd_per_hour / usdPerHourOption<f64>NoneCost per hour, in linked clouds (default 2.0).
usd_total / usdTotalOption<f64>NoneCost in total (default: none).

SpaceOrphan record#

A child Space whose parent is gone or out of reach (Spaces.orphans).

Returned by Spaces.orphans.

FieldTypeDefaultDescription
spaceStringThe child.
parentStringIts parent's id.
stateStringending (its parent is provably gone: it ends after the grace) or listed (not this computer's to judge: it stays until deleted or its own lifetime ends).
whyStringWhy.
ends_in_secs / endsInSecsi64Seconds until it ends (ending only).