Skip to main content

  Brakit Python SDK

AI writes your code. Brakit watches what it does.
Every request, query, and API call mapped to the action that triggered it. See your entire backend at a glance.
Open source · Local first · Zero config · AI-native via MCP

GitHub • Website • Contributing

MIT License PyPI version Python versions npm version PRs welcome!


Brakit Actions — endpoints grouped by user action
Every endpoint grouped by the action that triggered it — see "Sign Up" and "Load Dashboard", not 47 raw requests

Brakit Dashboard — issues surfaced automatically
Brakit catches N+1 queries, PII leaks, and slow endpoints as you develop

Claude reading Brakit findings in VS Code
Claude reads issues via MCP and fixes your code

Quick Start

The Python SDK captures queries, fetches, and requests from your FastAPI or Flask backend and forwards them to the Brakit dashboard running in your Node.js frontend.

1. Install the Node.js core (runs the dashboard)

npx brakit install

2. Install the Python SDK

pip install brakit

3. Add one import to your app

FastAPI:

import brakit  # must be before FastAPI import
from fastapi import FastAPI

app = FastAPI()

Flask:

import brakit  # must be before Flask import
from flask import Flask

app = Flask(__name__)

That's it. Start both apps normally. The Python SDK auto-detects your framework, instruments queries and fetches, and forwards everything to the Brakit dashboard at http://localhost:<port>/__brakit.

Full setup guide: brakit.ai/docs/introduction


What You Get

  • Cross-service tracing — FETCH from Next.js to FastAPI? The DB query inside FastAPI nests under the fetch automatically
  • Full server tracing — DB queries, outgoing HTTP calls, errors — zero code changes
  • Live dashboard at /__brakit — performance overview, request timeline, scatter charts
  • 8 security rules scanned against live traffic — leaked secrets, PII in responses, missing auth flags
  • N+1 query detection — same query pattern repeated 5+ times in a single request
  • AI-native via MCP — Claude Code and Cursor can query issues and verify fixes directly

Supported Frameworks

Framework Status
FastAPI Supported
Flask Supported
Django Planned

Supported Databases

Driver Status
SQLAlchemy Supported
asyncpg Supported
psycopg Planned

Supported HTTP Clients

Library Status
urllib3 Supported
httpx Supported
aiohttp Supported
requests Supported (via urllib3)

How It Works

import brakit  →  auto-detect framework  →  instrument everything
                        |
                        +-- DB queries    (SQLAlchemy, asyncpg)
                        +-- HTTP fetches  (httpx, aiohttp, urllib3)
                        +-- Errors        (global exception hooks)
                        +-- Logs          (logging module)
                              |
                              +-- Forward to Node.js dashboard via localhost

import brakit patches your framework's middleware to capture request/response pairs, hooks into database drivers and HTTP clients, and forwards telemetry to the Brakit dashboard running in your Node.js process. No proxy, no extra ports.

Production Safety

Brakit never runs in production. Multiple layers ensure it:

Layer How it blocks
should_activate() Checks NODE_ENV + 15 cloud/CI env vars
devDependency Not installed in production
safe_wrap + circuit breaker Errors in brakit code fall back silently
BRAKIT_DISABLE=true Manual kill switch

Optional Dependencies

# FastAPI support
pip install brakit[fastapi]

# Flask support
pip install brakit[flask]

# Development (tests, linting)
pip install brakit[dev]

Development

git clone https://github.com/brakit-ai/brakit.git
cd brakit/sdks/python

pip install -e ".[dev]"
pytest tests/ -v

Contributing

Brakit is early and moving fast. Areas where help would be great:

  • Database adapters — psycopg, Tortoise ORM, Django ORM
  • Framework adapters — Django, Starlette
  • HTTP client hooks — more client libraries
  • Security rules — new patterns, configurable severity

Please open an issue first for larger changes so we can discuss the approach.

License

MIT

Metadata

Release files for brakit 0.1.7

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

Source distribution (sdist)

Source distribution for brakit 0.1.7
File Size Uploaded
brakit-0.1.7.tar.gz 31.6 kB Details

Built distribution (wheel)

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

Total release size: 78.8 kB

Release files / brakit-0.1.7.tar.gz

Download URL brakit-0.1.7.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b52da68bc77cbd3155f399c0ca5dba3be25fcf68e39937d09b86b2ef386a6bbb
BLAKE2b-256 checksum
How to use checksums
de5bd9c06f9aa6c1df1300fa37b9ef9940c7139c710f98295f27c0e4c908224c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / brakit-0.1.7-py3-none-any.whl

Download URL brakit-0.1.7-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8cc10ddba39ce2bf049b0396cd0f69dfc9848f4477f818232d37923991e32e2
BLAKE2b-256 checksum
How to use checksums
1d4afb791d18decb39f8fbb11ba652996fcd0801bc605ba228dd0c0ad3895712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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