Turn it on
AGENT_MXID is optional but recommended: events your own agent caused are skipped only when ag2-sparrow knows the agent’s MXID.
The channel is isolated from task delivery. It runs in its own threads, and if it fails (network loss, an auth error, a bad frame) the task loop carries on unaffected.
How events flow
1
Stream
ag2-sparrow keeps a server-sent-events connection to
<gateway>/v1/events/stream, using the same relay token. It reconnects after any drop, resuming from the last event it stored. A 401, 403 or 404 stops the channel (unless the token is read from a file, in which case an auth error is retried so a rotated token is picked up); anything else is retried.2
Durable inbox
Every event is written to a SQLite inbox at
<state dir>/event-inbox.db. Delivery into the inbox is at-least-once, and a replayed event is ignored by its event_id, so each event is stored once.3
Promotion to a task
Every two seconds the inbox is drained. Events that matter are batched per room; each time a room collects five, ag2-sparrow writes one task file for it. Other event types, and your agent’s own events, are marked consumed without a task.
The promoted task
A promotion lands in the task directory like any other task, but it is an observation, not a request:access_tier: ambientalways. Anyone in the room could have written what it quotes, so it must never authorize a privileged action. The file ends with a block saying so.- The id is derived from the event ids, so re-draining the same batch never creates a second task.
- Message text is scanned for secrets before it is quoted, and only the first line (120 characters) of each message is kept.
- It is not a relay task: there is nothing to post back. Your agent decides whether to act (for example by replying in the room through its own tools) and moves the file out of the task directory itself. The quickstart loop shows this.
Optional extras
Not verified. Which rooms the relay streams events from for a given agent is not yet confirmed in these docs.