Skip to content

Sinks

techrevati.runtime.sinks

Sinks — pluggable observability outputs for the runtime.

The orchestrator emits two streams while running:

  • AgentEvent lifecycle events (state transitions, recovery, gate, permission, handoff, budget). These go to an EventSink.
  • Per-turn usage (model + UsageSnapshot + cost). These go to a UsageSink.

Both protocols are tiny and synchronous. Default implementations buffer in memory with a bounded ring so long-running sessions can't balloon. Cross-process / cross-host observability (OpenTelemetry, Datadog, your own pipeline) ships as a separate sink that wraps these protocols — see techrevati.runtime.otel.

EventSink

Bases: Protocol

Receives every AgentEvent the runtime produces.

UsageSink

Bases: Protocol

Receives per-turn usage tuples (model, snapshot, cost in USD).

NoopEventSink dataclass

NoopEventSink()

Discard every event. The default when no sink is configured.

NoopUsageSink dataclass

NoopUsageSink()

Discard every usage record. The default when no sink is configured.

RingBufferEventSink dataclass

RingBufferEventSink(capacity=DEFAULT_RING_CAPACITY)

In-memory bounded ring of recent events.

Useful for tests, debug consoles, and short-lived processes. The buffer drops oldest entries silently once capacity is reached; if you need durability, plug in an OTel sink or write a custom one.

RingBufferUsageSink dataclass

RingBufferUsageSink(capacity=DEFAULT_RING_CAPACITY)

In-memory bounded ring of recent usage records.