Skip to main content
Wrenn runs your code inside isolated virtual machines called capsules. This guide walks you through installing the SDK, authenticating, and running your first command — all in a few minutes.
The Wrenn SDK requires Python 3.13 or later.
1

Install the SDK

Install the wrenn package from PyPI:
2

Set your API key

Generate an API key from the Wrenn dashboard and export it as an environment variable:
The SDK reads WRENN_API_KEY automatically — you don’t need to pass it in code.
Pass wait=True when creating a capsule to block until it reaches the running state before you start sending commands.
3

Create a capsule and run a command

Use Capsule as a context manager. When the with block exits, the capsule is automatically destroyed.
capsule.commands.run() runs the command in the foreground and returns a result with stdout, stderr, exit_code, and duration_ms.
4

Try the code interpreter

For stateful Python execution backed by a persistent Jupyter kernel, use wrenn.code_interpreter:
Variables, imports, and function definitions persist across run_code calls within the same capsule session.