Skip to main content

Agentcore Notifier

中文

Notification management module (webhook, email, etc.) for Django. Part of the agentcore family (with agentcore-metering, agentcore-task).


Install

  • Not on PyPI; install only from GitHub.

From GitHub (editable after clone):

pip install -e git+https://github.com/cloud2ai/agentcore-notifier.git

Or, when the host project uses it as a submodule, from repo root:

pip install -e path/to/agentcore-notifier
  • Add to INSTALLED_APPS in the main project (e.g. Agentcore Notifier):
'agentcore_notifier.adapters.django',
  • The host project Dockerfile should iterate over agentcore/ submodules and run pip install -e.
  • See the host project README for details.

Configuration

All configuration is stored in the NotifierConfig table (scope=global, key+value JSON). No main-project settings or app_config injection; webhook URL, provider, language, etc. are set via notifier UI/API.

Configure via:

  • Django Admin: NotifierConfig (key=global, silence_rules); NotificationChannel for Webhook/email channels.
  • API: Channels via channels/ (CRUD); global and silence via global/, silence-rules/ (see API reference below).

Default channel helpers

get_default_webhook_channel() and get_default_email_channel() (in adapters.django.services.webhook_service and email_service) both return (channel, config_dict) or (None, None).

  • Webhook default: first active webhook channel, ordered by created_at (earliest first). Name and ordering do not affect which channel is default.
  • channel: the active NotificationChannel instance (or None).
  • config_dict: a dict built from channel.config (url/headers for webhook; smtp_host/from_email etc. for email), or None.

When the application layer wants to select a specific channel (e.g. from its own config), pass channel by UUID so that channel name changes do not break references:

  • get_webhook_channel_by_uuid(channel_uuid) in webhook_service returns (channel, config) or (None, None).
  • When calling send_webhook_notification.delay(..., channel_config={"channel_uuid": "<uuid>"}), the task resolves the channel by UUID and uses that channel's config.

When unpacking, use consistent names so call sites stay clear and do not shadow gettext _ in modules that use translation:

  • Need both: channel, config = get_default_webhook_channel()
  • Need only channel: channel, _config = get_default_webhook_channel()
  • Need only config: _channel, config = get_default_webhook_channel()

Same pattern for get_default_email_channel().


Sending notifications

Send only via Celery task (no HTTP send API). The task runs silence and merge checks, then calls WebhookService and writes NotificationRecord.

from agentcore_notifier.adapters.django.tasks.send import send_webhook_notification

send_webhook_notification.delay(
    payload={"msg_type": "post", "content": {...}},
    provider_type="feishu",
    source_app="my_app",
    source_type="alert",
    source_id="123",
    user_id=user_id,
)

API reference

  • Mount under an admin prefix (e.g. api/v1/admin/notifications/).
  • Auth: IsAdminUser (staff or superuser), otherwise 403.

Stats and config

Method Path Description
GET .../notification-stats/ Summary, by_source, by_provider, series
GET .../notification-records/ Paginated list of notification records
GET / PUT .../global/ Global config (retention_days, cleanup, etc.)
GET / PUT .../silence-rules/ Silence rules (NotifierConfig key=silence_rules)
GET / POST .../channels/ List and create notification channels (Webhook/Email)
GET / PUT / DELETE .../channels/<uuid>/ Get, update, or delete one channel
POST .../channels/validate/ Validate channel config without saving

Cleanup

Cleanup of old notification records is configured via NotifierConfig key=global (retention_days, cleanup_crontab, cleanup_enabled). When enabled, a Celery Beat task runs periodically. Schedule is merged in AppConfig.ready().


Project structure

  • agentcore_notifier/ – Package root.
  • agentcore_notifier/adapters/django/ – Django app: models, admin, views, URLs, Celery tasks.
  • agentcore_notifier/adapters/django/services/ – WebhookService, email, merge/silence, notification_config, stats, cleanup.
  • docs/ – Feishu webhook and other reference docs.
  • tests/ – Pytest tests (Django settings in tests.settings).

Tests

From the package root (agentcore-notifier):

pip install -e ".[dev]"
pytest

Run with coverage for the services layer:

pytest --cov=agentcore_notifier.adapters.django.services --cov-report=term-missing

Requires Django and Celery to be configured; tests.settings and tests.conftest provide the test environment.

Metadata

Release files for agentcore-notifier 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentcore-notifier 0.2.1
File Size Uploaded Provenance Actions
agentcore_notifier-0.2.1.tar.gz 93.4 kB With provenance Details for agentcore_notifier-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentcore-notifier 0.2.1
File Interpreter ABI Platform Actions
agentcore_notifier-0.2.1-py3-none-any.whl Python 3 none any Details for agentcore_notifier-0.2.1-py3-none-any.whl

Total release size: 180.4 kB

Release files / agentcore_notifier-0.2.1.tar.gz

Download URL agentcore_notifier-0.2.1.tar.gz
Size 93.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2c6f7272c63d17ee3d0db3e3ced091097360c107552a372d3b969a9284e14dd1
BLAKE2b-256 checksum
How to use checksums
f6e37073377f58036f89500001e3b46d728d5033b61fb50cfcf5d78f95a81397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release files / agentcore_notifier-0.2.1-py3-none-any.whl

Download URL agentcore_notifier-0.2.1-py3-none-any.whl
Size 87.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec84171d0ac0a6452d4f09fa8ab5fa23a4e5d6a0a7496844e166dbb5abcb2dc6
BLAKE2b-256 checksum
How to use checksums
b8516284c03ddf67036790e79deb1db5a7c19df0b5ddc32580d9a2ad9d666866
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Security for agentcore-notifier 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentcore_notifier-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page