Skip to main content

AI-native error tracking and observability for Python applications

Project description

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

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

glassbrain-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

glassbrain-0.1.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file glassbrain-0.1.1.tar.gz.

File metadata

  • Download URL: glassbrain-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for glassbrain-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bef9f0bd467ab6b7ac5ff097042655825c5079f527a1550c365e6cdf77da8144
MD5 7b6ff1360c1f191979de5d35be35f7ae
BLAKE2b-256 4bc6fb69503c64f6b6f6b79fb941c7ebc8306fa93a8de74f76360c61a802c3f6

See more details on using hashes here.

File details

Details for the file glassbrain-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: glassbrain-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for glassbrain-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de8a8b3d21eaa3d18baa2bdf2ea00f04ed1eaee16e0ccfb931aaef2b4ab659b7
MD5 784c356a6c193122c11a9b89f68d2507
BLAKE2b-256 60e7c916cedf997b78ae3cd23f89754c9c45ed95c73f291ac2114e6a4af06345

See more details on using hashes here.

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