For advanced use cases where you need fine-grained control over individual API calls — building your own abstractions, batching operations, or calling endpoints without constructing a full Capsule object — use WrennClient or AsyncWrennClient directly.
WrennClient is what the high-level Capsule class uses internally. You only need to reach for it when the Capsule abstraction is not the right fit for your use case.
Synchronous client
Instantiate WrennClient with your API key and use it as a context manager to ensure the HTTP connection pool is closed when you’re done:
If you prefer managing the lifecycle manually, call client.close() when finished.
Constructor parameters
If api_key is not passed, the client reads WRENN_API_KEY from the environment. If neither is set, instantiation raises a ValueError. The base_url parameter is primarily useful when pointing at a staging environment or a self-hosted deployment.
Capsule operations
client.capsules exposes all capsule control-plane operations:
capsules.create parameters
Snapshot operations
client.snapshots lets you create, list, and delete snapshot templates:
Snapshots capture the full filesystem and memory state of a capsule into a reusable template. Pass the template name to capsules.create(template=...) to boot a new capsule from it.
Async client
AsyncWrennClient provides the same interface with async/await semantics. Use it as an async context manager:
Every method on AsyncWrennClient.capsules and AsyncWrennClient.snapshots is a coroutine — prefix each call with await. To close the connection manually without a context manager, call await client.aclose().
AsyncWrennClient uses an httpx.AsyncClient internally. Do not share a single instance across multiple event loops. Create a new client per event loop or per request if you are using a framework that manages loop lifecycles (e.g. FastAPI, Starlette).