Skip to main content

Gravix Layer Python SDK — agent runtimes and templates (Alpha; API may evolve). See docs.gravixlayer.ai.

Project description

Gravix Layer Python SDK

PyPI version Python 3.9+ License: Apache 2.0

Official Python client for Gravix Layer — create and manage cloud agent runtimes and templates for your workloads.

Install

pip install gravixlayer

Configure

export GRAVIXLAYER_API_KEY="your-api-key"
export GRAVIXLAYER_CLOUD="azure"       # default
export GRAVIXLAYER_REGION="eastus2"    # default

Or pass options to the client:

from gravixlayer import GravixLayer

client = GravixLayer(
    api_key="your-api-key",
    base_url="https://api.gravixlayer.ai",
    cloud="azure",
    region="eastus2",
)

Quick start

from gravixlayer import GravixLayer

client = GravixLayer()
runtime = client.runtime.create(template="python-3.12-base-small")

result = client.runtime.run_code(
    runtime.runtime_id,
    code="print('Hello from Gravix Layer')",
)
print(result.text)

client.runtime.kill(runtime.runtime_id)

Performance note (connections and HTTP/2)

The client uses HTTP/1.1 by default for predictable latency on typical API usage.

  • Warm the connection before creating many runtimes: call client.warmup() once (or use warmup_on_init=True when constructing the client). That pays TCP, TLS, and protocol setup up front so the first real request is cheaper.
  • HTTP/2: pass http2=True to the GravixLayer client constructor if you want multiplexing over a single established connection after TLS (useful for high concurrency). Requires the httpx[http2] extra (already declared by this package).

Sync:

from gravixlayer import GravixLayer

client = GravixLayer(http2=True)
client.warmup()
# or: GravixLayer(http2=True, warmup_on_init=True)

Async: pass http2=True to AsyncGravixLayer and call await client.warmup() before heavy traffic.

from gravixlayer import AsyncGravixLayer

async with AsyncGravixLayer(http2=True) as client:
    await client.warmup()

Async

import asyncio
from gravixlayer import AsyncGravixLayer

async def main():
    async with AsyncGravixLayer() as client:
        runtime = await client.runtime.create(template="python-3.12-base-small")
        await client.runtime.kill(runtime.runtime_id)

asyncio.run(main())

Documentation and examples

Support

support@gravixlayer.ai

Feedback: gravixlayer/gravixlayer-feedback — open an issue for bugs, features, and general product feedback.

License

Apache License 2.0 — see LICENSE.
Copyright 2026 Gravix Layer.

Project details


Download files

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

Source Distribution

gravixlayer-0.1.25.tar.gz (107.8 kB view details)

Uploaded Source

Built Distribution

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

gravixlayer-0.1.25-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file gravixlayer-0.1.25.tar.gz.

File metadata

  • Download URL: gravixlayer-0.1.25.tar.gz
  • Upload date:
  • Size: 107.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gravixlayer-0.1.25.tar.gz
Algorithm Hash digest
SHA256 2b8341668d5ffcdd87ea97fe324cf1f02d73028dd43e7414278b6551a1f79d19
MD5 420bc70da79dbc146ce616348b3256be
BLAKE2b-256 5a7defb0113b0af7491f1cc0793002f0a551e6a659ac04888898064880379927

See more details on using hashes here.

File details

Details for the file gravixlayer-0.1.25-py3-none-any.whl.

File metadata

  • Download URL: gravixlayer-0.1.25-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gravixlayer-0.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 40213e4d33ad497ca77e4a779cb063d62c241606d9404d6f5c8329ade91e0aef
MD5 0b3796475ab7c30b3c75625f5f6233b2
BLAKE2b-256 6ff9d93c3e8c4ebea8721da1d5f1086b22216e8768fae94b2818dd3197d7cf08

See more details on using hashes here.

Supported by

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