Skip to main content

Ona Python SDK

The public Python SDK exposes stable workflows from ona_sdk. For lower-level access, generated protobuf modules are available under gitpod.* and generated Connect service clients are available from client.services.

Install the package with pip install gitpod-sdk.

Run a Codex task in a repository with one call:

from gitpod.v1 import agent_pb2
from ona_sdk import create_client_from_env

ona = create_client_from_env()
run = ona.run_codex(
    repository_url="https://github.com/gitpod-io/template-golang-cli",
    task="Inspect the repository and improve its README.",
    model=agent_pb2.CODEX_OPEN_AI_MODEL_GPT_5_6_SOL,
    reasoning_effort=agent_pb2.CODEX_REASONING_EFFORT_HIGH,
)

for chunk in run.message_stream():
    print(chunk, end="")
result = run.watch_result()
run.delete_environment(force=True)

Omit repository_url for an empty scratch workspace. The message stream is live-only, and the caller must explicitly stop or delete the created environment.

from ona_sdk import create_client_from_env

ona = create_client_from_env()
env = ona.environments().create("https://github.com/gitpod-io/template-golang-cli")

result = env.run_command(
    command="pwd && git status --short",
    working_directory=env.workspace_dir(),
)

print(result.stdout)

create_client_from_env() reads ONA_API_KEY and falls back to GITPOD_API_KEY. If both are set, ONA_API_KEY takes precedence. It uses https://app.ona.com/api by default and accepts ONA_BASE_URL for a custom management-plane domain, local development, or replay verification. Use create_client(api_key=..., base_url=...) to pass values explicitly.

Use client.services when an operation is not covered by a high-level workflow:

from gitpod.v1.environment_pb2 import ListEnvironmentsRequest
from ona_sdk import create_client_from_env

client = create_client_from_env()
response = client.services.environment.list_environments(
    ListEnvironmentsRequest(),
)

The generated clients include every RPC in the public protobuf API and inherit the SDK's authentication, base URL, user agent, and default timeout. Direct calls raise connectrpc.errors.ConnectError; high-level workflows continue to raise the SDK error types documented below.

Pass new_debug_logger() to the client to get human-readable SDK debug logs. The formatter uses ANSI colors by default and honors NO_COLOR; pass no_color=True when writing plain logs.

The SDK is structured as:

  • create_client* creates an SDK client for production Connect API calls.
  • client.services provides typed, direct access to public API services.
  • client.environments() returns environment workflows.
  • client.run_codex() creates a workspace and starts an initial Codex task in one call.
  • environments.create/get/list/start/stop/delete manages environments.
  • Environment.run_command/read_file/write_file/git_changes performs environment ops.
  • Environment.start_codex starts Codex in that environment.
  • AgentSession.send_message/message_stream/watch_result interacts with the agent execution.

Runnable examples live in examples/.

High-level workflows and direct API access use the official Connect Python runtime and generated clients. Supervisor environment-ops calls use a small private Connect transport because generated supervisor service clients are not available. The package does not ship generated gRPC clients.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitpod_sdk-1.0.0.tar.gz (357.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitpod_sdk-1.0.0-py3-none-any.whl (400.4 kB view details)

Uploaded Python 3

File details

Details for the file gitpod_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: gitpod_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 357.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for gitpod_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 46249e03bbbe705cdc67b8ae4582b50fef6ab4ddfe4a2e5b54bbd053ad4f3611
MD5 a88f7f03fddf50dd0afbe2958ff21a22
BLAKE2b-256 9ea17de7ae70a458573bebbde2ff82d0e21b19390f795b3f033dee13228114fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitpod_sdk-1.0.0.tar.gz:

Publisher: publish-public-sdks.yml on gitpod-io/gitpod-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitpod_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gitpod_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 400.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for gitpod_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44b6c91b63a5cd5ad43ef23bc8cc77152c0fba00d1be3140ceeed502db778cf0
MD5 215177b868c0511ca91916716595e997
BLAKE2b-256 a5d8c37f3fce4c1948d6103e649bd2e0b22c2a31c9360d376e314e4de5210ede

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitpod_sdk-1.0.0-py3-none-any.whl:

Publisher: publish-public-sdks.yml on gitpod-io/gitpod-next

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page