Overview
TheContainersClient lets you run temporary containers inside a room. Use it for one-off jobs, debugging, image management, or testing code in the same room environment that deployed services use.
CLI commands
Start with the CLI help, then use a few common commands:bash
Why use the Containers API?
- Pull and manage images without leaving the room context.
- Run short-lived workloads or exploratory commands on demand.
- Inspect logs or open an interactive terminal in a running container.
How it works
Containers are room-scoped workloads. You can pull images, run a container, stream logs, exec into it, stop it, and delete its metadata when you are done. Deployed Room Services and Project Services rely on the same underlying container infrastructure, but the Containers API gives you direct, on-demand control.Permissions and grants
The Containers API is controlled by thecontainers grant on the participant token.
In practice:
use_containersis the main switch for container operationspullandruncan be narrowed to specific image names or prefixeslogscontrols access to container log streaming
API reference
Use the methods below to manage room images, start and inspect containers, and clean up container state. The SDKs also expose image-transfer helpers such aspush_image, load / load_image, save_image, build helpers such as build, list_builds, cancel_build, delete_build, and get_build_logs, and service helpers such as run_service.
list_images()
- Description: List images currently available to the room (built or pulled previously).
- Parameters: None.
- Returns:
list[Image]summary records includingid,preferred_ref,references,labels,created_at,updated_at, andtarget_media_type.
inspect_image(image_id)
- Description: Inspect a room image by ID and return detailed content metadata from the container runtime.
- Parameters:
image_id: Image ID fromlist_images().
- Returns:
ImageInspectionincluding the image summary, target descriptor, selected manifest, manifests, config descriptor, layers, andcontent_size.
delete_image(image)
- Description: Delete an unused image from the room.
- Parameters:
image: Tag or digest string to delete.
- Returns:
None.
pull_image(tag, credentials=None)
- Description: Pull an image into the room. Supports passing registry credentials when needed.
- Parameters:
tag: Image reference (e.g.myrepo/app:latest).credentials: Optional list ofDockerSecretcredentials for private registries.
- Returns:
Noneonce the pull completes.
run(image, ...)
- Description: Start a container in the room.
- Parameters (all optional except
image):image: Container image to run.command: Override the default command (str).env: Environment variables injected asdict[str, str].mount_path,mount_subpath: Mount configuration when using storage.role,participant_name: Launch on behalf of a specific room identity.ports: Port mappings{container_port: host_port}.credentials: Registry secrets for the image.name: Friendly name for the container.template: Runtime defaults to apply."none"(default) applies no template defaults;"agent"mounts room storage at/dataand injects MeshAgent/OpenAI/Anthropic/SMTP proxy environment variables using a token for the container name with roleagent.
- Returns: Container ID string.
exec(container_id, ...)
- Description: Attach an interactive command to an existing container and stream its output.
- Parameters:
container_id: Target container.command: Optional command list; defaults to the container’s shell.tty: Request a TTY session (Truefor interactive).detach: Leave the session running in the background (Trueby default).
- Returns: An exec-session object (
ExecSessionin Python) exposing helpers to read output, send input, resize the terminal, and await completion.
Image transfer helpers
In addition to pulling an image into a room, the CLI can push an image from the room to a registry, load an OCI archive from room storage, or save an image as an OCI archive:bash
logs(container_id, follow=False)
- Description: Stream container logs and optionally follow until exit.
- Parameters:
container_id: Target container.follow:Trueto keep streaming until the container exits.
- Returns:
LogStream[None], which you can iterate for log lines or await for completion.
list(all=False)
- Description: List containers in the room, optionally including exited ones.
- Parameters:
all:Trueto include stopped containers.
- Returns:
list[RoomContainer]with name, image, state, status, applicable manifest, and metadata about who started it.
stop(container_id, force=False)
- Description: Request a graceful stop (or force stop) of a running container.
- Parameters:
container_id: Target container.force: Send a forceful termination signal whenTrue.
- Returns:
None.
delete(container_id)
- Description: Remove container metadata after it has stopped. Useful for cleaning up history.
- Parameters:
container_id: Container to delete.
- Returns:
None.