Skip to main content

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 && agentminds connect

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
agentminds connect --url=https://yourapp.com --email=you@example.com

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

agentminds-0.4.0.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

agentminds-0.4.0-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file agentminds-0.4.0.tar.gz.

File metadata

  • Download URL: agentminds-0.4.0.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentminds-0.4.0.tar.gz
Algorithm Hash digest
SHA256 1db55739a15ddeb461deffb7ba1edf8a06fb0f3dea77310d06bcdda6c2b6e788
MD5 f5cca92b181336b3c5ac0fde6f7482e5
BLAKE2b-256 1fcc32b9c61ba573d0b272feda249e84a1a36889b28227b476dbab59cbf29adb

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentminds-0.4.0.tar.gz:

Publisher: publish-sdks.yml on UzunGridera/agentminds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentminds-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: agentminds-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agentminds-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 44a8f9257cf7128ff658051e460240ac8dfbf828db4310c16fe414704b2a77fe
MD5 fa7d5e29445ccd4bbee2897128a1a0bf
BLAKE2b-256 a10edb32d9713ca01eace00295e2b1b17524278ff87759ce7d4d82cc88fb0cf4

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentminds-0.4.0-py3-none-any.whl:

Publisher: publish-sdks.yml on UzunGridera/agentminds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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