Python SDK
The Python SDK exposes two clients:
| Client | Use case |
|---|---|
AsyncRunta | Async applications and services. |
Runta | Sync scripts, notebooks, and command-line workflows. |
Install
Section titled “Install”pip install runta-sdkWhen working from the SDK source repository, install it in editable mode:
uv pip install -e .Configure
Section titled “Configure”The SDK needs a tenant token. The hosted REST API endpoint defaults to
https://api.runta.dev.
export RUNTA_TOKEN=rt_your_tokenFor a local or custom API endpoint:
export RUNTA_ENDPOINT=http://127.0.0.1:8080You can also pass explicit values:
from runta import AsyncRunta
runta = AsyncRunta( endpoint="http://127.0.0.1:8080", token="rt_your_token",)from runta import Runta
runta = Runta( endpoint="http://127.0.0.1:8080", token="rt_your_token",)Client Lifecycle
Section titled “Client Lifecycle”Use either client as a context manager so the underlying HTTP resources are closed cleanly.
import asynciofrom runta import AsyncRunta
async def main(): async with AsyncRunta() as runta: runtime = await runta.runtimes.create("hello-async") result = await runtime.exec("echo hello world") print(result.stdout_text) await runtime.delete()
asyncio.run(main())from runta import Runta
with Runta() as runta: runtime = runta.runtimes.create("hello-sync") result = runtime.exec("echo hello world") print(result.stdout_text) runtime.delete()