Package com.tnsai.accountability
Interface ReputationLedger
- All Known Implementing Classes:
InMemoryReputationLedger
public interface ReputationLedger
Reputation oracle derived from
AgentLiabilityRecord history
(TNS-298). Surfaces "is this agent trustworthy?" to gating logic
(multi-agent orchestrators, payment brokers, scope issuers) without
forcing the caller to walk audit records every time.
Implementations
InMemoryReputationLedger— derives directly from aLiabilitySinkon every query; default, fine for fleets with manageable record volume.- External impls cache scores against a TTL or maintain a streaming aggregate; the SPI is narrow on purpose.
Score policy
Each implementation owns its weighting policy — what counts as a "miss" (out-of-scope action? failed outcome? both?) and howLiabilityClass weighs into the aggregate. The framework's
default ledger uses simple "pass / fail" counting with class-weighted
misses. Custom ledgers swap in domain-specific scoring (insurance
underwriters use a different model than internal multi-agent
orchestrators).- Since:
- 0.10.0 (TNS-298)
-
Method Summary
Modifier and TypeMethodDescriptionRecords that contributed toscoreOf(java.lang.String), scoped to the trailingwindow.Aggregate reputation foragentId.
-
Method Details
-
scoreOf
Aggregate reputation foragentId. ReturnsReputationScore.unknown(java.lang.String, java.time.Instant)for agents the ledger has no records on (innocent-until-proven default).- Throws:
NullPointerException- ifagentIdis null
-
historyOf
Records that contributed toscoreOf(java.lang.String), scoped to the trailingwindow. Useful for "show me what dropped this agent's score in the last hour" operator queries; auditors typically prefer the underlyingLiabilitySink.query(com.tnsai.accountability.AuditQuery)directly for unbounded ranges.- Throws:
NullPointerException- if any arg is nullIllegalArgumentException- ifwindowis non-positive
-