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.1.tar.gz (19.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.2.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentminds-0.2.1.tar.gz
  • Upload date:
  • Size: 19.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.2.1.tar.gz
Algorithm Hash digest
SHA256 c114c2a811e8e1b1e645124b408c014101c7f5f1c07d38bd893f71f832d4e783
MD5 c91545c2479b75eb2ff99ba7a4157729
BLAKE2b-256 943699ea1ba709b3b4470b2b14d18392bf8fb56edd8353075fa00d3cae07af78

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: agentminds-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5905ecb20909e031acb92b0a96048281c163f8c9e48ac738074687d0323adab8
MD5 eb46403cbe6278b68b5bcf732bb124c2
BLAKE2b-256 c7de1cc39f0f71e82c571573d7f8bb5f07413f426304189a9905bf2a2f8555bd

See more details on using hashes here.

Provenance

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