Skip to main content

Module app_events

Module app_events 

Source
Expand description

App events: something inside AgentMux happened, and a job on the app_event source starts a run (docs/specs/SPEC_DRONE_REAL_WORLD_JOBS_2026_11_11.md §3.2, §3.2.1).

An observer on the broker reads each published event and keeps only the few it names (a turn that ended, an agent that failed); AgentMux’s own start is the one more, said once; it does nothing else under the broker’s locks but queue. A task then gives the event its typed fields, finds the enabled jobs whose filter it matches and starts each one’s run through CronScheduler::fire_event, which records it, applies policy, caps, the delay and the rate limit, and drops an event the job already heard. The run reads the fields as {{trigger.*}}.

A job’s filter names the event ("event": "agent.turn_ended") and may name any of that event’s fields ("agent": "<agent id>", "outcome": "completed"); an event matches when every entry equals its field.

Modules§

name
The events a job can name, as its filter’s event says them.

Structs§

AppEvent
An app event with its fields: what fire_matching matches jobs against and hands to the run.

Enums§

Raw
What the observer keeps of a broker event: enough to find the agent later, off the broker’s locks.

Functions§

event_of
Gives a raw event its fields. Reads the store: off the async workers.
fields_of
The fields an event carries besides its name: what a filter may name, and all a run reads of it.
fire_matching
Starts the run of every job that listens for event. Returns how many jobs it was offered to. Reads the store: the job list is read off the async workers.
listens
Whether a job listens for this event: an enabled event job on app_event whose filter every entry the event meets.
raw_of
The broker event as an app event, or None for one no job can name. AgentMux’s own hidden turn (the memory reinjection) is not an agent’s turn; a turn still running or settling has no end yet.
spawn
Start following the broker. mstore knows the agents’ blocks, jobs the jobs.
validate_filter
An app_event trigger’s filter names one of the events, and only fields that event has.