ag2-observers-and-alerts

Installation
SKILL.md

Observers, watches, and alerts

When to use

  • Observability — log model responses, tool calls, token usage.
  • Runtime safety — block dangerous tool arguments, halt the agent.
  • Reactive metrics — fire on every Nth response, or every M seconds.
  • Loop / repetition detection — catch infinite tool-call loops.
  • Stateful monitoring — anything that needs to remember prior events to decide what to do next.

Two observer shapes

Shape When Use
Stateless function One-off event hook (logging, metrics) @observer(EventType)
Stateful class Counters / windows / thresholds / composed triggers Subclass BaseObserver

Both are stream subscribers under the hood — registered on the agent rather than directly on the stream.

Installs
18
GitHub Stars
3
First Seen
May 8, 2026
ag2-observers-and-alerts — ag2ai/ag2-skills