Skip to content

IRunEventSink

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Receives run events as they are written, in addition to IRunStore.

public interface IRunEventSink

Runs on the hot path. IRunEventSink.OnEventAsync is awaited before the run’s response continues streaming to its own caller — queue the event and return, do not block on further I/O.

A sink failure never fails the run. The writer that dispatches to this sink logs the exception, disables the sink for the rest of the run and keeps going — the store write and every other registered sink are unaffected.

One instance serves every concurrent run. A sink is resolved once (typically as a singleton) and its IRunEventSink.OnEventAsync is called from as many runs as are in flight at once; implementations must be thread-safe.

Events from every tenant pass through the same sink instance; use RunEvent.TenantId to tell them apart.

OnEventAsync(RunEvent, CancellationToken)

Section titled “ OnEventAsync(RunEvent, CancellationToken)”

Called for every event a run writes, in sequence order.

ValueTask OnEventAsync(RunEvent runEvent, CancellationToken cancellationToken = default)

runEvent RunEvent

The event, with its sequence number and timestamp already assigned.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.