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.3.0.tar.gz (24.5 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.3.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentminds-0.3.0.tar.gz
Algorithm Hash digest
SHA256 08accbab47ce540894c4d1ed9532f937b41e050b0c723c418155f99073ba7bd2
MD5 32a2fb2f9c4229a3ad74fa5f689b684d
BLAKE2b-256 b0877f17f4f55c982b943ec0d18df074fb2ab12324cda2d55def7f117e73510c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agentminds-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35426fa12bef4ad9303ab147237ccf6b71c95f13e1a8edf6f2137e71175cea6a
MD5 cc415530728f3057b2097f8f4f956b44
BLAKE2b-256 80f23fc4699aac6128ac0eb4bb7bdc6fd863b5c1e3fbe3f2a12d3a9a2e5a0c97

See more details on using hashes here.

Provenance

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