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.2

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.2
File Size Uploaded Provenance Actions
glassbrain-0.2.2.tar.gz 7.0 kB Without provenance Details for glassbrain-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 16.5 kB

Release files / glassbrain-0.2.2.tar.gz

Download URL glassbrain-0.2.2.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a9ecc392fcf299974c1e03385912de353ccdce1b792b60a95bb5934af131785
BLAKE2b-256 checksum
How to use checksums
62357dc96fd360d6158230fe04251016ac363fdc46c956cfc375057a190322d4
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.2-py3-none-any.whl

Download URL glassbrain-0.2.2-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e3e4b5d4b00f201efb3d4c85e23a019b79747c32218cb75c9354b6e4429587c
BLAKE2b-256 checksum
How to use checksums
1e80ca518f002070cf0addf7cef932ad8e01c29c3270e0aff23e5acea298c5a9
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.2

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