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.

Install

pip install agentminds

Quickstart

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.2.0.tar.gz (18.3 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.2.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentminds-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b32184f94e3c7c8a4e58c3e1dfdb2d835f4b4d74e55d8a9d9d43b331064b2226
MD5 3ab01a6059ac12182106d79f03b6cfcb
BLAKE2b-256 1c7c984ae08fbaaca8ad2400a400389855fc632b32c8205c9bfe1ad40414a86e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentminds-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: agentminds-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f06a712071e2c81a970df7684fb072e035360d79f37824f5d6da90a7afc5cbb
MD5 79df0cb3242193e41280ad91a4855427
BLAKE2b-256 4fb364870b6da7a26e4abdcc620daa96254ecd38be04a476bebdbbdebb42211c

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentminds-0.2.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