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

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.0
File Size Uploaded Provenance Actions
glassbrain-0.2.0.tar.gz 6.5 kB Without provenance Details for glassbrain-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 15.1 kB

Release files / glassbrain-0.2.0.tar.gz

Download URL glassbrain-0.2.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f32241b644d91e8fbb0d21f9abb57de58a5407301c8345eac9bf0fb4b87194bf
BLAKE2b-256 checksum
How to use checksums
61409b4803feb25c8dff0e7f9f8e439db8a47ca6f31dcf3b152f724935e4752a
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.0-py3-none-any.whl

Download URL glassbrain-0.2.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef7d404ebb32907fc673846b3d01348a29c1607ec5b094e8fde4701a60f695c3
BLAKE2b-256 checksum
How to use checksums
f4286815508917ffb8637dd472cdeaec33b9bce31fb0b561c8277df81622c64c
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.0

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