The Gitpod SDK provides powerful tools for developers to interact programmatically with Gitpod environments. It allows you to automate environment creation, run tasks, manage automations, and scale infrastructure with Gitpod runners. Available in Python, Node/Typescript, and Go, the SDK gives developers flexibility in their choice of language.
Once you’ve installed the SDK, authenticate using your personal access token. You can either set it via the environment variable or explicitly pass it in your code.
Option 1: Set the environment variable GITPOD_API_KEY:
Copy
Ask AI
export GITPOD_API_KEY="your_token_here"
Option 2: Authenticate directly in your code:
For Python SDK:
Copy
Ask AI
from gitpod_sdk import Gitpodgitpod = Gitpod(bearer_token="your_token_here")
Once authenticated, you can start experimenting with the SDK by running one of the examples. Here’s an example of how to create an environment and run a command inside it using the Python SDK: