Skip to main content

glassbrain

AI-native error tracking and observability for Python applications. Captures errors, LLM calls, and application traces with AI-powered fix suggestions.

Installation

pip install glassbrain

Quick Start

from glassbrain import GlassBrain

gb = GlassBrain(api_key="gb_your_key")

# Capture errors
try:
    risky_operation()
except Exception as e:
    gb.capture_error(e, metadata={"user_id": "123"})

# Capture warnings and info
gb.capture_warning("Disk usage above 90%")
gb.capture_info("Deployment completed", metadata={"version": "1.2.0"})

# Get AI fix suggestions for a trace
suggestions = gb.get_suggestions(trace_id="...")

Auto-trace OpenAI calls

from openai import OpenAI
from glassbrain import GlassBrain, wrap_openai

gb = GlassBrain(api_key="gb_your_key")
client = wrap_openai(OpenAI(), gb)

# All completions are now traced automatically
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello"}]
)

Auto-trace Anthropic calls

from anthropic import Anthropic
from glassbrain import GlassBrain, wrap_anthropic

gb = GlassBrain(api_key="gb_your_key")
client = wrap_anthropic(Anthropic(), gb)

response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}]
)

Decorators

from glassbrain import GlassBrain, trace_function, trace_endpoint

gb = GlassBrain(api_key="gb_your_key")

@trace_function(gb)
def process_data(items):
    # Automatically traces errors and performance
    ...

@trace_endpoint(gb)
def handle_request():
    # Traces API endpoint calls
    ...

Framework Middleware

FastAPI

from fastapi import FastAPI
from glassbrain import GlassBrain
from glassbrain.middleware import FastAPIMiddleware

app = FastAPI()
gb = GlassBrain(api_key="gb_your_key")
app.add_middleware(FastAPIMiddleware, glassbrain=gb)

Flask

from flask import Flask
from glassbrain import GlassBrain
from glassbrain.middleware import FlaskMiddleware

app = Flask(__name__)
gb = GlassBrain(api_key="gb_your_key")
FlaskMiddleware(app, glassbrain=gb)

Django

Add to settings.py:

GLASSBRAIN_API_KEY = "gb_your_key"

MIDDLEWARE = [
    "glassbrain.middleware.DjangoMiddleware",
    ...
]

Publishing to PyPI

cd packages/glassbrain-python
pip install build twine
python -m build
twine upload dist/*

License

MIT

Metadata

Release files for glassbrain 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glassbrain 0.2.1
File Size Uploaded Provenance Actions
glassbrain-0.2.1.tar.gz 7.0 kB Without provenance Details for glassbrain-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glassbrain 0.2.1
File Interpreter ABI Platform Actions
glassbrain-0.2.1-py3-none-any.whl Python 3 none any Details for glassbrain-0.2.1-py3-none-any.whl

Total release size: 16.5 kB

Release files / glassbrain-0.2.1.tar.gz

Download URL glassbrain-0.2.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a542ca7b3dca8da804459e9809af4ce66a8dd0d936d3d2d0739c10fe7c1ec5f1
BLAKE2b-256 checksum
How to use checksums
a238118450e2e9b24710c42ad80afb29213bd46fa1f5619629683f321426205f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / glassbrain-0.2.1-py3-none-any.whl

Download URL glassbrain-0.2.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6310a40e3f978c3fe5458e5221ce60e713a04c2d689c6d8f7a103b81d9731f6f
BLAKE2b-256 checksum
How to use checksums
66de1bf9e90235230ff2fac4d2c629b6163ea0101008c1280485bd74ddf511d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for glassbrain 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page