This is the first initial release of the Lightning SDK since open-sourcing the repository. It establishes the public home for the SDK across Python, CLI, TypeScript, and Go.
Python SDK
The Python SDK provides the high-level interface for working with Lightning AI resources from Python applications and automation scripts.
from lightning_sdk import Studio, Machine
studio = Studio("sdk-demo", teamspace="owner/teamspace", create_ok=True)
studio.start(Machine.CPU)
print(studio.run("python --version"))
studio.stop()Command Line Interface
The CLI supports terminal-first workflows, shell scripts, and CI jobs for managing Lightning resources.
lightning studio start --name sdk-demo --teamspace owner/teamspace --machine CPU
lightning job run \
--name train-job \
--teamspace owner/teamspace \
--studio sdk-demo \
--command "python train.py"Raw API Access
Raw API access gives users an authenticated escape hatch for endpoints that do not yet have dedicated SDK or CLI commands.
PROJECT_ID="$(lightning-sdk api /v1/memberships | jq -r '.memberships[0].projectId')"
lightning-sdk api "/v1/projects/${PROJECT_ID}/jobs" -X GET -F limit=20TypeScript SDK
The TypeScript SDK focuses on Lightning AI sandboxes for Node.js automation, including command execution, file operations, PTY sessions, snapshots, and persistent sandbox workflows.
import { Sandbox } from "@lightningai/sdk";
const sandbox = await Sandbox.create({
name: "typescript-demo",
instanceType: "cpu-1",
});
const result = await sandbox.runCommand("echo", ["hello from Lightning"]);
console.log(result.output);
await sandbox.delete();Go SDK
The Go SDK exposes Lightning resources as typed handles for backend services, infrastructure tooling, and strongly typed automation.
package main
import (
"fmt"
"log"
lit "github.com/lightning-ai/sdk/go"
)
func main() {
org, err := lit.GetOrganization("my-org")
if err != nil {
log.Fatal(err)
}
teamspace, err := lit.GetTeamspace("my-teamspace", lit.TeamspaceOptions{Owner: org})
if err != nil {
log.Fatal(err)
}
job, err := lit.RunJob(
"go-demo-job",
lit.MachineCPU,
"python -c 'print(\"hello from Lightning\")'",
lit.JobOptions{
Teamspace: teamspace,
Image: "python:3.11-slim",
},
)
if err != nil {
log.Fatal(err)
}
if err := job.Wait(); err != nil {
log.Fatal(err)
}
fmt.Println(job.Status())
}