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.
- Merge changes to
mainusing Conventional Commits (feat:→ minor,fix:→ patch,feat!:/BREAKING CHANGE→ major). - release-please keeps a Release PR open that bumps
__version__and updatesCHANGELOG.md. Merge it when you want to cut a release. - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
040fc3e051954e49fcaaf8018876c74478a0b64b2f2c32b64d55b8d487ee451a
|
|
| MD5 |
5bf18e90e7b727576c2a61db35fa2b9e
|
|
| BLAKE2b-256 |
d84c528e2705c3be6f2482494b474a249538ed86199d49521291e4f749d7cf83
|
Provenance
The following attestation bundles were made for glassflow_ai-0.1.0.tar.gz:
Publisher:
release.yml on glassflow/glassflow-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glassflow_ai-0.1.0.tar.gz -
Subject digest:
040fc3e051954e49fcaaf8018876c74478a0b64b2f2c32b64d55b8d487ee451a - Sigstore transparency entry: 2057337715
- Sigstore integration time:
-
Permalink:
glassflow/glassflow-python@88e79be6e6af695dc9eb2a1d3e573df18616b4b7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/glassflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88e79be6e6af695dc9eb2a1d3e573df18616b4b7 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf9271333069812291d002bf585669dc0777ae66e6d303dadaa3f6a7046a2f2f
|
|
| MD5 |
86f878378668ac7a29b083e2acfecbb8
|
|
| BLAKE2b-256 |
1d280b22ec4592ba42b6dee3179a9a014fea5c9d6f7735b241949955614d4ec6
|
Provenance
The following attestation bundles were made for glassflow_ai-0.1.0-py3-none-any.whl:
Publisher:
release.yml on glassflow/glassflow-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glassflow_ai-0.1.0-py3-none-any.whl -
Subject digest:
bf9271333069812291d002bf585669dc0777ae66e6d303dadaa3f6a7046a2f2f - Sigstore transparency entry: 2057338151
- Sigstore integration time:
-
Permalink:
glassflow/glassflow-python@88e79be6e6af695dc9eb2a1d3e573df18616b4b7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/glassflow
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@88e79be6e6af695dc9eb2a1d3e573df18616b4b7 -
Trigger Event:
push
-
Statement type: