Skip to main content

Module container

Module container 

Source
Expand description

Where a new agent runs: the runtime, container_image, memory_mb and cpus of Agents spawn (a worker) and Agents create (a named agent from a template).

Without them a worker runs as its leader does (copy_definition keeps the type and the image), and a created agent as its template says. With them, the new agent can run in a container when its caller runs on the host. The protections are the ones the rest of the container API has: a container caller starts only container agents (a container is not a way to a host process) and does not set limits (it asks a host agent, as for its own), and a container is refused when Docker is not there, with the reason.

Structs§

ContainerPlan 🔒
A container agent as asked for: the image, and the limits to store (None: leave them automatic).

Enums§

Placement 🔒
Where the new agent runs.

Constants§

SETTING_DEFAULT_RUNTIME
The per-user setting for where a new agent runs when the call does not say: container (the default) or native. Spec: docs/specs/SPEC_AGENT_MODEL_ROUTES_ANY_MODEL_SPAWN_AND_SWITCH_2026_11_06.md section 10.

Functions§

apply 🔒
Make def (just inserted) a container agent as plan says, and store its limits. A native placement on a definition that was a container one (a template’s) is agent_type and environment back to the host’s.
decide 🔒
Check what ask wants, without making anything. caller_in_container: the asking agent runs in a container. source_in_container and source_image: how the source (the leader, or the template) runs, which runtime and container_image default to. docker: whether a container can be made here, or why not.
decide_here 🔒
decide for a caller caller and a source defined by source, asking this machine whether Docker is there. provider is the harness the new agent runs. A call that says nothing about where gets the setting’s default: a container, when the harness has an image and Docker answers, and otherwise as its source runs (never refused, since nobody asked for a container). A caller or a source that already runs in a container keeps what it did.
default_is_container 🔒
Whether the setting leaves a new agent in a container: everything but native (or host) does.
has_container_image 🔒
Whether the harness has a container image. The same list as containerSupported in the frontend’s defaults/cli-catalog.ts: only Claude Code has an image built, so every other harness stays native.