SDK to develop using Lightning AI Studios
Actively maintained. Last release 10 days ago, commits in 22 of the last 26 weeks. A safe choice.
pip install lightning-sdkLightning SDK for Python
Automate Lightning AI resources from Python scripts, notebooks, and CI.
Quick start • Examples • CLI • Development • Docs
Why Lightning SDK?
Lightning SDK turns Lightning AI into a Python API. Use it to create and manage compute, run training or batch jobs, operate persistent studios, deploy containers, inspect logs, and manage sandboxes without leaving your code.
It is designed for automation first: scripts can resolve teamspace scope, start machines, wait for work to finish, collect output, and tear resources down in the same flow.
Build on Lightning AI, the platform for training, deploying, and scaling AI applications with managed compute, collaborative studios, and production endpoints.
Quick start
Install the package:
pip install lightning-sdk
Authenticate once:
lightning login
Or export credentials from Lightning AI account settings:
export LIGHTNING_API_KEY="..."
Run a sandbox command:
from lightning_sdk.sandbox import Sandbox
sandbox = Sandbox.create(name="python-readme", instance_type="cpu-1")
command = sandbox.run_command("python --version")
print(command.output)
sandbox.delete()
Sandbox-only API keys can also be set with LIGHTNING_SANDBOX_API_KEY or
passed through Sandbox.configure(...).
Examples
Work with a studio
from lightning_sdk import Machine, Studio
studio = Studio("research", teamspace="owner/teamspace", create_ok=True)
studio.start(Machine.CPU)
print(studio.status)
print(studio.run("python --version"))
studio.stop()