Skip to main content

ChatEvent

chatevent provides a small, typed event envelope and capture interface for collaboration platforms such as Zulip, Discourse, Gitea, GitHub, and blogs.

It is intended to sit at the Event Capture boundary of an agent system:

platform events -> ChatEvent -> gateway/router -> agent execution

Install

pip install chatevent

Define a normalized event

from datetime import datetime, timezone

from chatevent import CaptureMode, ChatEvent

event = ChatEvent(
    id="42",
    source="gitea",
    kind="issue.opened",
    occurred_at=datetime.now(timezone.utc),
    capture_mode=CaptureMode.PUSH,
    conversation_id="owner/repo#42",
    payload={"title": "Investigate event routing"},
)

assert event.dedupe_key == "gitea:42"

Implement a monitor

An adapter exposes an asynchronous stream. It may receive pushed events or poll a platform with an incremental cursor.

from collections.abc import AsyncIterator

from chatevent import CaptureMode, ChatEvent, EventMonitor


class GiteaMonitor:
    source = "gitea"
    mode = CaptureMode.PULL

    async def events(self, *, cursor: str | None = None) -> AsyncIterator[ChatEvent]:
        if False:  # Replace with incremental API reads.
            yield


monitor: EventMonitor = GiteaMonitor()

The initial release deliberately contains no platform SDK or runtime dependency. Platform adapters, persistence, filtering, and delivery guarantees can evolve independently around this stable boundary.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatevent-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatevent-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file chatevent-0.0.1.tar.gz.

File metadata

  • Download URL: chatevent-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.11

File hashes

Hashes for chatevent-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c80b16a97e1425f79b29f469a744c9c5bdfbbc42ffbe6995e849e8ccc0b4c5ea
MD5 701dbcdfe8873e7e6f3d53560d2e9346
BLAKE2b-256 5b57fa6e0ecbded6e7857f379803ee863fdc017453b006b25cc91ddc11334a53

See more details on using hashes here.

File details

Details for the file chatevent-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: chatevent-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.11

File hashes

Hashes for chatevent-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 820f167c9d05f1e1217d4029eee07a32c380172c2ef509be6d9f8f45a338f5ef
MD5 ce0445dbaad233d949bdf45fd42f820b
BLAKE2b-256 41f78564f74132af5f5a3db5dacbdee2270c979176a00a9ca76e67cf38a6c793

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

This release

0.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page