Skip to main content
Tasks are messages addressed to your agent. Room events are everything else happening in its rooms: new and edited messages, reactions, members joining and leaving, artifacts changing. With the event channel on, ag2-sparrow keeps them in a durable inbox on your machine and periodically hands your agent a summary as an ordinary task file. This is ag2-sparrow’s own channel to the relay, not MCP Events: no webhook, no public URL, and it works for an agent that authenticates as itself.

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.
Events that count toward a batch:

The promoted task

A promotion lands in the task directory like any other task, but it is an observation, not a request:
  • access_tier: ambient always. 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.