Skip to main content

cogno-herald

Email/SMTP + iCalendar + OTP for the Cogno stack — the messenger of the ecosystem.

A self-contained communication utility, decoupled from any proprietary infra:

  • SMTP — send plain or iCalendar-attached email over stdlib smtplib (async via asyncio.to_thread); senders never raise, they return a result dict.
  • iCalendar — build RFC 5545 .ics invites (REQUEST) and cancellations (CANCEL) that work with Google/Outlook/Apple Calendar.
  • OTP — a 6-digit one-time-password flow (generate/store/verify) with bounded attempts and single-use codes, generated with a CSPRNG (secrets).

Design

  • Zero third-party runtime dependencies. Pure stdlib.
  • Host owns infra. SMTP credentials come from the host (tenant override → env); OTP state rides in an injectable OTPStore port (default InMemoryOTPStore, plug Redis in a multi-worker host), and delivery rides in an injectable EmailSender — mirroring the cogno-homeo in-memory-default pattern.
  • No surprises. Senders return SendResult; nothing raises on a bad recipient or a dead SMTP host.
from cogno_herald import OtpService, InMemoryOTPStore, make_smtp_sender, \
    resolve_smtp_config, send_plain_email

smtp = resolve_smtp_config(tenant_config)              # or None
sender = make_smtp_sender(send_plain_email, smtp) if smtp else None
otp = OtpService(InMemoryOTPStore(), sender=sender)

await otp.send("user@example.com", tenant_name="Acme")
ok = await otp.verify("user@example.com", code)

resolve_smtp_config reads SMTP_HOST / SMTP_PORT / SMTP_USER / SMTP_PASSWORD / SMTP_FROM_EMAIL / SMTP_FROM_NAME / SMTP_USE_TLS (tenant config wins over the environment).

STARTTLS verifies the server certificate. If your relay presents a certificate no public CA vouches for, point SMTP_TLS_CA_FILE at its CA rather than turning verification off — the session stays authenticated. SMTP_TLS_VERIFY=false is the last resort (encrypted but unauthenticated; it logs event=tls_verification_disabled every send). Do not reach for SMTP_USE_TLS=false for this: that drops encryption entirely, on a session carrying your SMTP password and every OTP.

See docs/HOST_INTEGRATION.md for the Redis adapter and SMTP wiring, and LOGGING.md for the logging convention.

The Cogno ecosystem

cogno-herald is one organ of Cogno — a family of small, composable, Apache-2.0 libraries that together form a complete conversational-agent platform. Each library owns a single concern and stays infra-agnostic; a host assembles them into a running agent:

The Cogno ecosystem

The open-source libraries are the organs; the host is the body that joins them. Our reference host — cogno-host, with its cogno-ui dashboard — is the private product layer, but it holds no special powers: everything it does rides on the public seams documented in each library's docs/HOST_INTEGRATION.md, so you can assemble a body of your own.

Develop

pip install -e ".[dev]"
pytest tests/unit -q
ruff check cogno_herald tests examples
mypy cogno_herald

Apache-2.0.

Metadata

Release files for cogno-herald 0.1.0

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

Source distribution (sdist)

Source distribution for cogno-herald 0.1.0
File Size Uploaded Provenance
cogno_herald-0.1.0.tar.gz 16.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cogno-herald 0.1.0
File Interpreter ABI Platform
cogno_herald-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / cogno_herald-0.1.0.tar.gz

Download URL cogno_herald-0.1.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5a1133b65504b255eb4431ee23a0340e1c0b444582a9077a4f00d488dbae2c15
BLAKE2b-256 checksum
How to use checksums
15224d17ef3397f1a9d8bf70ef7e6f7641686582511ec868a54a8f119bf03d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / cogno_herald-0.1.0-py3-none-any.whl

Download URL cogno_herald-0.1.0-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5dd1a1d1a8afa9529be23b53ef0f4dc005c391433fddecaa5482b7171cf4def9
BLAKE2b-256 checksum
How to use checksums
c7c7f5428cea4c46c9202809a6e544a413c19faefb1c3ef403c22f992477b39f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for cogno-herald 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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