Capsule class in the Python SDK — creating them, running commands, reading files, and opening terminals — then destroy them when you’re done.
Creating a capsule
The simplest way to create a capsule is to construct aCapsule directly. The SDK reads your API key from the WRENN_API_KEY environment variable and starts the capsule immediately.
wait=True parameter blocks until the capsule reaches running status before returning:
Capsule.create() is a classmethod that is exactly equivalent to calling Capsule() directly:
Context manager
Use a capsule as a context manager to ensure it is destroyed automatically when the block exits, even if an exception is raised:Connecting to an existing capsule
Attach to a capsule that is already running (or paused) using its ID. If the capsule is paused,connect resumes it automatically before returning.
Capsule IDs always start with the
cl- prefix (for example, cl-abc123).Listing and inspecting capsules
get_info() refreshes and returns the latest metadata:
Destroying a capsule
What’s next
Lifecycle
Pause, resume, and monitor capsule state.
Commands
Run foreground, background, and streaming commands.
Filesystem
Read, write, and stream files inside a capsule.
Terminal
Open interactive PTY sessions inside a capsule.