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.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 Variables, imports, and function definitions persist across
wrenn.code_interpreter:run_code calls within the same capsule session.