AgentMinds Python SDK — auto-captures errors, web requests, and logs from Python web apps.
Project description
agentminds — Python SDK
Auto-capture errors, failed requests, and logs from your Python web app.
Sentry-style API, Sentry-style ergonomics — one init() call and the SDK
hooks sys.excepthook, your web framework's error pipeline, and the
logging module. Connect once and your site joins the AgentMinds
intelligence pool — patterns the network has already learned for your
stack come back as recommendations.
Install — one command
pip install agentminds && python -m agentminds connect
python -m agentminds connect is the recommended onboarding. It prompts
for your site URL + email, registers your site with the API, gets your
DSN, and auto-edits your FastAPI/Flask entry file in place (a
.agentminds.bak backup is written first). After that, set the printed
AGENTMINDS_DSN env var in your runtime and deploy.
# non-interactive — pass everything as flags
python -m agentminds connect --url=https://yourapp.com --email=you@example.com
Why
python -m agentmindsand not bareagentminds? Pip installs the binary in<python>/Scripts/(Windows) or<python>/bin/(macOS/Linux). On Windows--userinstalls that directory isn't on PATH by default, so a stranger runningpip install agentmindsthenagentminds connectgetscommand not foundeven though the install succeeded.python -m agentmindsalways works because the Python you just used to runpipis already on your PATH. Both forms are functionally identical.
Quickstart (manual, if you already have a DSN)
import agentminds
agentminds.init(
dsn="https://pk_yoursite_xxx@api.agentminds.dev/yoursite",
release="v1.2.3", # optional — auto-detected from git
environment="production",
)
That's it. From this point:
- Every uncaught exception (main thread + worker threads) is captured.
- Every
logging.error(...)call ships as an event. - Every
logging.info/warning(...)becomes a breadcrumb on the next event.
The SDK is a no-op if no DSN is set — safe to leave init() in dev.
FastAPI
from fastapi import FastAPI
import agentminds
from agentminds.integrations.fastapi_app import AgentMindsMiddleware
agentminds.init(dsn="...")
app = FastAPI()
app.add_middleware(AgentMindsMiddleware)
Captures uncaught handler exceptions plus any 5xx response. Adds
http.method / http.route tags and a request breadcrumb.
Flask
from flask import Flask
import agentminds
from agentminds.integrations.flask_app import init_app
agentminds.init(dsn="...")
app = Flask(__name__)
init_app(app)
Manual capture
try:
risky_thing()
except Exception as e:
agentminds.capture_exception(e)
agentminds.capture_message("payment retry exceeded", level="warning")
agentminds.set_user({"id": user.id, "email": user.email})
agentminds.set_tag("plan", user.plan)
agentminds.add_breadcrumb(category="db", message="SELECT users WHERE...")
Configuration
| Argument | Env var | Default | Notes |
|---|---|---|---|
dsn |
AGENTMINDS_DSN |
— | Required. SDK no-op if absent. |
release |
AGENTMINDS_RELEASE |
git rev-parse --short HEAD |
Tag events with build. |
environment |
AGENTMINDS_ENV |
"production" |
Filter on the dashboard. |
sample_rate |
— | 1.0 |
0.1 = drop 90% of events. |
debug |
AGENTMINDS_DEBUG=1 |
False |
Logs SDK internals to agentminds logger. |
attach_logging |
— | True |
Auto-attach logging handler. |
install_excepthook |
— | True |
Auto-hook sys.excepthook. |
Wire format
The SDK posts batched events to:
POST {api_base}/api/v1/sync/ingest/{site_id}/events?key={public_key}
Content-Type: application/json
{ "events": [ { type, fingerprint, payload, page_url? }, ... ] }
Same envelope as the browser collector (agent.js) — server-side and
browser events land in the same runtime_events table.
Privacy
- No request bodies sent unless you opt in (
send_default_pii=True). - No DB query parameters captured.
- User PII (email, IP) only sent if you set it via
set_user(...). - Stack traces are truncated to 8 KB; messages to 500 chars.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentminds-0.4.2.tar.gz.
File metadata
- Download URL: agentminds-0.4.2.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c56742d5a4b118b33774f0a74297cb9fba01963703dc4aa5acf2601ecbe5da
|
|
| MD5 |
0c089d2d8327590cb9ce246a0b2ee753
|
|
| BLAKE2b-256 |
4aeb712c0e7dbfb7e4fc3785d5faa9075c25f39a3070c1955721e744b43c1eee
|
Provenance
The following attestation bundles were made for agentminds-0.4.2.tar.gz:
Publisher:
publish-sdks.yml on UzunGridera/agentminds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentminds-0.4.2.tar.gz -
Subject digest:
97c56742d5a4b118b33774f0a74297cb9fba01963703dc4aa5acf2601ecbe5da - Sigstore transparency entry: 1391812671
- Sigstore integration time:
-
Permalink:
UzunGridera/agentminds@30bc4c9ae62268287c692ea59c17ef0e0f4689a0 -
Branch / Tag:
refs/tags/sdks/python-v0.4.2 - Owner: https://github.com/UzunGridera
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@30bc4c9ae62268287c692ea59c17ef0e0f4689a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agentminds-0.4.2-py3-none-any.whl.
File metadata
- Download URL: agentminds-0.4.2-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a76e7dcd708fd17e5be5ff93a3b468d7233a4c1b3bdfe45a68708c6f6e0fff57
|
|
| MD5 |
fd67b5d8421437232ba928f3893ef19a
|
|
| BLAKE2b-256 |
960144a1a45458447ec616140b1a34b7ca0a5fda8b6fd4da8ad2bc5e24d78a41
|
Provenance
The following attestation bundles were made for agentminds-0.4.2-py3-none-any.whl:
Publisher:
publish-sdks.yml on UzunGridera/agentminds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agentminds-0.4.2-py3-none-any.whl -
Subject digest:
a76e7dcd708fd17e5be5ff93a3b468d7233a4c1b3bdfe45a68708c6f6e0fff57 - Sigstore transparency entry: 1391812683
- Sigstore integration time:
-
Permalink:
UzunGridera/agentminds@30bc4c9ae62268287c692ea59c17ef0e0f4689a0 -
Branch / Tag:
refs/tags/sdks/python-v0.4.2 - Owner: https://github.com/UzunGridera
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@30bc4c9ae62268287c692ea59c17ef0e0f4689a0 -
Trigger Event:
push
-
Statement type: