AuditLog
autogen.beta.network.hub.audit.AuditLog #
Bases: BaseHubListener
Append-only writer over the hub's KnowledgeStore.
Implements :class:HubListener so the hub fans out state-transition events through the same Protocol every other observer uses. Each listener method translates its event into one structured audit record via :meth:append.
Subscribers attached via :meth:subscribe receive every appended record live (in addition to the on-disk append). Subscriber exceptions are logged and swallowed — a buggy live tail cannot break the persistent log.
Source code in autogen/beta/network/hub/audit.py
bytes_written property #
Process-local byte counter for the audit log.
Resets on hub restart. Cheap to read — :meth:Hub.health surfaces this as audit_log_bytes so operators can graph audit volume without touching the store.
append async #
Serialise and append one record. Notifies subscribers afterwards.
Public so tenants and hub subclasses can append records with custom kind values that the built-in listener methods don't cover.
Source code in autogen/beta/network/hub/audit.py
read_all async #
Read and parse the entire audit log. Returns [] if absent.
Source code in autogen/beta/network/hub/audit.py
subscribe #
Attach a live callback fired per appended record.
Useful for tailing the audit stream without polling the file — e.g. for an operational dashboard or live alert pipeline. Callbacks run sequentially in registration order. An exception in one callback is logged and does not abort subsequent ones.
Source code in autogen/beta/network/hub/audit.py
unsubscribe #
Detach a previously-registered subscriber. No-op if absent.
on_agent_event async #
Translate identity-lifecycle events into audit records.
Recognises "registered", "unregistered", "resume_set", "skill_set", "rule_set", and "observation_recorded". Unknown kinds are ignored — subclasses fan out their own kinds via :meth:append directly.
Source code in autogen/beta/network/hub/audit.py
on_channel_event async #
Translate channel-lifecycle events into audit records.
Records "created", "closed", and "expired". Other kinds ("opened", "participant_removed", "participant_hidden") are observed but not separately audited — they show up on the channel WAL and / or in per-violation records.
Source code in autogen/beta/network/hub/audit.py
on_expectation_fired async #
Record one violation per (channel, expectation, violator) fire.
Source code in autogen/beta/network/hub/audit.py
on_task_event async #
Record terminal task transitions.
"started" / "progress" are observed-only; only the terminal kinds ("completed" / "failed" / "expired" / "cancelled") become audit records. "mirror_failed" signals that a hub-side mirror could not record the agent's terminal event — the audit reflects the failure separately.
Source code in autogen/beta/network/hub/audit.py
on_turn_failed async #
Record a notify-handler crash so operators can correlate with the WAL.