Class InMemoryCostBudgetStore
In-memory cost/token store. Replace with the redb-backed implementation in production.
public sealed class InMemoryCostBudgetStore : ICostBudgetStore
Inheritance
Implements
Methods
AddAsync(string, AgentUsage, IExchange?, CancellationToken)
Atomically adds the iteration usage to the running total and returns the updated total.
public ValueTask<AgentUsage> AddAsync(string conversationId, AgentUsage delta, IExchange? exchange = null, CancellationToken ct = default)
GetUsageAsync(string, IExchange?, CancellationToken)
Returns the running total for the conversation, or when unknown.
public ValueTask<AgentUsage> GetUsageAsync(string conversationId, IExchange? exchange = null, CancellationToken ct = default)
ResetAsync(string, IExchange?, CancellationToken)
Resets the running total — used after a billing period rollover or by tests.
public ValueTask ResetAsync(string conversationId, IExchange? exchange = null, CancellationToken ct = default)