Skip to main content

Evented

PyPI License Package status Monthly downloads Distribution format Wheel availability Python version Implementation Releases Github Contributors Github Forks Github Issues Github Issues Github Watchers Github Stars Github Repository size Github last commit Github release date Github language count Github commits this month Package status PyUp

Read the documentation!

Async event sources that turn file changes, webhooks, emails and cron schedules into typed events.

evented gives you a small set of asyncio event sources behind one interface, and an EventManager that runs them and passes every event to your callbacks. Events are pydantic models with a to_prompt() method, so they can go straight into an LLM agent. Sources are configured with pydantic models (evented_config), so they can be loaded from YAML/JSON and validated.

Installation

pip install evented          # core (config models, manager, event types)
pip install "evented[all]"   # + watchfiles, fastapi/uvicorn, aioimaplib, croniter

Requires Python 3.13+. The backends of the sources are optional dependencies; the all extra installs all of them.

Quickstart

import asyncio

from evented import EventData, EventManager


async def on_event(event: EventData) -> None:
    print(f"[{event.source}] {event.to_prompt()}")


async def main() -> None:
    async with EventManager(event_callbacks=[on_event]) as manager:
        await manager.add_file_watch("./src", extensions=[".py", ".md"], name="src")
        await manager.add_timed_event("*/5 * * * *", "Run the health check", name="cron")

        @manager.track("compute")
        async def compute(x: int) -> int:
            return x * 2

        await compute(21)  # prints "[compute] 42"
        await asyncio.sleep(60)  # edit a file in ./src meanwhile


asyncio.run(main())

From configuration

EventConfig is a discriminated union over all config types (key: type):

import asyncio

from pydantic import TypeAdapter

from evented import EventConfig, EventSource

raw = {"type": "time", "name": "daily", "schedule": "0 9 * * 1-5", "prompt": "Morning report"}
config = TypeAdapter(EventConfig).validate_python(raw)  # -> TimeEventConfig


async def main() -> None:
    async with EventSource.from_config(config) as source:
        async for event in source.events():
            print(event.to_prompt())


asyncio.run(main())

You can also pass a list of configs to the manager: EventManager(configs=[...]).

Event sources

Config (type) Source Backend Event
FileWatchConfig (file) FileSystemEventSource watchfiles FileEventData
WebhookConfig (webhook) WebhookEventSource FastAPI + uvicorn WebhookEventData
EmailConfig (email) EmailEventSource aioimaplib (IMAP) EmailEventData
TimeEventConfig (time) TimeEventSource croniter TimeEventData

The webhook source keeps received events in an unbounded queue until they are processed: bind it to loopback (the default) or set a secret before exposing it.

Features

  • One interface for every source: each source is an async context manager with an events() async generator, so you can use it without the manager.
  • EventManager: runs several sources at once, calls sync or async callbacks, and has shortcuts like add_file_watch(), add_webhook(), add_email_watch() and add_timed_event(). Callbacks run one at a time, in registration order (async callbacks are awaited in turn, not concurrently), so a slow callback holds up the others.
  • Function tracking: @manager.track() emits a FunctionResultEventData for each call, with arguments, duration and success/error status in metadata.
  • Prompt templates: await event.format(config) renders an event with the source's Jinja template (timestamp and metadata can be turned off).
  • Lightweight config package: evented_config holds only the pydantic models, so you can import it in config schemas without pulling in the runtime.

Metadata

Release files for evented 1.2.2

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

Source distribution (sdist)

Source distribution for evented 1.2.2
File Size Uploaded Provenance Actions
evented-1.2.2.tar.gz 22.3 kB With provenance Details for evented-1.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evented 1.2.2
File Interpreter ABI Platform Actions
evented-1.2.2-py3-none-any.whl Python 3 none any Details for evented-1.2.2-py3-none-any.whl

Total release size: 46.3 kB

Release files / evented-1.2.2.tar.gz

Download URL evented-1.2.2.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82189a1b7108b7688eea66798762ebfb265c47bb61c8864241931dafd521ecba
BLAKE2b-256 checksum
How to use checksums
9b20218354b1b309fa6e1c045cea57d56026ff13533b64a56d86ad08282a70b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Release files / evented-1.2.2-py3-none-any.whl

Download URL evented-1.2.2-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3504f303b1cdd9dd4010964a02f0f67db5ed2d3360f30c59fde4833a40cfebf8
BLAKE2b-256 checksum
How to use checksums
5131f0dcf46a358c0a364dbc7c47a947ab6f9bcacca0390f391e4c97b39d427e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 26, 2026.

Transparency log

Security for evented 1.2.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for evented-1.2.2.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 Nov 26, 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