Skip to content

evented_config

Class info

Re-exported classes

Class Module Description
EmailConfig evented_config.configs Email event source configuration.
EventSourceConfig evented_config.configs Base configuration for event sources.
FileWatchConfig evented_config.configs File watching event source.
TimeEventConfig evented_config.configs Time-based event source configuration.
WebhookConfig evented_config.configs Webhook event source.

🛈 DocStrings

Event source configuration.

This is a lightweight config-only package for fast imports. For the actual event sources, use from evented import ....

EmailConfig

Bases: EventSourceConfig

Email event source configuration.

Monitors an email inbox for new messages and converts them to events.

Source code in src/evented_config/configs.py
class EmailConfig(EventSourceConfig):
    """Email event source configuration.

    Monitors an email inbox for new messages and converts them to events.
    """

    type: Literal["email"] = Field("email", init=False)
    """Email event."""

    host: str = Field(
        description="IMAP server hostname",
        examples=["imap.gmail.com", "outlook.office365.com", "imap.example.com"],
        title="IMAP server host",
    )
    """IMAP server hostname (e.g. 'imap.gmail.com')"""

    port: int = Field(
        default=993, ge=1, lt=65536, examples=[993, 143, 465], title="IMAP server port"
    )
    """Server port (defaults to 993 for IMAP SSL)"""

    username: str = Field(examples=["user@gmail.com", "admin@company.com"], title="Email username")
    """Email account username/address"""

    password: SecretStr = Field(title="Email password")
    """Account password or app-specific password"""

    folder: str = Field(default="INBOX", examples=["INBOX", "Sent", "Drafts"], title="Email folder")
    """Folder/mailbox to monitor"""

    ssl: bool = Field(default=True, title="Use SSL/TLS")
    """Whether to use SSL/TLS connection"""

    check_interval: int = Field(
        default=60,
        gt=0,
        description="Seconds between inbox checks",
        examples=[30, 60, 300],
        title="Check interval",
    )
    """How often to check for new emails (in seconds)"""

    mark_seen: bool = Field(default=True, title="Mark emails as seen")
    """Whether to mark processed emails as seen"""

    filters: dict[str, str] = Field(
        default_factory=dict,
        description="Email filtering criteria",
        title="Email filters",
    )
    """Filtering rules for emails (subject, from, etc)"""

    max_size: int | None = Field(
        default=None,
        description="Maximum email size in bytes",
        examples=[1048576, 5242880, 10485760],
        title="Maximum email size",
    )
    """Size limit for processed emails"""

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Email"})

    def get_event_source(self) -> EmailEventSource:
        """Create email event source instance."""
        from evented.email_watcher import EmailEventSource

        return EmailEventSource(config=self)

check_interval class-attribute instance-attribute

check_interval: int = Field(
    default=60,
    gt=0,
    description="Seconds between inbox checks",
    examples=[30, 60, 300],
    title="Check interval",
)

How often to check for new emails (in seconds)

filters class-attribute instance-attribute

filters: dict[str, str] = Field(
    default_factory=dict, description="Email filtering criteria", title="Email filters"
)

Filtering rules for emails (subject, from, etc)

folder class-attribute instance-attribute

folder: str = Field(default='INBOX', examples=['INBOX', 'Sent', 'Drafts'], title='Email folder')

Folder/mailbox to monitor

host class-attribute instance-attribute

host: str = Field(
    description="IMAP server hostname",
    examples=["imap.gmail.com", "outlook.office365.com", "imap.example.com"],
    title="IMAP server host",
)

IMAP server hostname (e.g. 'imap.gmail.com')

mark_seen class-attribute instance-attribute

mark_seen: bool = Field(default=True, title='Mark emails as seen')

Whether to mark processed emails as seen

max_size class-attribute instance-attribute

max_size: int | None = Field(
    default=None,
    description="Maximum email size in bytes",
    examples=[1048576, 5242880, 10485760],
    title="Maximum email size",
)

Size limit for processed emails

password class-attribute instance-attribute

password: SecretStr = Field(title='Email password')

Account password or app-specific password

port class-attribute instance-attribute

port: int = Field(default=993, ge=1, lt=65536, examples=[993, 143, 465], title="IMAP server port")

Server port (defaults to 993 for IMAP SSL)

ssl class-attribute instance-attribute

ssl: bool = Field(default=True, title='Use SSL/TLS')

Whether to use SSL/TLS connection

type class-attribute instance-attribute

type: Literal['email'] = Field('email', init=False)

Email event.

username class-attribute instance-attribute

username: str = Field(examples=['user@gmail.com', 'admin@company.com'], title='Email username')

Email account username/address

get_event_source

get_event_source() -> EmailEventSource

Create email event source instance.

Source code in src/evented_config/configs.py
def get_event_source(self) -> EmailEventSource:
    """Create email event source instance."""
    from evented.email_watcher import EmailEventSource

    return EmailEventSource(config=self)

EventSourceConfig

Bases: Schema

Base configuration for event sources.

Source code in src/evented_config/configs.py
class EventSourceConfig(Schema):
    """Base configuration for event sources."""

    type: str = Field(init=False, title="Event source type")
    """Discriminator field for event source types."""

    name: str = Field(
        examples=["file_watcher", "api_webhook", "scheduler"],
        title="Event source name",
    )
    """Unique identifier for this event source."""

    enabled: bool = Field(default=True, title="Source enabled")
    """Whether this event source is active."""

    template: str = Field(
        default=DEFAULT_TEMPLATE,
        examples=[DEFAULT_TEMPLATE, "New event: {{ content }}", "{{ timestamp }}: {{ source }}"],
        title="Event template",
    )
    """Jinja2 template for formatting events."""

    include_metadata: bool = Field(default=True, title="Include metadata")
    """Control metadata visibility in template."""

    include_timestamp: bool = Field(default=True, title="Include timestamp")
    """Control timestamp visibility in template."""

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Event source"})

    def get_event_source(
        self,
    ) -> FileSystemEventSource | WebhookEventSource | EmailEventSource | TimeEventSource:
        """Create the event source instance.

        Returns:
            The configured event source instance.
        """
        raise NotImplementedError

enabled class-attribute instance-attribute

enabled: bool = Field(default=True, title='Source enabled')

Whether this event source is active.

include_metadata class-attribute instance-attribute

include_metadata: bool = Field(default=True, title='Include metadata')

Control metadata visibility in template.

include_timestamp class-attribute instance-attribute

include_timestamp: bool = Field(default=True, title='Include timestamp')

Control timestamp visibility in template.

name class-attribute instance-attribute

name: str = Field(examples=['file_watcher', 'api_webhook', 'scheduler'], title='Event source name')

Unique identifier for this event source.

template class-attribute instance-attribute

template: str = Field(
    default=DEFAULT_TEMPLATE,
    examples=[DEFAULT_TEMPLATE, "New event: {{ content }}", "{{ timestamp }}: {{ source }}"],
    title="Event template",
)

Jinja2 template for formatting events.

type class-attribute instance-attribute

type: str = Field(init=False, title='Event source type')

Discriminator field for event source types.

get_event_source

Create the event source instance.

Returns:

Type Description
FileSystemEventSource | WebhookEventSource | EmailEventSource | TimeEventSource

The configured event source instance.

Source code in src/evented_config/configs.py
def get_event_source(
    self,
) -> FileSystemEventSource | WebhookEventSource | EmailEventSource | TimeEventSource:
    """Create the event source instance.

    Returns:
        The configured event source instance.
    """
    raise NotImplementedError

FileWatchConfig

Bases: EventSourceConfig

File watching event source.

Source code in src/evented_config/configs.py
class FileWatchConfig(EventSourceConfig):
    """File watching event source."""

    type: Literal["file"] = Field("file", init=False)
    """File / folder content change events."""

    paths: list[str] = Field(
        examples=[["./src", "./docs"], ["/home/user/projects"], ["*.py", "config/*.yaml"]],
        title="Watch paths",
    )
    """Paths or patterns to watch for changes."""

    extensions: list[str] | None = Field(
        default=None,
        examples=[[".py", ".md"], [".js", ".ts", ".json"], [".yaml", ".yml"]],
        title="File extensions",
    )
    """File extensions to monitor (e.g. ['.py', '.md'])."""

    ignore_paths: list[str] | None = Field(
        default=None,
        examples=[["__pycache__", ".git"], ["node_modules"], ["*.tmp"]],
        title="Ignore patterns",
    )
    """Paths or patterns to ignore."""

    recursive: bool = Field(default=True, title="Recursive watching")
    """Whether to watch subdirectories."""

    debounce: int = Field(
        default=1600,
        gt=0,
        examples=[500, 1600, 3000],
        title="Debounce delay (ms)",
    )
    """Minimum time (ms) between trigger events."""

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "File watching"})

    def get_event_source(self) -> FileSystemEventSource:
        """Create file system event source instance."""
        from evented.file_watcher import FileSystemEventSource

        return FileSystemEventSource(config=self)

debounce class-attribute instance-attribute

debounce: int = Field(default=1600, gt=0, examples=[500, 1600, 3000], title='Debounce delay (ms)')

Minimum time (ms) between trigger events.

extensions class-attribute instance-attribute

extensions: list[str] | None = Field(
    default=None,
    examples=[[".py", ".md"], [".js", ".ts", ".json"], [".yaml", ".yml"]],
    title="File extensions",
)

File extensions to monitor (e.g. ['.py', '.md']).

ignore_paths class-attribute instance-attribute

ignore_paths: list[str] | None = Field(
    default=None,
    examples=[["__pycache__", ".git"], ["node_modules"], ["*.tmp"]],
    title="Ignore patterns",
)

Paths or patterns to ignore.

paths class-attribute instance-attribute

paths: list[str] = Field(
    examples=[["./src", "./docs"], ["/home/user/projects"], ["*.py", "config/*.yaml"]],
    title="Watch paths",
)

Paths or patterns to watch for changes.

recursive class-attribute instance-attribute

recursive: bool = Field(default=True, title='Recursive watching')

Whether to watch subdirectories.

type class-attribute instance-attribute

type: Literal['file'] = Field('file', init=False)

File / folder content change events.

get_event_source

get_event_source() -> FileSystemEventSource

Create file system event source instance.

Source code in src/evented_config/configs.py
def get_event_source(self) -> FileSystemEventSource:
    """Create file system event source instance."""
    from evented.file_watcher import FileSystemEventSource

    return FileSystemEventSource(config=self)

TimeEventConfig

Bases: EventSourceConfig

Time-based event source configuration.

Source code in src/evented_config/configs.py
class TimeEventConfig(EventSourceConfig):
    """Time-based event source configuration."""

    type: Literal["time"] = Field("time", init=False)
    """Time event."""

    schedule: str = Field(
        examples=["0 9 * * 1-5", "*/30 * * * *", "0 0 * * 0"],
        title="Cron schedule",
    )
    """Cron expression for scheduling (e.g. '0 9 * * 1-5' for weekdays at 9am)"""

    prompt: str = Field(
        examples=["Daily status check", "Generate weekly report", "Check system health"],
        title="Trigger prompt",
    )
    """Prompt to send to the agent when the schedule triggers."""

    timezone: str | None = Field(
        default=None,
        examples=["UTC", "America/New_York", "Europe/London"],
        title="Schedule timezone",
    )
    """Timezone for schedule (defaults to system timezone)"""

    skip_missed: bool = Field(default=False, title="Skip missed executions")
    """Whether to skip executions missed while agent was inactive"""

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Time event"})

    def get_event_source(self) -> TimeEventSource:
        """Create timed event source instance."""
        from evented.timed_watcher import TimeEventSource

        return TimeEventSource(config=self)

prompt class-attribute instance-attribute

prompt: str = Field(
    examples=["Daily status check", "Generate weekly report", "Check system health"],
    title="Trigger prompt",
)

Prompt to send to the agent when the schedule triggers.

schedule class-attribute instance-attribute

schedule: str = Field(examples=['0 9 * * 1-5', '*/30 * * * *', '0 0 * * 0'], title='Cron schedule')

Cron expression for scheduling (e.g. '0 9 * * 1-5' for weekdays at 9am)

skip_missed class-attribute instance-attribute

skip_missed: bool = Field(default=False, title='Skip missed executions')

Whether to skip executions missed while agent was inactive

timezone class-attribute instance-attribute

timezone: str | None = Field(
    default=None, examples=["UTC", "America/New_York", "Europe/London"], title="Schedule timezone"
)

Timezone for schedule (defaults to system timezone)

type class-attribute instance-attribute

type: Literal['time'] = Field('time', init=False)

Time event.

get_event_source

get_event_source() -> TimeEventSource

Create timed event source instance.

Source code in src/evented_config/configs.py
def get_event_source(self) -> TimeEventSource:
    """Create timed event source instance."""
    from evented.timed_watcher import TimeEventSource

    return TimeEventSource(config=self)

WebhookConfig

Bases: EventSourceConfig

Webhook event source.

Source code in src/evented_config/configs.py
class WebhookConfig(EventSourceConfig):
    """Webhook event source."""

    type: Literal["webhook"] = Field("webhook", init=False)
    """webhook-based event."""

    host: str = Field(
        default="127.0.0.1",
        examples=["127.0.0.1", "0.0.0.0"],
        title="Listen host",
    )
    """Interface to bind to. Loopback by default; set a secret when binding a public one."""

    port: int = Field(examples=[8080, 9000, 3000], title="Listen port", ge=1, lt=65536)
    """Port to listen on."""

    path: str = Field(
        examples=["/webhook", "/api/events", "/github-webhook"],
        title="URL path",
    )
    """URL path to handle requests."""

    secret: SecretStr | None = Field(
        default=None,
        examples=["webhook_secret_123", "github_webhook_key"],
        title="Validation secret",
    )
    """Optional secret for request validation (HMAC signature, see the docs)."""

    model_config = ConfigDict(json_schema_extra={"x-doc-title": "Webhook"})

    def get_event_source(self) -> WebhookEventSource:
        """Create webhook event source instance."""
        from evented.webhook_watcher import WebhookEventSource

        return WebhookEventSource(config=self)

host class-attribute instance-attribute

host: str = Field(default='127.0.0.1', examples=['127.0.0.1', '0.0.0.0'], title='Listen host')

Interface to bind to. Loopback by default; set a secret when binding a public one.

path class-attribute instance-attribute

path: str = Field(examples=['/webhook', '/api/events', '/github-webhook'], title='URL path')

URL path to handle requests.

port class-attribute instance-attribute

port: int = Field(examples=[8080, 9000, 3000], title='Listen port', ge=1, lt=65536)

Port to listen on.

secret class-attribute instance-attribute

secret: SecretStr | None = Field(
    default=None, examples=["webhook_secret_123", "github_webhook_key"], title="Validation secret"
)

Optional secret for request validation (HMAC signature, see the docs).

type class-attribute instance-attribute

type: Literal['webhook'] = Field('webhook', init=False)

webhook-based event.

get_event_source

get_event_source() -> WebhookEventSource

Create webhook event source instance.

Source code in src/evented_config/configs.py
def get_event_source(self) -> WebhookEventSource:
    """Create webhook event source instance."""
    from evented.webhook_watcher import WebhookEventSource

    return WebhookEventSource(config=self)