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.1.0.tar.gz (13.4 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.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentminds-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2d721099a91a2037258a2f441b7a67a61a9ee55fb822c81be293c521661e64be
MD5 5a6c9392bbdd015710a19f59dcaf6618
BLAKE2b-256 fd090fdfc8dccb2b9fbcf80637fc7b4a6a8a409560a2be8430d21bc6af244c0c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agentminds-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 287580886e22ae1ded9a2ef0abaa803686673fe7710aaabc2f74caa066cc3a3b
MD5 5ca0ff6ac3cc06c13098cfa7d3d8738d
BLAKE2b-256 4be82e748fca4d4e7a926d34d0dfd7fbb9d4d26c6acee805ad2e11fe63ddfa4e

See more details on using hashes here.

Provenance

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