Skip to main content

SessionAuditSink

Struct SessionAuditSink 

Source
pub struct SessionAuditSink { /* private fields */ }
Expand description

Adapter that fans AuditSink::record_* calls into a durable SessionLog.

Cloning is cheap (Arc-shared backend handle). One adapter per agent run is the typical pattern — operators construct it next to the SessionLog itself and stash it on every spawned entelix_core::context::ExecutionContext via ExecutionContext::with_audit_sink.

Implementations§

Source§

impl SessionAuditSink

Source

pub const fn new(log: Arc<dyn SessionLog>, key: ThreadKey) -> Self

Build an adapter pinned to one (tenant_id, thread_id) pair. Multi-thread runs allocate one adapter per thread; the adapter is stateless beyond the Arc handle so cloning a sink and re-keying via Self::with_thread_key is also a valid pattern.

Source

pub fn with_thread_key(self, key: ThreadKey) -> Self

Re-target an existing adapter at a different ThreadKey. Useful when a parent run spawns a sub-thread and wants the sub-thread’s events to land under a distinct audit scope.

Trait Implementations§

Source§

impl AuditSink for SessionAuditSink

Source§

fn record_sub_agent_invoked(&self, agent_id: &str, sub_thread_id: &str)

Record that a sub-agent was dispatched from the parent run.
Source§

fn record_agent_handoff(&self, from: Option<&str>, to: &str)

Record that a supervisor recipe handed control between named agents. from = None on the first turn.
Source§

fn record_resumed(&self, from_checkpoint: &str)

Record that the run resumed from a prior checkpoint. from_checkpoint is the empty string when the resume happened from a fresh state.
Source§

fn record_memory_recall(&self, tier: &str, namespace_key: &str, hits: usize)

Record that a long-term memory tier returned hits records for namespace_key. The hits themselves stay outside the audit channel — the model-facing content already lands in AssistantMessage / ToolResult, and storing the full retrieved corpus inline would balloon the audit trail.
Source§

fn record_usage_limit_exceeded(&self, breach: &UsageLimitBreach)

Record that a crate::RunBudget axis hit its cap and short-circuited the run with Error::UsageLimitExceeded. The typed crate::run_budget::UsageLimitBreach carries both the breaching axis (variant) and the magnitude (typed per variant: u64 count for tokens / requests / tool calls, Decimal USD for the cost axis), so emit sites pass the breach value straight through from the matching Error::UsageLimitExceeded(breach) arm.
Source§

fn record_context_compacted(&self, dropped_chars: usize, retained_chars: usize)

Record that an auto-compaction adapter trimmed the working message slice. dropped_chars is the character cost of the turns the compactor dropped (or summarised away); retained_chars is the cost of the turns the post-compaction slice carries forward. Operators correlate the pair against the threshold they wired to detect drift between configured budget and actual trim — production observability for the RunnableCompacting path (lives in entelix-agents).
Source§

impl Debug for SessionAuditSink

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more