Principle:42 evey Hermes plugins Observability
| Knowledge Sources | |
|---|---|
| Domains | Observability, Telemetry, domain:Monitoring |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
A structured event logging pattern that emits JSON events for every significant agent action (delegations, tool calls, errors, cron executions) to a rotating log file for dashboard consumption and self-inspection.
Description
Observability for autonomous agents requires knowing what the agent did, when, with what resources, and whether it succeeded. The structured event logging pattern:
- Every significant action emits an event: Delegations, tool calls, errors, and cron executions each produce a JSON event with a timestamp, session ID, event type, and action-specific data.
- Events go to a rotating JSONL file: Append-only writes to
events.jsonl, with rotation when the file exceeds a size threshold (10MB), keeping the last N rotated files. - In-memory session metrics: A module-level dict tracks the current session's cumulative counters (tool_calls, delegations, errors, total_tokens, events_emitted).
- Self-inspection: The agent can query its own telemetry (recent events, delegation stats, tool usage, error rates) to understand its own performance.
Usage
Use this principle when building autonomous agent systems that need operational visibility. The JSONL format enables downstream dashboard tools to parse and visualize agent behavior. The self-inspection capability allows the agent to adjust its behavior based on its own metrics (e.g., noticing high error rates).
Theoretical Basis
The event schema:
Where ts is an ISO timestamp, sid is a session ID, type is the event category, and data is event-specific (model, tokens, duration, error, etc.).
# Abstract pattern (NOT real implementation)
SESSION_METRICS = {session_id, tool_calls: 0, delegations: 0, errors: 0, total_tokens: 0}
def emit_event(event_type, data):
event = {ts: now(), sid: SESSION_METRICS.session_id, type: event_type, ...data}
append_to_jsonl(event)
rotate_if_needed()
SESSION_METRICS.events_emitted += 1
The rotation strategy keeps disk usage bounded while preserving recent history. The session metrics provide a fast, in-memory summary without file I/O.