Skip to main content

GlassFlow SDK — OpenTelemetry-native tracing for AI agents and LLM applications.

Project description

GlassFlow Python SDK

OpenTelemetry-native tracing for AI agents and LLM applications. glassflow-ai emits OpenTelemetry GenAI traces over OTLP to the managed GlassFlow observability platform (or any OTLP-compatible backend).

Status: alpha. APIs may change.

Install

pip install glassflow-ai

Quickstart

import glassflow
from glassflow import observe, start_as_current_generation, start_as_current_span
from glassflow.semconv import SpanKind

glassflow.init(
    api_key="glassflow_...",          # or set GLASSFLOW_API_KEY
    service_name="my-agent",          # or set GLASSFLOW_SERVICE_NAME
)

# 1. Decorator — trace a whole function
@observe
def handle(query: str) -> str: ...

# 2. Context manager — trace a block
with start_as_current_span("retrieve", kind=SpanKind.RETRIEVER) as obs:
    obs.set_output(docs)

# 3. LLM generations — gen_ai-native
with start_as_current_generation("chat", model="gpt-4o", input=messages) as gen:
    gen.set_output(reply)
    gen.set_usage(input_tokens=42, output_tokens=17)

Each surface has a manual variant for lifetimes a with block can't express (streaming, callbacks): start_span(...) / start_generation(...) return a handle you .update() and must .end() yourself.

Configuration is resolved from explicit arguments first, then environment variables:

Argument Environment variable Default Description
endpoint GLASSFLOW_ENDPOINT https://ingest.glassflow.dev Base OTLP endpoint. Traces are sent to <endpoint>/v1/traces.
api_key GLASSFLOW_API_KEY Injected as an Authorization: Bearer <key> header on every export.
service_name GLASSFLOW_SERVICE_NAME unknown_service Sets the OpenTelemetry service.name resource attribute.
disabled GLASSFLOW_DISABLED false Kill switch. When true, spans are created but never exported.

Development

uv sync --group dev
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mypy

Releasing

Releases are automated with release-please and published to PyPI via Trusted Publishing.

  1. Merge changes to main using Conventional Commits (feat: → minor, fix: → patch, feat!:/BREAKING CHANGE → major).
  2. release-please keeps a Release PR open that bumps __version__ and updates CHANGELOG.md. Merge it when you want to cut a release.
  3. Merging tags vX.Y.Z, creates a GitHub Release, and publishes to PyPI automatically.

Non-conventional commits are ignored for versioning.

License

MIT

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

glassflow_ai-0.1.0.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

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

glassflow_ai-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file glassflow_ai-0.1.0.tar.gz.

File metadata

  • Download URL: glassflow_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glassflow_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 040fc3e051954e49fcaaf8018876c74478a0b64b2f2c32b64d55b8d487ee451a
MD5 5bf18e90e7b727576c2a61db35fa2b9e
BLAKE2b-256 d84c528e2705c3be6f2482494b474a249538ed86199d49521291e4f749d7cf83

See more details on using hashes here.

Provenance

The following attestation bundles were made for glassflow_ai-0.1.0.tar.gz:

Publisher: release.yml on glassflow/glassflow-python

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

File details

Details for the file glassflow_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: glassflow_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for glassflow_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf9271333069812291d002bf585669dc0777ae66e6d303dadaa3f6a7046a2f2f
MD5 86f878378668ac7a29b083e2acfecbb8
BLAKE2b-256 1d280b22ec4592ba42b6dee3179a9a014fea5c9d6f7735b241949955614d4ec6

See more details on using hashes here.

Provenance

The following attestation bundles were made for glassflow_ai-0.1.0-py3-none-any.whl:

Publisher: release.yml on glassflow/glassflow-python

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 Pingdom Monitoring Sentry Error logging StatusPage Status page